sqlfluff
The SQL Linter for Humans
What it is and what it does
SQLFluff is a dialect-flexible SQL linter designed to catch formatting, spacing, and style violations in SQL code. It works as a command-line tool that analyzes SQL files, reports issues with line and position information, and can automatically fix most violations. The tool is built to handle real-world SQL workflows, including templated SQL with Jinja and dbt projects.
It supports a wide range of SQL dialects—from ANSI SQL to vendor-specific variants like BigQuery, Snowflake, PostgreSQL, MySQL, and many others—making it useful across different database platforms and cloud data warehouses. The linter can be configured per project and integrates into development workflows via CLI, VS Code extension, or Docker, allowing teams to enforce consistent SQL style without manual review.
Use it for:
- Enforce consistent SQL formatting and style across a team's data pipeline or dbt project
- Automatically fix common SQL formatting issues like spacing and indentation in bulk
- Lint SQL code in CI/CD pipelines to catch style violations before deployment
- Validate SQL syntax and style for a specific database dialect (e.g., BigQuery, Snowflake)
- Integrate SQL quality checks into VS Code or other editors during development
- Standardize templated SQL with Jinja and dbt formatting in ELT applications
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
SQLFluff is a SQL linter and auto-fixer that checks SQL code for style and formatting issues across multiple SQL dialects, with support for Jinja templating and dbt.
Yes. SQLFluff is actively maintained, has no known vulnerabilities, installs with low friction, and carries a permissive MIT License. It fills a clear need for SQL code quality in modern data workflows. Install it if you work with SQL across multiple dialects, use dbt, or want to enforce team SQL style standards.
Install
sqlfluff on PyPI
pip
pip install sqlfluffuv
uv add sqlfluffpoetry
poetry add sqlfluffInstalling sqlfluff
Before you install
Low friction install with 12 lightweight runtime dependencies. Active maintenance with releases monthly; last release 7 days ago. Repository shows strong community engagement with 9853 stars.
License in practice
MIT License (permissive) allows commercial and private use with minimal restrictions; you must include the license notice and copyright statement.
Quickstart
pip install sqlfluff
echo "SELECT a FROM tbl;" > test.sql
sqlfluff lint test.sql --dialect ansi
sqlfluff fix test.sql --dialect ansi
Requires Python 3.10 or later. Optional Rust-backed parser available via extra install.
Verify before relying
- Completeness of dialect support coverage (documentation notes 'perhaps not in full')
- Performance characteristics on large SQL files or projects
- Integration maturity with dbt workflows beyond basic support
- Build requirements for optional Rust-backed parser on unsupported platforms
Package facts
| License | MIT License Copyright (c) 2018-2026 Alan Cruickshank Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 12 — platformdirs, chardet, click, colorama, diff-cover, Jinja2, pathspec, pyyaml, regex, tblib, tomli, tqdm |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 11,521,310/month — #1,387 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlfluff-4.3.0-py3-none-any.whl
Keywords: sqlfluff, sql, linter, formatter, athena, bigquery, clickhouse, databricks, db2, doris, duckdb, exasol, flink, greenplum, hive, impala, materialize, mariadb, mysql, postgres, redshift, snowflake, soql, sparksql, sqlite, starrocks, teradata, trino, tsql, vertica, dbt
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
collate-sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 15,000 on PyPI
shandy-sqlfmtA command-line SQL formatter that automatically…
permissive · top 5,000 on PyPI
sqlfluff-templater-dbtEnables SQLFluff to lint and auto-fix dbt…
permissive · top 5,000 on PyPI
sqlfluffrsSQLFluff-rs is a Rust-based optional component…
permissive · top 15,000 on PyPI
sqlglotSQLGlot parses, transpiles, optimizes, and…
permissive · top 1,000 on PyPI
sqlglotrsA SQL parser, transpiler, and optimizer that…
permissive · top 5,000 on PyPI
collate-sqllineageAnalyzes SQL statements to extract source and…
permissive · top 5,000 on PyPI
jinjasql2Generates parameterized SQL queries from Jinja2…
permissive · top 15,000 on PyPI
jinjasqlGenerates parameterized SQL queries from Jinja2…
permissive · top 15,000 on PyPI
sqlglotcProvides mypyc-compiled C extensions that…
permissive · top 5,000 on PyPI