syntaqlite

A parser, formatter, validator, and language server (LSP) for SQLite SQL — built directly from SQLite's own tokenizer and grammar rules, not an approximation. If SQLite accepts it, syntaqlite parses it, including syntax gated behind specific versions and compile-time flags.

What it does

Format

Configurable line width, keyword casing, and indentation. The formatter is deterministic — the same input always produces the same output.

Input
select u.id, u.name, p.title
from users u join posts p
on u.id=p.user_id
where u.active=1
and p.published=true
order by p.created_at desc
limit 10
Output
SELECT u.id, u.name, p.title
FROM users u
  JOIN posts p ON u.id = p.user_id
WHERE u.active = 1
  AND p.published = true
ORDER BY p.created_at DESC
LIMIT 10;

Validate

Catches unknown tables, columns, and functions against your schema — the same errors sqlite3_prepare would catch, but without needing a database. Unlike sqlite3, syntaqlite finds all errors in one pass and shows exactly where they are:

CREATE TABLE orders (id, status, total, created_at);

WITH
  monthly_stats(month, revenue, order_count) AS (
    SELECT strftime('%Y-%m', o.created_at), SUM(o.total)
    FROM orders o WHERE o.status = 'completed'
    GROUP BY strftime('%Y-%m', o.created_at)
  )
SELECT ms.month, ms.revenue, ms.order_count,
  ROUDN(ms.revenue / ms.order_count, 2) AS avg_order
FROM monthly_stats ms;

Two errors: CTE declares 3 columns but the SELECT produces 2, and ROUDN is a typo for ROUND.

sqlite3
Error: in prepare, table monthly_stats
has 2 values for 3 columns

Stops at first error. Misses the ROUDN typo entirely.

syntaqlite
error: table 'monthly_stats' has 2
      values for 3 columns
  |
2 | monthly_stats(month, revenue,
  | ^~~~~~~~~~~~~

warning: unknown function 'ROUDN'
   |
14 | ROUDN(ms.revenue / ms.order_count,
   | ^~~~~
   = help: did you mean 'round'?

Parse

Abstract syntax tree with side tables for tokens, comments, and whitespace boundaries.

SelectStmt
  columns:
    ResultColumn
      expr:
        ColumnRef
          column: "id"
    ResultColumn
      expr:
        ColumnRef
          column: "name"
  from_clause:
    TableRef
      table_name: "users"
  where_clause:
    BinaryExpr
      op: EQ
      left:
        ColumnRef
          column: "active"
      right:
        Literal "1"

Editor integration

Built-in language server (LSP) with real-time diagnostics, format on save, completions for keywords, functions, tables and columns, and semantic syntax highlighting.

# VS Code — install from the marketplace
ext install syntaqlite.syntaqlite

# Any editor — point your LSP client at:
syntaqlite lsp

Design principles

  • Reliability — uses SQLite's own tokenizer and grammar rules, verified by running the full SQLite test suite through the parser.
  • Speed — parses 3,500 lines of SQL in 2.6ms, formats in 4.9ms, validates in 7.3ms. Faster than sqlite3 itself for validation. Zero-copy tokenizer, arena-allocated parser, Wadler-Lindig formatter — all allocations are reused across inputs.
  • Portability — no runtime dependencies beyond the C and Rust standard libraries. Runs natively, in WASM, and as a shared library.
  • Extensibility — the grammar system supports database engines that extend SQLite's syntax. Define custom grammar rules, AST nodes, and formatting recipes, then load your dialect as a shared library at runtime.

syntaqlite grew out of 8+ years of maintaining PerfettoSQL and scaling it to 100K+ line SQL codebases. See the comparison for how it stacks up against other tools.

What it does not do

  • It does not support other SQL engines. syntaqlite is SQLite-only by design — this is what allows it to use the real grammar rather than a lowest-common-denominator subset.
  • It does not do runtime type checking. It catches what sqlite3_prepare catches (syntax errors, unknown names), not data-dependent errors like division by zero or type mismatches.

Get started

Pick your starting point:

Try it without installing Open the playground — format, validate, and parse SQL directly in your browser. VS Code Install the extension — diagnostics, formatting, and completions out of the box. Claude Code Plugin and MCP server for Claude Code, Claude Desktop, Cursor, Windsurf. Command line Install the CLI for formatting, validation, CI, and scripting. Other editors Neovim, Helix, or any editor with LSP support.

Further reading

Guides CI integration, version pinning, custom dialects. Integrating Rust and C APIs for embedding. Contributing Architecture, testing, how the project works. Reference CLI flags and config options.