Skip to content

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
4 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
Step-by-step guide: how to use SQLFluffInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python

    Install SQLFluff from PyPI

    pip install sqlfluff
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
sqlfluff (this)10kDev toolbeginner4 days agoData engineers maintaining dbt or ELT SQL projects
sqlc18.4kDev toolintermediate4 days agoGo developers who prefer writing plain SQL over using an ORM
duckdb42.7kLibrarybeginner4 days agoAnalysts who want to run SQL directly on CSV, Parquet, or JSON files
turso25.1kLibraryintermediate4 days agoDevelopers who want an embedded SQLite-compatible database in a Rust, JavaScript, Python, Java, Go, or .NET project
kysely14.3kLibraryintermediate4 days agoTypeScript developers who want SQL control without losing compile-time type checks
sqlalchemy12.3kLibraryintermediate4 days agoPython 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.