A nearley based sql parser and analyzer
npm install js-sql-parsenpm run test./tests are the best place to see examples of use. A basic example is:```
const parser = require('js-sql-parser');
const result = parser.parse('select * from test_table');
The result of the parse method will have the following fields:
- referencedTables: a list of tables used in the query
- createdTables: a list of tables created in the query
- sourceTables: a list of tables sourced in subqueries and joins
- operation: the operation defined in the query - currently only select and create_view` are supported
- parsed: the resulting parse tree
- joins: a list of joins within the query, and the columns used