Getting started

syntaqlite provides a CLI and language server for parsing, formatting, and statically analyzing SQLite SQL. You can try it in the browser without installing anything, or install the CLI. To embed the same parser, formatter, and static analyzer in your own software, use libsyntaqlite from Rust, Python, JavaScript/WASM, or C.

Install the CLI

curl -sSf https://raw.githubusercontent.com/LalitMaganti/syntaqlite/main/tools/syntaqlite | python3 - fmt -e "select 1"

Downloads the binary on first run, caches it, auto-updates weekly. Works on macOS, Linux, and Windows.

mise use github:LalitMaganti/syntaqlite
pip install syntaqlite

Installs the CLI binary and the libsyntaqlite Python API. No Rust toolchain needed.

brew install LalitMaganti/tap/syntaqlite
cargo install syntaqlite-cli

Format

syntaqlite fmt -e "select id,name from users where active=1 and role='admin'"
SELECT id, name FROM users WHERE active = 1 AND role = 'admin';

Format a file in place with syntaqlite fmt -i query.sql, or check formatting in CI with syntaqlite fmt --check "**/*.sql".

Analyze

syntaqlite reads your CREATE TABLE statements to build a schema, then validates queries against it without connecting to a database. A single run can report multiple errors, including source locations and spelling suggestions:

syntaqlite analyze -e "CREATE TABLE users (id, name, email); SELECT nme FROM users;"
warning: unknown column 'nme'
 --> <expression>:1:46
  |
1 | CREATE TABLE users (id, name, email); SELECT nme FROM users;
  |                                              ^~~
  = help: did you mean 'name'?

For real projects, separate your schema from your queries:

syntaqlite analyze --schema schema.sql queries.sql

Parse

Inspect the full abstract syntax tree:

syntaqlite parse -e "SELECT 1 + 2"

The AST can be used for code generation, migration tooling, and static analysis. The libsyntaqlite Rust guide and libsyntaqlite Python tutorial show how to work with it programmatically.