A SQL parser for Node.js that generates an AST from SQL statements and can stringify AST back to SQL. Current version 1.0.4 is the latest stable release, with no active development since 2016. Written in pure JavaScript, it uses PEG.js for parsing and supports SQL syntax inspired by various databases like MySQL, PostgreSQL, BigQuery, and PL/SQL. Compared to alternatives like node-sql-parser (with ongoing support), this package is minimal and was historically used by Alibaba's nQuery project. No TypeScript types or ES module support; requires Node >=0.8.0.
npm install node-sqlparserNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a SQL query into an AST and then stringifies it back to SQL. Demonstrates the two main static functions.
Consider migrating to actively maintained alternatives such as node-sql-parser (npm: node-sql-parser) or @babel/parser for SQL.
Switch to an alternative library. Node compatibility may break in future Node releases.
If you need advanced SQL parsing, use a more comprehensive parser like node-sql-parser or antlr4-based parsers.
Use a community-provided types package if available, or avoid TypeScript with this library.
Run 'npm install node-sqlparser' to install.
Use 'import { parse } from 'node-sqlparser'' or 'const { parse } = require('node-sqlparser')'.Simplify your SQL or use a different parser that supports your dialect. Check the parser's grammar.
Use 'import { AST } from 'node-sqlparser'' or 'const { AST } = require('node-sqlparser')'.No dependency data recorded yet.