A nearley based sql parser and analyzer
Currently a work in progress: The end goal is to be able to parse and analyze general sql queries.
JS SQL Parse uses Nearley to parse strings. The grammar is defined in sql.ne
Run tests using npm run test
The test files in ./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:
select
and create_view
are supported