NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #1178 most downloaded on PyPI
The SQL Linter for Humans
Latest stable
4.5.0
Last release 22 days ago
30 Oct 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
159 releases · first in 2018
Drag across the ruler to compare, or tap a release to open it.
This release includes a couple of breaking changes to configuration and API methods. Specifically:
This release includes a couple of breaking changes to configuration and API methods. Specifically:
sqlfluff.rules() to sqlfluff.list_rules() and sqlfluff.dialects() to sqlfluff.list_dialects() due to naming conflicts with the now separate sqlfluff.dialects module.capitalisation_policy to extended_capitalisation_policy for L014 to reflect the fact that it now accepts more options (pascal) than regular capitalisation_policy still used by L010 and others.only_aliases config with unquoted_identifiers_policy and added it to rule L014 in addition to L029.pascal (PascalCase) capitalisation_policy option for L014 (unquoted identifiers)only_aliases configuration option for L014 (unquoted identifers)get_segment and get_grammar can be used on unexpanded grammars to access elements of the parent grammars. The copy method on grammars can be used to copy with alterations.sqlfluff.core module so that each dialect is better isolated from each other. This also allows more focused testing and the potential for dialect plugins in future. Dialects are now only imported as needed at runtime. All dialects should now be accessed using the selector methods in sqlfluff.core.dialects rather than importing from sqlfluff.dialects directly.ALTER USER commands in Snowflake dialect.FROM clauses to better represent nested joins and table functions.Your coding agent can read these notes before it upgrades. Set up the MCP server →
This is a minor release with parsing coverage improvements, introduction of custom rule configuration, and more API methods.
This is a minor release with parsing coverage improvements, introduction of custom rule configuration, and more API methods.
sqlfluff:templater:jinja:load_macros_from_path.NULL keywords, so parse as Literals where
appropriate.This is a huge major release, which wouldn't have been possible without a massive number of contributors. 🎉 🎉. In particular thanks to everyone who te
This is a huge major release, which wouldn't have been possible without a massive number of contributors. 🎉 🎉. In particular thanks to everyone who tested the alpha versions of this release in the wild.
Major new functionality includes:
import sqlfluff and use the main functionality within other python projects. See examples for more details.dbt templating engine which can use the compiler from dbt directly all allow access to all of the macros within a project.Alongside these big changes, there are a whole host of parser improvements for all dialects and a set of new linting rules and configuration options.
For full details of the changes, check out the changelog.
sqlfluff as a python module
and call parse, lint and fix within their own projects. See
the docs for more
information. (#501)dbt as a templating engine directly allowing
richer and more accurate linting around dbt macros (and packages
related to dbt). For more info see the docs. (#508)%) operator. (#447).is_type() method on segments to more intelligently
deal with type matching in rules when inheritance is at play.Linter directly using user_rules.{{ variables }}, {# comments #} and
{% loops %} (in jinja) now have placeholders in the parsed
structure. Rule L003 (indentation), also now respects these
placeholders so that their indentation is linted accordingly.
For loop or block tags, they also generate an Indent and
Dedent tag accordingly (which can be enabled or disabled)
with a configuration value so that indentation around these
functions can be linted accordingly. (#541)-- sqlfluff:. (#541)--noqa: use in rules. (#552)pre-commit hooks for lint and fix. (#576)FROM/JOIN clauses" from the dbt coding conventions. (#473, #479)USING" from the dbt coding conventions. (#487)UNION ALL to UNION *" from the dbt coding conventions. (#489)dbt coding conventions. (#495)black coding style. (#485)EPOCH keyword for postgres dialect. (#522)USE statement to the snowflake dialect. (#537)CODE_OF_CONDUCT to the project. (#471)ISNULL and NOTNULL keywords to ansi dialect. (#441)requirements_dev.txt for local testing/linting. (#500)--disregard-sqlfluffignores to allow direct linting of files in the .sqlfluffignore. (#486)dbt incremental macro. (#363)CREATE FUNCTION syntax for postgres and for bigquery. (#325)CREATE INDEX and DROP INDEX for mysql. (#740)IGNORE NULLS, RESPECT NULLS, GENERATE_DATE_ARRAY and
GENERATE_TIMESTAMP_ARRAY for bigquery. (
#667,
#527)CREATE and CREATE ... CLONE for snowflake. (#539)Linter is now decoupled from
logging so that it can be imported directly by subprojects without
needing to worry about weird output or without the log handing getting
in the way of your project. (#460)* and a.b.* expressions to have their
own expressions. Any dependencies on this structure downstream
will be broken. This also fixes the linting of both kinds of expressions
with regard to L013 and L025. (#454)EphemeralSegment to aid with parsing efficiency
without altering the end structure of the query. (#491)ObjectReference into ColumnReference and TableReference
for more useful API access to the underlying structure. (#504)KeywordSegment and the new SymbolSegment both now inherit
from _ProtoKeywordSegment which allows symbols to match in a very
similar way to keywords without later appearing with the type of
keyword. (#504)Parser class to parse a lexed query rather than
relying on users to instantiate a FileSegment directly. As a result
the FileSegment has been moved from the core parser directly into
the dialects. Users can refer to it via the get_root_segment()
method of a dialect. (#510)yml files. (#553)ESCAPE parsing in LIKE clause. (#566)BETWEEN statements. (#498)EXCEPT clause parsing. (#472)README. (#457).sqlfluff. (#452)capitalisation_policy = lower. (#477)logging warnings red. (#497)Bracketed segment now obtains its brackets directly from the dialect
using a set named bracket_pairs. This now enables better configuration
of brackets between dialects. (#325)--no-safety option has been removed, the default
is now that all enabled rules will be fixed. (#583)BaseSegment.grammar, BaseSegment._match_grammar() and
BaseSegment._parse_grammar() instead preferring references directly
to BaseSegment.match_grammar and BaseSegment.parse_grammar. (#509)EmptySegmentGrammar and replaced with better non-code handling
in the FileSegment itself. (#509)ContainsOnly grammar as it remained only as an anti-pattern. (#509)expected_string() functionality from grammars and segments (#509)
as it was poorly supported.BaseSegment.as_optional() as now this functionality happens
mostly in grammars (including Ref). (#509)ColumnExpressionSegment in favour of ColumnReference. (#512)LambdaSegment feature, instead replacing with an internal
to the grammar module called NonCodeMatcher. (#512)difflib or cdifflib, by relying on source mapping
instead to apply fixes. (#541)Add fix for Rule L004 (mixed tabs and spaces
typing_extensionsThis release partly a test of the automatic pypi publication action but also contains various bugfixes + improvements in preparation for the 0.4.0 rel
This release partly a test of the automatic pypi publication action but also contains various bugfixes + improvements in preparation for the 0.4.0 release.
Nothing published for this version
No big things in the release, but loads of smaller bugfixes and quality of life fixes. Once again, thanks to so many people who've contributed to this
No big things in the release, but loads of smaller bugfixes and quality of life fixes. Once again, thanks to so many people who've contributed to this release: @dmateusp, @sethwoodworth, @pwildenhain & @NiallRees.
sqlfluff dialects command to get a readout of available dialects [+ associated docs].IGNORE/RESPECT NULLS.current_timestamp and similar functions. Thanks @dmateusp.QUALIFY clause.*. Thanks @dmateusp.SUBSTRING.REPLACE and EXCEPT clauses.NOTNULL and ISNULL.WITH statements now parse.fix command.After a short break we're back. Great to see so many new contributors this time. Thanks do much for all your contributions!
After a short break we're back. Great to see so many new contributors this time. Thanks do much for all your contributions!
GROUP BY. Thanks @flpezet.SelectableGrammar and some related segments to make it
easier to refer to select-like things in other grammars.CASE statement parsing. Thanks @azhard.SAMPLE implementation. Thanks @rkm3.Implementation of the bigquery CREATE MODEL syntax. Thanks @barrywhart.
CREATE MODEL syntax. Thanks @barrywhart.ORDER BY x NULLS FIRST|LASTFOR keyword in bigquery SYSTEM_TIME syntax.A small release aimed primarily at changes to make it easier to roll sqlfluff out to new projects:
A small release aimed primarily at changes to make it easier to roll sqlfluff out to new projects:
Importantly:
--nofail option to parse and lint commands to assist rollout.--version option to complement the version option already available on the cli.--nofail option to parse and lint commands to assist
rollout.--version option to complement the version option already
available on the cli.ALTER TABLE.Nothing published for this version
Nothing published for this version
This is a big release, no breaking changes externally, but a lot of internal changes. Highlights include:
This is a big release, no breaking changes externally, but a lot of internal changes. Highlights include:
Lots of people have helped make this release what it is. Big thanks to @Katzmann1983, @azhard, @barrywhart.
parse command, added the --profiler and --bench options
to help debugging performance issues.do command in the jinja templater.||).my_db..my_table.INTERVAL '4 days' style interval expression.JOIN clauses..sqlfluffignore file to ignore certain paths.set
interfaces for managing and creating keywords and the Ref.keyword() method
to refer to them, and the ability to refer directly to keyword names in
most grammars using strings directly. Includes SegmentGenerator objects
to bind dialect objects at runtime from sets. Thanks @Katzmann1983!L029 for using unreserved keywords as variable names._path in the config files.DISTINCT ON () syntax for the postgres dialect.Bracketed grammar has been changed to treat its
content as a Sequence rather than a OneOf.SandboxedEnvironment rather than Environment for jinja
templating for security.Support for a.b.* on top of a.* in select target expressions.
a.b.* on top of a.* in select target expressions.This major release drops support for python 2.7 and python 3.4
This major release drops support for python 2.7 and python 3.4
Highlights:
diff-cover.Contibutors:
For full details, see the changelog.
SELECT keyword is parsed within a select statement,
so that it belongs as part of the newly renamed select_clause (renamed
from previously select_target_group).type and name properties of the BaseSegment
class and its children. name should be specific to a particular kind
of segment, and type should express a wider group. Handling of the
newline, whitespace and comma segments has been updated so that
we use the type property for most use cases rather than name.Indent and Dedent segments
used for indicating the position of theoretical indents in the structure.
Several helper functions have been added across the codebase to handle
this increase in the kinds of segments which might be encountered by
various grammars.fix phase of this
rule, there is enough logic to try and reconstruct a sensible place for
line breaks as re-flow the query. This will likely need further work
and may still encounter places where it doesn't fix all errors but should
be able to deal with the majority of simple cases.COMMIT, DROP, GRANT, REVOKE
and ROLLBACK. Thanks @barrywhart.--format option to the parse command that allows a yaml output. This
is mostly to make test writing easier in the development process but
might also be useful for other things.UNION.diff-cover tool. Thanks @barrywhart.fix command while using stdin. Thanks @nolanbconaway.DISTINCT. Thanks @barrywhart.source macro from dbt. Thanks @DandandanL017 to catch this.ignore parameter on linting and fixing commands to ignore
particular kinds of violations.A --code-only option to the parse command to spit out a more simplified output with only the code elements.
--code-only option to the parse command to spit out a more
simplified output with only the code elements.LintingResult.setup.py install_requires section.IN/NOT IN and IS/IS NOT.Bugfix, default config not included.
Tweek rule L005 to report more sensibly with newlines.
This is the first *Alpha* release of sqlfluff. Thanks especially to @mrshu @barrywhart & @nolanbconaway who have helped get the tool to this stage.
This is the first Alpha release of sqlfluff. Thanks especially to @mrshu @barrywhart & @nolanbconaway who have helped get the tool to this stage.
Version 0.2.1 mainly brings templating ability to sqlfluff. For a full treatment of why that's a great thing, check out one of the pages in the new docs, about how sql is used in the real world analytics stack. The short version of what's new in this release is:
format(). The fix command also works sensitively around templated sections so as not to destroy the templating.Templating support (jinja2, python or raw).
fix command is also sensitive to fixing over templates
and will skip certain fixes if it feels that it's conflicted.:: operator.GROUP BYand LIMIT.ORDER BY using indexes and expressions.CASE statements.RuleSet class which now
holds the filtering code.with clause.Bracketed grammar to optionally match empty brackets using
the optional keyword.Moved some of the responsibility for formatted logging into the linter to mean that we can log progressively in large directories.
Lots of changes since the first release of 0.1.*. The grammar is starting to look sensible and we have mostly parity with the original sqlfluff from 0
Lots of changes since the first release of 0.1.. The grammar is starting to look sensible and we have mostly parity with the original sqlfluff from 0.0..
--exclude-rules argument to most of the commands to allow rule users
to exclude specific subset of rules, by @sumitkumar1209!=, ~ and ::.LambdaSegment which allows matching based on arbitrary
functions which can be applied to segments.Anything grammar, useful in matching rather than in parsing to match anything.BaseGrammar class to support common matching features across multiple grammars.
In particular this affects the Delimited grammar which is now much simpler but does
also require slightly more liberal use of terminators to match effectively.ParseContext object which contains things like the dialect and various depths. This
simplifies the parsing and matching code significantly.Bracketed grammar, which still implements it directly). This
takes out some originally duplicated code.ORDER BY clause.bracket_sensitive_forward_match method from the BaseGrammar. It was ugly
and not flexible enough. It's been replaced by a suite of methods as described above.Tweak to the L001 rule so that it doesn't crash the whole thing.
Fixed the errors raised by the lexer.
Fixed which modules from sqlfluff are installed in the setup.py. This affects the version command.
version command.BIG rewrite of the parser, completely new architecture. This introduces breaking changes and some loss of functionality while we catch up.
Delimited matcher has had a significant re-write with a major
speedup and broken the dependency on Sequence.StartsWith and Sequence to use partial matches properly.Bracketed and Delimited respect bracket counting.Bracketed.verbosity_logger method.sqlfluff parse option which runs just the parsing step
of the process to better understand how a file is being parsed. This also
has options to configure how deep we recurse.crawlers which
implement the linting rules. Now with inbuilt fixers in them.Nothing published for this version
This release brings the sqlfluff fix command which allows basic autocorrection of simple linting errors. For now only the L001 rule (trailing whitespa
This release brings the sqlfluff fix command which allows basic autocorrection of simple linting errors. For now only the L001 rule (trailing whitespace) has a correction rule implemented but the user interface is functional.
sqlfluff fix as a command to implement auto-fixing of linting
errors. For now only L001 is implemented as a rule that can fix things.rules command to introspect the available rules.testwrap library and also
deal a lot better with longer values.--rules argument to most of the commands to allow rule users
to focus their search on a specific subset of rules.This release has functional linting including comments, whitespace and operators.
This release has functional linting including comments, whitespace and operators.
(*))Much better documentation including the DOCS.md
Added a priority for matchers to resolve some ambiguity
Refactor of rules to allow rules with memory
Only very few linting rules included at this stage, but enough to try the tool in use a few times.
Only very few linting rules included at this stage, but enough to try the tool in use a few times.
Restructure into package layout
One column per quarter.