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
Make Snowflake keywords unreserved: account, organization, pivot #2172
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fda7d34
Make Snowflake keywords unreserved: account, organization, pivot
jpy-git 4b7217b
Forgot yaml
jpy-git 6b84539
Add JoinLikeClauseGrammar to ObjectReferenceSegment terminator
jpy-git 1f8106c
Merge branch 'main' into move_snowflake_keywords
jpy-git 3b441fe
Merge branch 'main' into move_snowflake_keywords
jpy-git e672f43
Merge branch 'main' into move_snowflake_keywords
jpy-git 81127be
Merge branch 'main' into move_snowflake_keywords
jpy-git File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,4 @@ FROM | |
age_buckets_bit_array | ||
JOIN | ||
bucket_abundance | ||
USING (bucket_id) | ||
USING (bucket_id) |
9 changes: 9 additions & 0 deletions
9
test/fixtures/dialects/snowflake/snowflake_non_reserved_keywords.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
SELECT account | ||
FROM foo; | ||
|
||
CREATE TABLE IF NOT EXISTS table_name( | ||
organization VARCHAR | ||
); | ||
|
||
with pivot as (select 1) | ||
select * from pivot; |
68 changes: 68 additions & 0 deletions
68
test/fixtures/dialects/snowflake/snowflake_non_reserved_keywords.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# 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: 0a53b2cd033461a0d01c39c4b100a3d8dbb033a360a61d1fcd28d8b178c47f82 | ||
file: | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
column_reference: | ||
identifier: account | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: foo | ||
- statement_terminator: ; | ||
- statement: | ||
create_table_statement: | ||
- keyword: CREATE | ||
- keyword: TABLE | ||
- keyword: IF | ||
- keyword: NOT | ||
- keyword: EXISTS | ||
- table_reference: | ||
identifier: table_name | ||
- bracketed: | ||
start_bracket: ( | ||
column_definition: | ||
identifier: organization | ||
data_type: | ||
data_type_identifier: VARCHAR | ||
end_bracket: ) | ||
- statement_terminator: ; | ||
- statement: | ||
with_compound_statement: | ||
keyword: with | ||
common_table_expression: | ||
identifier: pivot | ||
keyword: as | ||
bracketed: | ||
start_bracket: ( | ||
select_statement: | ||
select_clause: | ||
keyword: select | ||
select_clause_element: | ||
literal: '1' | ||
end_bracket: ) | ||
select_statement: | ||
select_clause: | ||
keyword: select | ||
select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
star: '*' | ||
from_clause: | ||
keyword: from | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: pivot | ||
- statement_terminator: ; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@BorePlusPlus btw this is what I needed to add to stop the parser getting confused about whether
PIVOT
is an alias or a function.Basically for an
ObjectReferenceSegment
, which is inherited byTableReferenceSegment
, it will stop matching when the subsequent token is part ofJoinLikeClauseGrammar
, which contains theFromPivotExpressionSegment
in Snowflake.