Command line
Install
curl -sSf https://raw.githubusercontent.com/LalitMaganti/syntaqlite/main/tools/syntaqlite | python3 - install
Downloads the latest release to ~/.local/bin. Works on macOS, Linux, and Windows. Optionally pass a custom directory: python3 - install /usr/local/bin.
mise use github:LalitMaganti/syntaqlite
pip install syntaqlite
Installs the CLI binary and Python library API. No Rust toolchain needed.
brew install LalitMaganti/tap/syntaqlite
cargo install syntaqlite-cli
Check that it installed:
syntaqlite --version
Format a query
Run this to see formatting in action:
syntaqlite fmt -e "select id,name,email from users where active=1 and role='admin' order by name"
Output:
SELECT id, name, email
FROM users
WHERE
active = 1
AND role = 'admin'
ORDER BY
name;
Keywords are uppercased, clauses break onto separate lines, and a semicolon is appended.
Format a file
Create a file called query.sql:
select u.id,u.name,p.title from users u join posts p on u.id=p.user_id where u.active=1
Format it in place:
syntaqlite fmt -i query.sql
cat query.sql
SELECT u.id, u.name, p.title
FROM users AS u
JOIN posts AS p ON u.id = p.user_id
WHERE
u.active = 1;
To format every SQL file in a project at once:
syntaqlite fmt -i "**/*.sql"
Validate against a schema
syntaqlite can check table and column names against your schema. See the project setup guide for setup instructions.
Check formatting in CI
Use --check to verify files are formatted without modifying them. See the
CI integration guide for full setup.
Next steps
- Project setup guide — configure
syntaqlite.tomlfor a real project - Python library tutorial — use
parse,format_sql,validatefrom Python - CLI reference — all flags for
fmt,validate,parse, andlsp - Config file reference —
syntaqlite.tomlformat - Formatting options — line width, keyword casing, and more