Pure TypeScript ClickHouse SQL parser that produces a typed AST with discriminated unions, supports traversal, modification, and canonical SQL serialization. Current stable version is 0.1.1, released as an early-stage library. Key differentiators: designed specifically for ClickHouse syntax (FINAL, PREWHERE, LIMIT BY, SETTINGS), provides a structured AST with kind-based type narrowing, includes dialect configuration, and normalizes SQL output by stripping comments and whitespace. Compared to generic SQL parsers, parsehouse targets ClickHouse-specific features and TypeScript-first typing, making it suitable for building linters, validators, and refactoring tools.
npm install parsehouseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a ClickHouse SQL statement, inspecting AST nodes (table reference with FINAL), modifying the limit, and serializing back to canonical SQL.
Pin to exact version and review changelog before upgrading.
Use parseSql instead of parseStatement when parsing scripts with semicolon-separated queries.
Use import syntax or dynamic import; add 'type': 'module' to package.json or use .mjs extension.
Only use ClickHouseDialect for now.
Use the exported type guards or string constants if available; always use the exact kind value.
Ensure 'parsehouse' is installed: npm install parsehouse. Verify tsconfig.json includes node module resolution.
Add 'type': 'module' to package.json, rename files to .mjs, or use dynamic import().
Use import statements instead of require().
Use { parseStatement } in the import statement.No dependency data recorded yet.