Skip to content

Commit

Permalink
* Updated per feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wong-codaio committed Jan 1, 2022
1 parent 6c3f633 commit c4f0050
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
20 changes: 9 additions & 11 deletions src/sqlfluff/dialects/dialect_snowflake.py
Expand Up @@ -1773,7 +1773,6 @@ class CreateStatementSegment(BaseSegment):
Sequence("SECURITY", "INTEGRATION"),
Sequence("STORAGE", "INTEGRATION"),
Sequence("MATERIALIZED", "VIEW"),
Sequence("SECURE", "VIEW"),
Sequence("MASKING", "POLICY"),
"PIPE",
Sequence("EXTERNAL", "FUNCTION"),
Expand Down Expand Up @@ -1859,32 +1858,31 @@ class CreateViewStatementSegment(BaseSegment):
),
"VIEW",
Ref("IfNotExistsGrammar", optional=True),
Ref("ObjectReferenceSegment"),
Ref("TableReferenceSegment"),
AnyNumberOf(
Sequence(
Bracketed(
Delimited(
Sequence(
Ref("ObjectReferenceSegment"),
Ref("CommentClauseSegment", optional=True),
),
Bracketed(
Delimited(
Sequence(
Ref("ColumnReferenceSegment"),
Ref("CommentClauseSegment", optional=True),
),
),
),
Sequence(
Sequence("WITH", optional=True),
Ref.keyword("WITH", optional=True),
"ROW",
"ACCESS",
"POLICY",
Ref("NakedIdentifierSegment"),
"ON",
Bracketed(
Delimited(Ref("NakedIdentifierSegment")),
Delimited(Ref("ColumnReferenceSegment")),
),
),
Ref("TagBracketedEqualsSegment"),
Sequence("COPY", "GRANTS"),
Ref("CreateStatementCommentSegment"),
# @TODO: Support column-level masking policy & tagging.
),
"AS",
Ref("SelectableGrammar"),
Expand Down
28 changes: 14 additions & 14 deletions test/fixtures/dialects/snowflake/snowflake_create_view.yml
Expand Up @@ -3,13 +3,13 @@
# computed by SQLFluff when running the tests. Please run
# `python test/generate_parse_fixture_yml.py` to generate them after adding or
# altering SQL files.
_hash: 73fbb8d0dea33f92165cd57d941e3506e38007cd219e01759ebd6c68571014df
_hash: 0c8e990e5fa6b6ccc0b37d6c23ec1415c777feb35988a5c4884f78be69899aa9
file:
- statement:
create_view_statement:
- keyword: create
- keyword: view
- object_reference:
- table_reference:
identifier: another_view
- snowflake_comment:
keyword: comment
Expand Down Expand Up @@ -38,7 +38,7 @@ file:
create_view_statement:
- keyword: CREATE
- keyword: VIEW
- object_reference:
- table_reference:
identifier: basic_view
- keyword: AS
- select_statement:
Expand All @@ -63,7 +63,7 @@ file:
create_view_statement:
- keyword: CREATE
- keyword: VIEW
- object_reference:
- table_reference:
identifier: view_with_comments
- snowflake_comment:
keyword: COMMENT
Expand Down Expand Up @@ -94,7 +94,7 @@ file:
- binary_operator: OR
- keyword: REPLACE
- keyword: VIEW
- object_reference:
- table_reference:
identifier: view_with_replace_and_comment
- snowflake_comment:
keyword: COMMENT
Expand Down Expand Up @@ -130,7 +130,7 @@ file:
- keyword: IF
- keyword: NOT
- keyword: EXISTS
- object_reference:
- table_reference:
identifier: secure_recursive_view_with_comment
- snowflake_comment:
keyword: COMMENT
Expand Down Expand Up @@ -161,7 +161,7 @@ file:
- binary_operator: OR
- keyword: REPLACE
- keyword: VIEW
- object_reference:
- table_reference:
identifier: view_with_comment_and_copy_grants
- snowflake_comment:
keyword: COMMENT
Expand Down Expand Up @@ -194,7 +194,7 @@ file:
- binary_operator: OR
- keyword: REPLACE
- keyword: VIEW
- object_reference:
- table_reference:
identifier: view_with_tags_and_copy_grants
- tag_bracketed_equals:
- keyword: WITH
Expand Down Expand Up @@ -236,14 +236,14 @@ file:
- binary_operator: OR
- keyword: REPLACE
- keyword: VIEW
- object_reference:
- table_reference:
identifier: view_with_column_comment
- bracketed:
- start_bracket: (
- object_reference:
- column_reference:
identifier: col1
- comma: ','
- object_reference:
- column_reference:
identifier: col2
- comment_clause:
keyword: COMMENT
Expand Down Expand Up @@ -279,18 +279,18 @@ file:
- keyword: IF
- keyword: NOT
- keyword: EXISTS
- object_reference:
- table_reference:
identifier: view_with_all_implemented_features
- snowflake_comment:
keyword: COMMENT
comparison_operator: '='
literal: "'table-level comment'"
- bracketed:
- start_bracket: (
- object_reference:
- column_reference:
identifier: col1
- comma: ','
- object_reference:
- column_reference:
identifier: col2
- comment_clause:
keyword: COMMENT
Expand Down

0 comments on commit c4f0050

Please sign in to comment.