ClickHouse
ClickHouse® is a real-time analytics database management system
Dialect-aware SQL statement splitter, tokenizer, and classifier for Tabularis.
Dialect-aware SQL statement splitter, tokenizer, and classifier — the first-party engine that powers Tabularis.
It splits a SQL script into individual statements without a full parser, honouring the quoting, comment, and delimiter rules of each dialect, and classifies each statement (does it return a result set? is it explainable?). It has no runtime dependencies.
npm install @tabularis/sql-splitter
# or: pnpm add @tabularis/sql-splitter
import { splitStatements, splitQueries } from "@tabularis/sql-splitter"; const sql = ` SELECT 1; INSERT INTO t (a) VALUES (2); `; // Full metadata per statement. for (const stmt of splitStatements(sql, "postgres")) { console.log(stmt.text, stmt.returnsResultSet, stmt.range); } // Just the statement texts. const queries = splitQueries(sql, "mysql"); // string[]
dialect is optional and accepts a Dialect | string; unknown values fall back to the generic preset (a plain undefined defaults to postgres), so plugin-manifest values can flow in without extra validation.
postgres · mysql · mssql · sqlite · oracle · generic
Each preset encodes the lexical quirks that matter for splitting, including:
$tag$ … $tag$), E'…' escape strings, nested block comments.\ string escapes, DELIMITER changes, executable comments (/*! … */), and -- requiring a trailing space.[bracket] identifiers and the GO batch separator./ terminator, and q'[ … ]' / nq'…' alternative quoting.splitStatements(sql, dialect?) → Statement[] — per-statement metadata.splitQueries(sql, dialect?) → string[] — statement texts only.dialectOptions(dialect) → DialectOptions — the resolved lexer preset for a Dialect.A Statement carries text, a range ({ start, end } as JS UTF-16 code-unit offsets into the original source), and the classifier flags isSelect, returnsResultSet, isExplainable.
Single-statement helpers, usable independently of splitting:
isSelect(query) — leading keyword is SELECT.returnsResultSet(query) — statement produces rows (SELECT, WITH, SHOW, VALUES, PRAGMA, …).isExplainable(query) — statement can be prefixed with EXPLAIN.stripLeadingComments(query) — drop leading line/block comments and whitespace.Dialect, Statement, StatementRange, Token, TokenKind, QuoteRule, DialectOptions are all exported.
ClickHouse® is a real-time analytics database management system
DuckDB is an analytical in-process SQL database management system
TiDB is built for agentic workloads that grow unpredictably, with ACID guarantees and native support for transactions, analytics, and vector search. No data silos. No noisy neighbors. No infrastructure ceiling.
Free, simple, and intuitive online database diagram editor and SQL generator.
Neue Version verfügbar.