
SQLFluff
A SQL linter and auto-formatter that checks and fixes style across many SQL dialects.
- Stars
- 10k
- Forks
- 1.3k
- Licence
- MIT
- Language
- Python
- Last update
- 5 days ago
- Type
- Dev tool
What it is
SQLFluff checks SQL code for style and layout problems and can automatically fix most of them. It supports many database dialects, such as PostgreSQL, BigQuery and Snowflake, and can work with templated SQL including Jinja and dbt. People use it to keep SQL code consistent, especially in data pipelines.
- Lint a .sql file to find layout and style issues before committing
- Automatically fix most style errors with the fix command
- Check dbt or Jinja-templated models for problems
- Run it in a container through the official Docker image
Great for
- Data engineers maintaining dbt or ELT SQL projects
- Teams that want a shared SQL style enforced automatically
- Developers working across several SQL dialects
- Projects that use Jinja-templated SQL
Not ideal for
- People who only need to run a single query, since this checks code rather than executing it
- Users of SQL dialects not on the README's supported list, as support may be partial
- Anyone needing a non-Python install path, since the README centers on pip and Docker
How to get it
- 1
Install with a package manager
You'll need: Python
Install SQLFluff from PyPI
pip install sqlfluff - 2
Run it
- Install with pip install sqlfluff
- Create a test file, for example test.sql, containing some SQL
- Run sqlfluff lint test.sql --dialect ansi to see issues
- Run sqlfluff fix to apply automatic fixes
- 3
Get the most out of it
- Use the optional rs extra (pip install sqlfluff[rs]) for the Rust-backed parser and lexer
- Use the VS Code extension listed in the README for editor integration
- Consult the docs at docs.sqlfluff.com for CLI usage and the rules reference
- Set the dialect explicitly with --dialect to match your database
Downloads
Strengths
- Supports a long list of SQL dialects
- Can auto-fix most linting errors
- Works with Jinja templating and dbt (with a plugin)
Trade-offs
- Dialect support is described as possibly not complete
- dbt support requires installing a separate plugin
- The optional Rust-backed parser needs a Rust toolchain if no prebuilt wheel exists for your platform
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| sqlfluff (this) | 10k | Dev tool | beginner | 5 days ago | Data engineers maintaining dbt or ELT SQL projects |
| sqlc | 18.4k | Dev tool | intermediate | 4 days ago | Go developers who prefer writing plain SQL over using an ORM |
| duckdb | 42.7k | Library | beginner | 4 days ago | Analysts who want to run SQL directly on CSV, Parquet, or JSON files |
| turso | 25.1k | Library | intermediate | 4 days ago | Developers who want an embedded SQLite-compatible database in a Rust, JavaScript, Python, Java, Go, or .NET project |
| kysely | 14.3k | Library | intermediate | 4 days ago | TypeScript developers who want SQL control without losing compile-time type checks |
| sqlalchemy | 12.3k | Library | intermediate | 5 days ago | Python developers building applications backed by a SQL database |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.