A SQL parser library built with ANTLR4, supporting multiple SQL dialects including MySQL, PostgreSQL, Hive, Spark, Flink, Trino, and Impala. Version 4.5.0 is the latest stable release, with regular updates. It provides both parsing and code-completion functionality, distinguishing itself by targeting Big Data SQL dialects rather than standard SQL only. It is ESM-only since v4, requires Node >=18, and ships TypeScript type definitions.
npm install dt-sql-parserNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a SQL query and retrieves code completion suggestions using MySQL dialect.
Convert require() to import statements. Ensure package.json has 'type':'module' or use .mjs file extension.
Upgrade Node.js to version 18 or higher.
Use dialect-specific class constructors directly (e.g., new MySQL()).
Wrap parse calls in try/catch blocks.
Validate suggestions against actual schema metadata if needed.
Use strict mode and check type definitions; augment if needed.
Use import syntax, add 'type':'module' in package.json, or rename file to .mjs.
Use import { MySQL } from 'dt-sql-parser' instead of import Parser from 'dt-sql-parser'.Only import from the main entry: './dt-sql-parser'.
Install antlr4: npm install antlr4@^4.13.0