Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snowflake create view statement results in parse error #2000

Closed
Dikootje opened this issue Nov 29, 2021 · 1 comment · Fixed by #2217
Closed

Snowflake create view statement results in parse error #2000

Dikootje opened this issue Nov 29, 2021 · 1 comment · Fixed by #2217
Labels
bug Something isn't working good first issue Good for newcomers snowflake Issues related to the Snowflake dialect

Comments

@Dikootje
Copy link

Dikootje commented Nov 29, 2021

We define the column_list in all of our views and add comments to them. However when running sqlfluff with snowflake dialect we're getting a parse error.

https://docs.snowflake.com/en/sql-reference/sql/create-view.html -> search for column_list

Expected Behaviour

Parsing the SQL should be no issue

Observed Behaviour

Console output when running sqlfluff lint .\test.sql --dialect snowflake

== [test.sql] FAIL
L:   1 | P:   1 |  PRS | Line 1, Position 1: Found unparsable section: "create
                       | view dwh.vw_dummy \ncomment = 'The..."

When given this test.sql file:

create view dwh.vw_dummy
comment = 'The purpose of this view' -- this doesnt result in a parse error
( -- this section does result in a parse error
    column1             comment 'Specs for column1'
,   column2             comment 'Specs for column2'
)
as
select foo

Steps to Reproduce

Create test.sql with the contents above
run: sqlfluff lint .\test.sql --dialect snowflake

Dialect

Snowflake

Version

> sqlfluff.exe --version
sqlfluff, version 0.8.2
> py --version
Python 3.9.6

Configuration

Default configuration

@Dikootje Dikootje added the bug Something isn't working label Nov 29, 2021
@tunetheweb tunetheweb added snowflake Issues related to the Snowflake dialect good first issue Good for newcomers labels Dec 4, 2021
@Dikootje
Copy link
Author

I had a go at it myself. I'm not programmer by any means. But what I've found so far:

When running sqlfluff parse it seems create view statements are parsed using the create_view_statement from the ansi dialect instead of create_statement specified in the snowflake dialect. Is there anyway to test this by adding some @snowflake.delete decorator removing the type = "create_statement" within the snowflake dialect file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers snowflake Issues related to the Snowflake dialect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants