Registry / database / analytics-sqlparser-bbt

analytics-sqlparser-bbt

JSON →
library1.2.3jsnpmunverified

SQL parser for Hive, Spark, Flink, Impala and other big data dialects, based on dt-sql-parser (ANTLR-generated). Current version 1.2.3, stable with occasional updates. Ships TypeScript types. Key differentiator: specializes in big data SQL dialects, providing parse, lexical analysis, and syntax validation for multiple engines. Commonly used with Monaco Editor for SQL autocompletion and error checking. Note: requires manual patch to expose literalNames from generated ANTLR code. ESM-only package.

npm install analytics-sqlparser-bbt
INSTALL
IMPORT
SIG · ANALYTICS-SQLPARSE
A
analytics-sqlparser-bbt
databasejavascriptv1.2.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AnalyticsSQLParser
import { AnalyticsSQLParser } from 'analytics-sqlparser-bbt'
const AnalyticsSQLParser = require('analytics-sqlparser-bbt')
ESM-only package; CommonJS require will fail.
parse
import { parse } from 'analytics-sqlparser-bbt'
import parse from 'analytics-sqlparser-bbt'
parse is a named export, not default.
Parser
import { Parser } from 'analytics-sqlparser-bbt'
Type only; available when TypeScript is used.

Parse a SQL query using Hive dialect and output the parsed structure including tables and columns.

import { AnalyticsSQLParser } from 'analytics-sqlparser-bbt'; const parser = new AnalyticsSQLParser('hive'); // dialect: 'hive' | 'spark' | 'flink' | 'impala' const result = parser.parse('SELECT * FROM table WHERE id = 1'); console.log(result); // Example output: { tables: ['table'], columns: ['*', 'id'], errors: [] }
Debug
Known issues
gotchaMust manually patch AnalyticsSQLParser.js after install to expose literalNames for lexer token names
fix
Add `exports.literalNames = literalNames` at the end of node_modules/analytics-sqlparser-bbt/dist/AnalyticsSQLParser.js
affects: all
gotchaThe package is ESM-only; cannot be required via CommonJS require()
fix
Use import syntax or dynamic import() in CommonJS projects.
affects: >=1.0.0
deprecatedSome dialect-specific options may change between minor versions; check changelog.
fix
Pin exact version and review changes before upgrading.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'analytics-sqlparser-bbt'
Package not installed or missing from node_modules
fix
Run `npm install analytics-sqlparser-bbt --save`
SyntaxError: Unexpected token 'export'
Trying to require an ESM module in a CommonJS context
fix
Use dynamic import: `const { AnalyticsSQLParser } = await import('analytics-sqlparser-bbt');` or set `"type": "module"` in package.json
TypeError: Cannot read properties of undefined (reading 'literalNames')
The manual patch to add exports.literalNames was not applied
fix
Add `exports.literalNames = literalNames` at the end of AnalyticsSQLParser.js as described in the README
Upgrade
Version history
1.2.3latest on npm
Audit
Dependencies
dt-sql-parserrequiredcore SQL parsing logic; analytics-sqlparser-bbt is a wrapper around dt-sql-parser's ANTLR-generated parsers
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources