The `sqlite-parser` library provides a JavaScript implementation for parsing SQLite 3 SQL queries, generating an Abstract Syntax Tree (AST) representation. It supports both synchronous and asynchronous parsing via a callback function, allowing for flexible integration into applications. Since version 1.0.0, it introduced experimental stream transform capabilities (`createParser`, `createStitcher`) designed to handle large SQL files efficiently by processing them in chunks rather than loading the entire file into memory, which helps mitigate memory limitations. The library explicitly targets the SQLite 3 specification for its parsing logic. Its latest release, v1.0.1, was published over seven years ago (as of 2026), indicating that the project is no longer actively maintained. The AST structure itself underwent significant changes in pre-1.0.0 releases, particularly regarding property casing and the representation of complex expressions like `CASE` statements and binary operations. It is compatible with Node.js environments from version 4 onwards and can also be used in browsers via a bundled script.
npm install sqlite-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates both synchronous and asynchronous parsing of a single SQLite query using the `sqliteParser` function. It also includes an example of how to use the `createParser` and `createStitcher` stream transforms for parsing large SQL files, writing the resulting AST to stdout.
Update consumers of the AST to expect and handle lowercase property values, performing case-insensitive checks if compatibility with older ASTs is required.
Review and refactor code that processes `CASE` expressions in the AST to conform to the new structure, especially regarding `variant` types and property names.
Thoroughly test existing SQL queries to verify the generated ASTs and adjust any logic that relies on a specific parse tree order for complex binary expressions.
Update AST traversal or processing logic to correctly identify and handle `NOT NULL` as a binary expression rather than a unary one.
Ensure you are using the correct browserified (unminified) bundle if deploying to browser environments. Avoid relying on custom minification of the `dist/sqlite-parser.js` file if you encounter this error.
Consider the long-term viability and security implications when adopting this library. Evaluate alternative, actively maintained SQLite parsers if active development and support are critical requirements.
Do not use the minified `dist/sqlite-parser.js` directly in a browser environment; use the provided browserified bundle, which skips minification to avoid this issue (as of v1.0.0-rc3).
Ensure you are using a version >= 0.14.2. If on an older version, manually verify `dist/sqlite-parser.min.js` exists or update to a newer, stable release.
No dependency data recorded yet.