SQLite SQL tools — parser, formatter, validator, and MCP server
Project description
syntaqlite
A parser, formatter, validator, and language server for SQLite SQL, built on SQLite's own grammar and tokenizer. If SQLite accepts it, syntaqlite parses it. If SQLite rejects it, so does syntaqlite.
Docs · Playground · VS Code Extension · MCP Server
Note: syntaqlite is at 0.x — APIs and CLI flags may change before 1.0.
Why syntaqlite
Developer tooling for SQLite treats it as a second-class language. Most tools build a generic SQL parser and bolt SQLite on as a "flavor" — hand-written grammars, regex-based tokenizers, or subsets of SQL that approximate SQLite rather than matching it. That falls apart because SQLite has a deep surface area of syntax that generic parsers don't handle.
syntaqlite uses SQLite's own Lemon-generated grammar and tokenizer, compiled from C. The parser doesn't approximate SQLite — it is SQLite's grammar compiled into a reusable library.
SQLite SQL is also not one fixed language. It has 22 compile-time flags that change what syntax the parser accepts, another 12 that gate built-in functions, and the language constantly evolves across versions. Because SQLite is embedded, you can't assume everyone is on the latest version — Android 15 ships SQLite 3.44.3, seven major versions behind latest. syntaqlite tracks all of this:
syntaqlite --sqlite-version 3.32.0 validate \
-e "DELETE FROM users WHERE id = 1 RETURNING *;"
error: syntax error near 'RETURNING'
--> <stdin>:1:32
|
1 | DELETE FROM users WHERE id = 1 RETURNING *;
| ^~~~~~~~~
RETURNING was added in SQLite 3.35.0 — Android 13 still ships SQLite 3.32.2.
We've tested against ~396K statements from SQLite's upstream test suite with ~99.7% agreement on parse acceptance. See the detailed comparison for how syntaqlite stacks up against other tools in parser accuracy, formatter correctness, validator quality, and performance.
What it does
Validate — catch errors without a database (docs)
Finds 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:
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;
sqlite3 stops at the first error and misses the function typo entirely:
Error: in prepare, table monthly_stats has 2 values for 3 columns
syntaqlite finds both — CTE column count mismatch and the ROUDN typo — with source locations and suggestions:
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'?
Format (docs)
Deterministic formatting with configurable line width, keyword casing, and indentation:
echo "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" \
| syntaqlite fmt
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;
Version and compile-flag aware (docs)
Pin the parser to a specific SQLite version or enable compile-time flags to match your exact build:
# Reject syntax your target SQLite version doesn't support
syntaqlite --sqlite-version 3.32.0 validate query.sql
# Enable optional syntax from compile-time flags
syntaqlite --sqlite-cflag SQLITE_ENABLE_MATH_FUNCTIONS validate query.sql
Validate SQL inside other languages (experimental)
SQL lives inside Python and TypeScript strings in most real codebases. syntaqlite extracts and validates it, handling interpolation holes:
# app.py
def get_user_stats(user_id: int):
return conn.execute(
f"SELECT nme, ROUDN(score, 2) FROM users WHERE id = {user_id}"
)
syntaqlite validate --experimental-lang python app.py
warning: unknown function 'ROUDN'
--> app.py:3:23
|
3 | f"SELECT nme, ROUDN(score, 2) FROM users WHERE id = {user_id}"
| ^~~~~
= help: did you mean 'round'?
Editor integration (docs)
Full language server — no database connection required. Diagnostics, format on save, completions, and semantic highlighting.
VS Code — install the syntaqlite extension from the marketplace.
Claude Code — syntaqlite plugin install · Claude Desktop / Cursor — pip install syntaqlite[mcp] (docs)
Other editors — point your LSP client at:
syntaqlite lsp
Parse (docs)
Full abstract syntax tree with side tables for tokens, comments, and whitespace — for code generation, migration tooling, or static analysis.
syntaqlite parse -e "SELECT 1 + 2" --output text
Install (all methods)
Download and run (all platforms, no install)
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.
mise
mise use github:LalitMaganti/syntaqlite
pip (all platforms, bundled binary)
pip install syntaqlite
Homebrew (macOS)
brew install LalitMaganti/tap/syntaqlite
Cargo
cargo install syntaqlite-cli
Use as a library (docs)
Rust (API docs)
[dependencies]
syntaqlite = { version = "0.0.19", features = ["fmt"] }
JavaScript / WASM (API docs)
npm install @syntaqlite/js
C — the parser, tokenizer, formatter, and validator all have C APIs. See the C API docs for details.
Architecture (docs)
The parser and tokenizer are written in C, directly wrapping SQLite's own grammar. Everything else — formatter, validator, LSP — is written in Rust with C bindings available.
The split is intentional. The C parser is as portable as SQLite itself: it can run inside database engines, embedded systems, or anywhere SQLite runs. The Rust layer moves fast for developer tooling where the standard library and the crate ecosystem matter.
Building from source
tools/install-build-deps
tools/cargo build
Contributing
See the contributing guide for architecture overview and testing instructions.
License
Apache 2.0. SQLite components are public domain under the SQLite blessing. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file syntaqlite-0.0.19-py3-none-win_arm64.whl.
File metadata
- Download URL: syntaqlite-0.0.19-py3-none-win_arm64.whl
- Upload date:
- Size: 3.9 MB
- Tags: Python 3, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca4cb7c47415bd584ed82be6fd8a2cc5a9d58d494e7dfc338301bb86f98ff0e9
|
|
| MD5 |
c3cbad52a4b172dc37c2431d6b82400d
|
|
| BLAKE2b-256 |
13c3de32f7f89e4e493676672ac1443870f251325cdd5516c24730a916709009
|
Provenance
The following attestation bundles were made for syntaqlite-0.0.19-py3-none-win_arm64.whl:
Publisher:
publish-pypi.yml on LalitMaganti/syntaqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syntaqlite-0.0.19-py3-none-win_arm64.whl -
Subject digest:
ca4cb7c47415bd584ed82be6fd8a2cc5a9d58d494e7dfc338301bb86f98ff0e9 - Sigstore transparency entry: 1107002712
- Sigstore integration time:
-
Permalink:
LalitMaganti/syntaqlite@f692b87654434b449759daf44ac68fd1b83202f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LalitMaganti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f692b87654434b449759daf44ac68fd1b83202f8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file syntaqlite-0.0.19-py3-none-win_amd64.whl.
File metadata
- Download URL: syntaqlite-0.0.19-py3-none-win_amd64.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c77ff49a48d0270ce485472004c7b8db6b5bffec761d86c0e3ad843c063c800
|
|
| MD5 |
75799d8af7ba219248ec582055c1c0e9
|
|
| BLAKE2b-256 |
1ad7ca0efac18cfd991ee9b9d05092fe106ff88be78cced5cfe329df5208d142
|
Provenance
The following attestation bundles were made for syntaqlite-0.0.19-py3-none-win_amd64.whl:
Publisher:
publish-pypi.yml on LalitMaganti/syntaqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syntaqlite-0.0.19-py3-none-win_amd64.whl -
Subject digest:
0c77ff49a48d0270ce485472004c7b8db6b5bffec761d86c0e3ad843c063c800 - Sigstore transparency entry: 1107002716
- Sigstore integration time:
-
Permalink:
LalitMaganti/syntaqlite@f692b87654434b449759daf44ac68fd1b83202f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LalitMaganti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f692b87654434b449759daf44ac68fd1b83202f8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file syntaqlite-0.0.19-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: syntaqlite-0.0.19-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b28f356f17461d9c3048c825601fb0c7b0b4a6cb5e6eca6114d90a32835c5e2
|
|
| MD5 |
24b8e8f75c8843641bd7ef8982553e7c
|
|
| BLAKE2b-256 |
fbc4197b7181c75f8cb22a407ca21556b3f216554d56f6990c0b4dedf8addbd3
|
Provenance
The following attestation bundles were made for syntaqlite-0.0.19-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish-pypi.yml on LalitMaganti/syntaqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syntaqlite-0.0.19-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
8b28f356f17461d9c3048c825601fb0c7b0b4a6cb5e6eca6114d90a32835c5e2 - Sigstore transparency entry: 1107002718
- Sigstore integration time:
-
Permalink:
LalitMaganti/syntaqlite@f692b87654434b449759daf44ac68fd1b83202f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LalitMaganti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f692b87654434b449759daf44ac68fd1b83202f8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file syntaqlite-0.0.19-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: syntaqlite-0.0.19-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 4.8 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8298842be503d28ca2dc13e74a35c086d8f2a085991d33e1e28488d4d375842c
|
|
| MD5 |
05f55d771c810ddc21583a7c8c7473e4
|
|
| BLAKE2b-256 |
d7cf53b4e49ec697501c9f2e8784d2abb8662addab1237ae7b6b6bc08014dba8
|
Provenance
The following attestation bundles were made for syntaqlite-0.0.19-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish-pypi.yml on LalitMaganti/syntaqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syntaqlite-0.0.19-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
8298842be503d28ca2dc13e74a35c086d8f2a085991d33e1e28488d4d375842c - Sigstore transparency entry: 1107002721
- Sigstore integration time:
-
Permalink:
LalitMaganti/syntaqlite@f692b87654434b449759daf44ac68fd1b83202f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LalitMaganti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f692b87654434b449759daf44ac68fd1b83202f8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file syntaqlite-0.0.19-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: syntaqlite-0.0.19-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6346825f198e7866229693574022327453d93828766a789da6e7cee27bc8f10
|
|
| MD5 |
9a701d69b7afef1842a89d4c7509b79f
|
|
| BLAKE2b-256 |
b2067db086b0e792bbee999ea3d68505584fd3e461c3cbfad4fc600d0bcc7dff
|
Provenance
The following attestation bundles were made for syntaqlite-0.0.19-py3-none-macosx_11_0_arm64.whl:
Publisher:
publish-pypi.yml on LalitMaganti/syntaqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syntaqlite-0.0.19-py3-none-macosx_11_0_arm64.whl -
Subject digest:
b6346825f198e7866229693574022327453d93828766a789da6e7cee27bc8f10 - Sigstore transparency entry: 1107002714
- Sigstore integration time:
-
Permalink:
LalitMaganti/syntaqlite@f692b87654434b449759daf44ac68fd1b83202f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LalitMaganti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f692b87654434b449759daf44ac68fd1b83202f8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file syntaqlite-0.0.19-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: syntaqlite-0.0.19-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb7cdfaac01016e6a97f40689b35c1fbc93fe93775181c793eef9e8930997468
|
|
| MD5 |
bf7495d354b8942b756e504ecc38fc18
|
|
| BLAKE2b-256 |
6b933abdb1ed1749e5353bcc3cba5dda0a97d04b11677e54c0b4dd54baa40794
|
Provenance
The following attestation bundles were made for syntaqlite-0.0.19-py3-none-macosx_10_12_x86_64.whl:
Publisher:
publish-pypi.yml on LalitMaganti/syntaqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
syntaqlite-0.0.19-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
bb7cdfaac01016e6a97f40689b35c1fbc93fe93775181c793eef9e8930997468 - Sigstore transparency entry: 1107002723
- Sigstore integration time:
-
Permalink:
LalitMaganti/syntaqlite@f692b87654434b449759daf44ac68fd1b83202f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LalitMaganti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@f692b87654434b449759daf44ac68fd1b83202f8 -
Trigger Event:
workflow_run
-
Statement type: