sqlfluff
📜 The SQL Linter for humans.

PyPI - Downloads PyPI GitHub GitHub Repo stars

SQLFluff is a dialect-flexible and configurable SQL linter. Designed with ELT applications in mind, SQLFluff also works with Jinja templating and dbt. SQLFluff will auto-fix most linting errors, allowing you to focus your time on what matters.


SELECT
    this_column,
    my_table.THAT_COLUMN AS this_name,
  some_number *10 AS a_bigger_number
from my_table
$ sqlfluff lint test.sql --dialect ansi
== [test.sql] FAIL
L:   2 | P:   5 | RF03 | Unqualified reference 'this_column' found in single
                       | table select. [references.consistent]
L:   3 | P:   5 | RF03 | Qualified reference 'my_table.THAT_COLUMN' found in
                       | single table select which is inconsistent with previous
                       | references. [references.consistent]
L:   3 | P:  14 | CP02 | Unquoted identifiers must be consistently lower case.
                       | [capitalisation.identifiers]
L:   4 | P:   1 | LT02 | Expected indent of 4 spaces.
                       | [layout.indent]
L:   4 | P:   3 | RF03 | Unqualified reference 'some_number' found in single
                       | table select. [references.consistent]
L:   4 | P:  16 | LT01 | Expected single whitespace between binary operator '*'
                       | and numeric literal. [layout.spacing]
L:   5 | P:   1 | CP01 | Keywords must be consistently upper case.
                       | [capitalisation.keywords]