Skip to content
A SQL Linter for Humans
Branch: master
Clone or download
Latest commit 97099ae Feb 18, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Deprecate py34 & py27 Jan 14, 2020
src/sqlfluff Add support for dbt macro var Feb 17, 2020
test Support any number of nesting in wildcards Feb 17, 2020
.gitignore add fix stdin handler Dec 15, 2019
requirements.txt Deprecate py34 & py27 Jan 14, 2020
tox.ini Testing upgrades Feb 11, 2020

SqlFluff 📜 ✒️

The SQL Linter for humans

PyPi Version PyPi License PyPi Python Verions PyPi Status PyPi Downloads

codecov Requirements Status CircleCI ReadTheDocs DeepSource

Bored of not having a good SQL linter that works with whichever dialiect 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.

Sqlfluff is still in an open alpha phase - expect the tool to change significantly over the coming months, and expect potentially non-backward compatable api changes to happen at any point. If you'd like to help please consider contributing.

  • 0.1.x involved a major re-write of the parser, completely changing the behaviour of the tool with respect to complex parsing.
  • 0.2.x added templating support and a big restructure of rules and changed how users might interact with sqlfluff on templated code.
  • 0.3.x drops support for python 2.7 and 3.4, and also reworks the handling of indentation linting in a potentially not backward compatable way.

Getting Started

To get started just install the package, make a sql file and then run sqlfluff and point it at the file.

$ pip install sqlfluff
$ echo "  SELECT a  +  b FROM tbl;  " > test.sql
$ sqlfluff lint test.sql
== [test.sql] FAIL
L:   1 | P:   1 | L003 | Single indentation uses a number of spaces not a multiple of 4
L:   1 | P:  14 | L006 | Operators should be surrounded by a single space unless at the start/end of a line
L:   1 | P:  27 | L001 | Unnecessary trailing whitespace


For more details on usage see the docs on readthedocs here.


There's lots to do in this project, and we're just getting started. If you want to understand more about the architecture of sqlfluff, you can find more here.

If you'd like to contribute, check out the open issues on github. You can also see the guide to contributing.

You can’t perform that action at this time.