sqlfluff / sqlfluff

A modular SQL linter and auto-formatter with support for multiple dialects and templated code.
https://www.sqlfluff.com
MIT License
7.31k stars 648 forks source link

Snowflake ASOF JOIN compatibility with SQL Format #5885

Open mattxxi opened 2 weeks ago

mattxxi commented 2 weeks ago

Search before asking

What Happened

Incompability with shandy-sqlfmt 0.21.3

Here is an example of a join: select * from table1 as tb1 asof join table2 as tb2 match_condition(t1>t2) on pk1 = pk2

After match_condition( sqlfluff create a space between match_condition and the parenthesis but sqlfmt wants to remove it. So far to make it work I had to had: -- sqlfluff:layout:type:start_bracket:spacing_before:any

Expected Behaviour

Should not add a space after match_condition

Observed Behaviour

match_condition( --> vcc match_condition (

How to reproduce

Juste create a query such as: select * from table1 as tb1 asof join table2 as tb2 match_condition(t1>t2) on pk1 = pk2

Dialect

snowflake

Version

3.0.6

Configuration

[tool.sqlfluff.core] dialect = "snowflake" templater = "dbt" exclude_rules = "layout.indent, layout.cte_bracket, layout.select_targets, aliasing.expression, references.keywords, layout.cte_newline, structure.column_order, convention.casting_style" max_line_length = 121 large_file_skip_byte_limit = 0

[tool.sqlfluff.rules] capitalisation_policy = "lower" extended_capitalisation_policy = "lower"

[tool.sqlfluff.rules.convention.terminator] multiline_newline = true

Ignore: target dbt_packages

Are you willing to work on and submit a PR to address the issue?

Code of Conduct