Skip to content

Support for union by name in snowflake #6992

@yitzisnow

Description

@yitzisnow

Search before asking

  • I searched the issues and found no similar issues.

What Happened

Trying to use "union [all] by name" in a query for snowflake fails

Expected Behaviour

This behavior is supported by snowflake and so it should succeed without linting errors.

I know support for this syntax was recently added but apparently not for snowflake

Observed Behaviour

Trying to use "union by name" or "union all by name" results in the entire section of the query being unparseable

How to reproduce

select
    a,
    b
from table1
union by name
select
    b, 
    a
from table2

This, for me, returns the error:

L:   5 | P:   1 |  PRS | Line 5, Position 1: Found unparsable section: 'union by
                       | name\nselect\n    b, \n    a\nfrom ...'

Dialect

snowflake

Version

sqlfluff, version 3.4.1

Python 3.12.3

Configuration

In pyproject.toml:

[tool.sqlfluff.core]
dialect = "snowflake"
templater = "jinja"
max_line_length = 120

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions