📜 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 format
and 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.
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
- SQL in the Wild
- Vision for SQLFluff
- Rolling out SQLFluff with a new team
- Let’s talk about whitespace
- Rules Reference
- Core Rules
- Specific Rules
Rule_AL01
Rule_AL02
Rule_AL03
Rule_AL04
Rule_AL05
Rule_AL06
Rule_AL07
Rule_AM01
Rule_AM02
Rule_AM03
Rule_AM04
Rule_AM05
Rule_AM06
Rule_AM07
Rule_CP01
Rule_CP02
Rule_CP03
Rule_CP04
Rule_CP05
Rule_CV01
Rule_CV02
Rule_CV03
Rule_CV04
Rule_CV05
Rule_CV06
Rule_CV07
Rule_CV08
Rule_CV09
Rule_CV10
Rule_CV11
Rule_JJ01
Rule_LT01
Rule_LT02
Rule_LT03
Rule_LT04
Rule_LT05
Rule_LT06
Rule_LT07
Rule_LT08
Rule_LT09
Rule_LT10
Rule_LT11
Rule_LT12
Rule_LT13
Rule_RF01
Rule_RF02
Rule_RF03
Rule_RF04
Rule_RF05
Rule_RF06
Rule_ST01
Rule_ST02
Rule_ST03
Rule_ST04
Rule_ST05
Rule_ST06
Rule_ST07
Rule_ST08
Rule_TQ01
- Inline Ignoring Errors
- Dialects Reference
- Production Usage
- Configuration
- CLI Reference
- API Reference
- Release Notes
- Internals
- Developing Rules
- Developing Plugins
- SQLFluff in the Wild
- SQLFluff Slack
- SQLFluff on Twitter