Highlights
This release brings a few more significant changes. Especially given the introduction of several new rules, we highly recommend testing this release on your project before upgrading to make sure they are configured appropriately for your project style guide. As always, we have tried to make sure that the defaults for all new rules are both widely applicable, and fairly light touch. While all have been tested on some existing larger codebases which the maintainers have access to – do still report any bugs you might find on GitHub in the usual manner.
- We’ve dropped the
appdirs
package as a dependency (as an abandoned project) and instead addedplatformdirs
instead. Users should not notice any functionality changes beyond the different dependency. - TWO new dialects: Impala and StarRocks.
- FIVE new rules:
AM08
(ambiguous.join_condition
), which detectsJOIN
clauses without conditions (i.e. without anON
orUSING
clause). These are often typos and can result in significant row count increases if unintended.CV12
(convention.join_condition
), which is related toAM08
and detects cases where users have used aWHERE
clause instead of aJOIN ... ON ...
clause to do their join conditions. The join condition is a form of metadata and should communicate to the end user how the table should be joined. By mixing this information into theWHERE
clause it makes the SQL harder to understand.LT14
(layout.keyword_newline
), which allows certain keywords to trigger line breaks in queries. Primarily this forces the mainSELECT
statement clauses likeWHERE
,GROUP BY
etc. onto new lines. This rule has been designed to be highly configurable, but with sensible light-touch defaults. Check out the docs to adapt it to the conventions of your project.ST10
(structure.constant_expression
), some SQL users include redundant expressions in their code (e.g.WHERE tbl.col = tbl.col
). These conditions always evaluate to a constant outcome (i.e. always evaluate asTRUE
orFALSE
) as so add no functionality or meaning to the query. This rule catches them.ST11
(structure.unused_join
), which detects unused joins in SQL statements, and is designed to catch tables that were once used, but where the column references have since been removed and now the table is unnecessary.
Beyond these changes, we’ve seen a whole host of dialect improvements to almost all of the supported dialects and several bugfixes which are combined into this release.
We also welcome TWELVE new contributors to the project in this release. Thanks to all of them for their hard work 🚀🏆🚀.
What’s Changed
- New Rule LT14: Keyword line positioning (#6213) @keraion
- New Rule ST11: Detect unused tables in join (#5266) @danparizher
- Snowflake Create Table allow inline foreign key with on delete … (#6486) @WobblyRobbly
- Fix minor linting error in CI (#6483) @alanmcruickshank
- Snowflake: alter table on delete and update support (#6473) @WobblyRobbly
- New Rules AM08 + CV12: Detect implicit cross joins (#6239) @rogalski
- New Rule ST10: const expression checker (#6392) @rogalski
- DuckDB: Support MAP data type (#6478) @WittierDinosaur
- Hive: Add ‘ALTER VIEW’ query grammar (#6479) @mrebaker
- Standardise json operator spacing between dialects (#6447) @WittierDinosaur
- fixes #6463: Set Variable Parsing for SparkSQL and Databricks (#6464) @fstg1992
- Teradata: support REPLACE VIEW and LOCKING … FOR … syntax (#6467) @V-D-L-P
- Rule names in warnings logic (#6459) @LuigiCerone
- Bigquery: Support column level key definitions (#6465) @keraion
- Add Implicit Indents to Qualify (#6438) @WittierDinosaur
- Postgres: Fix Select statement ordering (#6446) @WittierDinosaur
- fixes #6457: databricks dialect alter table foo drop column bar (#6461) @fstg1992
- Switch from
appdirs
toplatformdirs
(#6399) @alanmcruickshank - Impala: support CREATE TABLE AS SELECT (#6458) @mrebaker
- Databricks Dialect: Backticked function identifiers now parsable (#6453) @fstg1992
- Issue #6417: Leading — MAGIC Cells don’t break parsing of notebooks (#6454) @fstg1992
- Add “target_path” configuration to the dbt templater (#6423) @wircho
- Sparksql: Fix ordering of create table options (#6441) @WittierDinosaur
- Dialect: Impala (#6445) @mrebaker
- RF02: Allows for lambda functions in Databricks (#6444) @keraion
- SQLite: Support any order of VARYING/NATIVE in CHAR types (#6443) @keraion
- Snowflake: Allow literals in match_by_column_name (#6442) @WittierDinosaur
- Trino: Remove TemporaryTransientGrammar (#6440) @WittierDinosaur
- Mysql: Fix parsing of system variables (#6439) @WittierDinosaur
- Sparksql: Fix hint function for proper spacing (#6437) @WittierDinosaur
- Snowflake: Support ORDER BY boolean (#6435) @WittierDinosaur
- TSQL: allow
NEXT VALUE FOR
use as expression (#6431) @timz-st - Prework for introducing mypyc (#6433) @rogalski
- Fix pre-commit on main branch (#6432) @rogalski
- Initial support for Starrocks dialect (#6415) @maver1ck
- Databricks: Parse Table Valued Functions (#6417) @fstg1992
- Snowflake: Support
PARTITION_TYPE
forCREATE EXTERNAL TABLE
(#6422) @ninazacharia-toast - Fix docs for CP04 config and add test cases (#6416) @alanmcruickshank
- Fix: Parse violations not being shown when run
fix
command with--show-lint-violations
(#6382) @joaopamaral - RF01: refine support for dialects with dot access syntax (#6400) @rogalski
- Add new
TYPE
property to Snowflake users (#6411) @mroy-seedbox - Document the config API (#6384) @alanmcruickshank
- Error handling for trying to render callable builtins #5463 (#6388) @alanmcruickshank
- SQLite : Add
CREATE VIRTUAL TABLE
Statement (#6406) @R3gardless - Updated README with Table Of Contents (#6407) @27Jashshah
Source: https://github.com/sqlfluff/sqlfluff/releases/tag/3.3.0