sqlfluff
SQLFluff is a dialect-aware SQL linter and auto-formatter written in Python that supports 25+ SQL dialects and templating languages like Jinja and dbt. It catches formatting and style issues automatically and can fix most problems without manual intervention, making it suitable for teams managing complex SQL workflows.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | sqlfluff/sqlfluff |
| Owner | sqlfluff |
| Primary language | Python |
| License | MIT — OSI-approved |
| Stars | 9.8k |
| Forks | 1k |
| Open issues | 361 |
| Latest release | 4.2.2 (2026-06-04) |
| Last updated | 2026-07-08 |
| Source | https://github.com/sqlfluff/sqlfluff |
What sqlfluff is
SQLFluff parses SQL into an abstract syntax tree (AST) using a modular Python-based parser, with an optional Rust-backed parser for performance. It enforces 60+ linting rules across multiple SQL dialects, supports template preprocessing (Jinja, dbt, SQLAlchemy), and integrates with VS Code, CI/CD pipelines, and local development workflows via CLI.
Get the sqlfluff source
Clone the repository and explore it locally.
git clone https://github.com/sqlfluff/sqlfluff.gitcd sqlfluff# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Python 3.8+ (check your environment's Python version and dependency isolation strategy).
- Configuration via `.sqlfluff` file or inline comments allows granular rule tuning; plan for rule review and team alignment on style choices.
- Optional Rust parser (`sqlfluff[rs]`) requires Rust toolchain on build systems; falls back to pure Python if unavailable.
- Dialect choice must match your primary database(s); dialect mismatches cause parse failures. Plan multi-dialect projects carefully.
- Template preprocessing (Jinja, dbt) requires correct context/variable definitions; incomplete templates may produce lint false positives.
When to avoid it — and what to weigh
- Non-SQL Code Linting — SQLFluff lints SQL only. If you need to lint Python, JavaScript, or other languages alongside SQL, you'll need separate tools.
- Proprietary/Exotic SQL Dialects — While 25+ dialects are supported, niche or heavily customized SQL variants may not parse correctly. Requires manual dialect extension or contribution.
- Minimal Python Dependency Tolerance — SQLFluff adds Python runtime dependencies. Teams avoiding Python in deployment stacks should use the Docker image or evaluate the optional Rust parser.
- Real-Time SQL Validation at Scale — SQLFluff is designed for development and CI stages, not inline query validation for high-throughput applications. Performance on massive SQL files or streaming queries is not documented.
License & commercial use
SQLFluff is released under the MIT License, a permissive OSI-approved license that permits commercial and proprietary use with minimal restrictions. Attribution required; sublicense and modification permitted.
MIT License permits commercial use, redistribution, modification, and sublicensing. No copyleft obligations. Suitable for proprietary products and closed-source integrations. Review LICENSE file for exact terms; no additional commercial support or warranty clauses documented in provided data.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
SQLFluff parses untrusted SQL input. No security vulnerabilities or exploits are documented in provided data. Code runs locally in linting mode (read-only); does not connect to databases by default. Review dependency chain (Python packages) for supply-chain risks. Template preprocessing (Jinja, dbt) can execute code; validate template sources before processing.
Alternatives to consider
pgFormatter (PostgreSQL-focused)
Simpler, single-dialect alternative for PostgreSQL. Fewer rules but lighter weight; suitable if you only use PostgreSQL and don't need templating support.
TSQL Formatter (SQL Server-focused)
Specialized for T-SQL/SQL Server. Better for teams locked into the SQL Server ecosystem who don't need multi-dialect support.
Prettier for SQL (via prettier-plugin-sql)
Opinionated, zero-config formatter integrated with Prettier ecosystem. Trade-off: fewer rule customizations and less dialect flexibility than SQLFluff.
Build on sqlfluff with DEV.co software developers
SQLFluff helps enforce consistent SQL formatting and style automatically. Get started with a free installation and integrate into your CI/CD pipeline today.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
sqlfluff FAQ
Can SQLFluff auto-fix all issues it detects?
Does SQLFluff require a running database connection?
How do I handle multiple SQL dialects in one project?
Is the Python API stable for custom integrations?
Software developers & web developers for hire
DEV.co helps companies turn open-source tools like sqlfluff into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source databases stack.
Standardize SQL Code Quality Across Your Team
SQLFluff helps enforce consistent SQL formatting and style automatically. Get started with a free installation and integrate into your CI/CD pipeline today.