Skip to content

[L025][snowflake] rule removes alias used in join to table function #4150

@divvymax

Description

@divvymax

Search before asking

  • I searched the issues and found no similar issues.

What Happened

Rule L025 incorrectly removed an alias that was used in the argument to the FLATTEN table function call.

Expected Behaviour

I would expect rule L025 to recognize that the table alias is being used and leave it as is.

Observed Behaviour

Rule L025 removed a table alias that was in use.

How to reproduce

dbt % echo 'select * from table1 t, table(flatten(t.body)) as u' | sqlfluff fix -d snowflake -r L025 -
select * from table1, table(flatten(t.body))

Dialect

snowflake

Version

sqlfluff, version 1.4.1

Configuration

.sqlfluff

[sqlfluff]
templater = dbt
dialect = snowflake
# allow sqlfluff to run on a file of any size
large_file_skip_byte_limit = 0

[sqlfluff:templater:dbt]
project_dir = .
profiles_dir = ~/.dbt

[sqlfluff:rules]
tab_space_size = 4
max_line_length = 80
indent_unit = space
capitalisation_policy = lower

[sqlfluff:layout:type:comma]
line_position = leading

# Function names should be lower case
[sqlfluff:rules:L030]
extended_capitalisation_policy = lower

.sqlfluffignore

dbt_packages/
macros/
target/

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

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsnowflakeIssues related to the Snowflake dialect

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions