DEV.co
Open-Source Databases · sqlfluff

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.

Source: GitHub — github.com/sqlfluff/sqlfluff
9.8k
GitHub stars
1k
Forks
Python
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorysqlfluff/sqlfluff
Ownersqlfluff
Primary languagePython
LicenseMIT — OSI-approved
Stars9.8k
Forks1k
Open issues361
Latest release4.2.2 (2026-06-04)
Last updated2026-07-08
Sourcehttps://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.

Quickstart

Get the sqlfluff source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/sqlfluff/sqlfluff.gitcd sqlfluff# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

dbt/ELT Workflow Standardization

Enforce consistent SQL style across dbt projects with Jinja templating support. Auto-fix formatting issues in pull requests before code review, reducing review overhead and improving consistency.

Multi-Dialect SQL Codebase Management

Organizations using multiple databases (Snowflake, BigQuery, PostgreSQL, etc.) can enforce a single linting rule set across all dialects, ensuring portability and reducing dialect-specific bugs.

CI/CD SQL Quality Gates

Integrate SQLFluff into build pipelines to block commits with formatting or structural SQL issues. Use auto-fix in development and strict validation in production branches.

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.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

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.

Software development agency

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.co

Related 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?
Most linting errors can be auto-fixed (whitespace, indentation, trailing commas). Some complex rule violations may require manual fixes. Use `sqlfluff fix` to apply auto-fixes.
Does SQLFluff require a running database connection?
No. SQLFluff lints and parses SQL syntactically without connecting to any database. It works entirely offline.
How do I handle multiple SQL dialects in one project?
Specify dialect per file or directory using `.sqlfluff` config or CLI flags (`--dialect`). For mixed projects, use separate config files or directory-level overrides.
Is the Python API stable for custom integrations?
No. Documentation notes the Python API is less stable and may change more often than the CLI. Pin versions carefully if building on the API.

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.