π The SQL Linter for HumansΒΆ
Bored of not having a good SQL linter that works with whichever dialect youβre working with? Fluff is an extensible and modular linter designed to help you write good SQL and catch errors and bad SQL before it hits your database.
Notable releases:
1.0.x: First stable release, no major changes to take advantage of a point of relative stability.
2.0.x: Recode of rules, whitespace fixing consolidation,
sqlfluff formatand removal of support for dbt versions pre 1.1. Note, that this release brings with it some breaking changes to rule coding and configuration, see Upgrading from 1.x to 2.0.3.0.x:
sqlfluff fixnow defaults to not asking for confirmation and the βforce option was removed. Richer information returned by thesqlfluff lintcommand (although in a different structure to previous versions). See Upgrading to 3.x.
For more detail on other releases, see our Release Notes.
Want to see where and how people are using SQLFluff in their projects? Head over to SQLFluff in the Wild for inspiration.
Getting StartedΒΆ
To get started just install the package, make a sql file and then run SQLFluff and point it at the file. For more details or if you donβt have python or pip already installed see Getting Started.
$ pip install sqlfluff
$ echo " SELECT a + b FROM tbl; " > test.sql
$ sqlfluff lint test.sql --dialect ansi
== [test.sql] FAIL
L: 1 | P: 1 | LT01 | Expected only single space before 'SELECT' keyword.
| Found ' '. [layout.spacing]
L: 1 | P: 1 | LT02 | First line should not be indented.
| [layout.indent]
L: 1 | P: 1 | LT13 | Files must not begin with newlines or whitespace.
| [layout.start_of_file]
L: 1 | P: 11 | LT01 | Expected only single space before binary operator '+'.
| Found ' '. [layout.spacing]
L: 1 | P: 14 | LT01 | Expected only single space before naked identifier.
| Found ' '. [layout.spacing]
L: 1 | P: 27 | LT01 | Unnecessary trailing whitespace at end of file.
| [layout.spacing]
L: 1 | P: 27 | LT12 | Files must end with a single trailing newline.
| [layout.end_of_file]
All Finished π π!
ContentsΒΆ
Documentation for SQLFluff:
- Getting Started
- Why SQLFluff?
- Guides & How-tos
- Configuration
- Production Usage & Security
- Reference
- Dialects Reference
- ANSI
- AWS Athena
- Google BigQuery
- ClickHouse
- Databricks
- IBM Db2
- Apache Doris
- DuckDB
- Exasol
- Apache Flink SQL
- Greenplum
- Apache Hive
- Apache Impala
- MariaDB
- Materialize
- MySQL
- Oracle
- PostgreSQL
- AWS Redshift
- Snowflake
- Salesforce Object Query Language (SOQL)
- Apache Spark SQL
- SQLite
- StarRocks
- Teradata
- Trino
- Microsoft T-SQL
- Vertica
- Rules Reference
- CLI Reference
- Python API
- Internal API
- Release Notes
- Dialects Reference
- SQLFluff in the Wild
- SQLFluff Slack
- SQLFluff on Twitter