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: Split out CREATE VIEW
into its own segment
#2217
Conversation
* Removed `VIEW` from the general `CreateStatement` in Snowflake. * Added test cases to support most of the CREATE VIEW functionality * Added a note w.r.t the complexity involved in column-level masking policy & tagging config.
@tunetheweb @Dikootje - Wanted to get how you guys feel about this change.
|
4a91620
to
ca9d383
Compare
…to `snowflake_create_view`
Codecov Report
@@ Coverage Diff @@
## main #2217 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 149 149
Lines 10825 10829 +4
=========================================
+ Hits 10825 10829 +4
Continue to review full report at Codecov.
|
I agree that it's a good to split into it's own segment, it better aligns with the docs and is easier to check/maintain. I imagine all the CREATE statements were originally combined to quickly get the basic statements parsing but as we develop them more we can split them out properly 👍 |
e209362
to
c4f0050
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wong-codaio looks great, thanks! LGTM 🚀 ⭐
Thanks guys! |
Brief summary of the change made
Snowflake dialect only: Create a segment specifically for Snowflake's
CREATE VIEW
statement.VIEW
from the generalCreateStatement
in Snowflake.fixes #2000
Context
CreateStatementSegment
in Snowflake that aims to encapsulate all possibilities ofCREATE
statement in Snowflake. The statement however does not account for the specific needs that is targeted only forCREATE VIEW
statement.CreateStatement
segment, it seems it's more appropriate to create a separate class forCreateViewStatementSegment
- Which makes Snowflake more aligns whatdialect_ansi
does (Ansi also has a dedicatedCreateViewStatementSegment
.Are there any other side effects of this change that we should be aware of?
CREATE VIEW
segment type has been changed - fromcreate_statement
tocreate_view_statement
in Snowflake dialect.CREATE VIEW
in Snowflake's dialect, and is usingcreate_statement
as a check in their matching logic, then it'll no longer work.Pull Request checklist
.sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).snowflake_create_view.sql
file.