Skip to content

Commit

Permalink
add snowflake and bq keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
griffatrasgo authored and andialbrecht committed Mar 16, 2024
1 parent d76e8a4 commit db1ebe2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
32 changes: 32 additions & 0 deletions sqlparse/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,3 +966,35 @@
KEYWORDS_MSACCESS = {
'DISTINCTROW': tokens.Keyword,
}


KEYWORDS_SNOWFLAKE = {
'ACCOUNT': tokens.Keyword,
'GSCLUSTER': tokens.Keyword,
'ISSUE': tokens.Keyword,
'ORGANIZATION': tokens.Keyword,
'PIVOT': tokens.Keyword,
'QUALIFY': tokens.Keyword,
'REGEXP': tokens.Keyword,
'RLIKE': tokens.Keyword,
'SAMPLE': tokens.Keyword,
'TRY_CAST': tokens.Keyword,
'UNPIVOT': tokens.Keyword,

'VARIANT': tokens.Name.Builtin,
}


KEYWORDS_BIGQUERY = {
'ASSERT_ROWS_MODIFIED': tokens.Keyword,
'DEFINE': tokens.Keyword,
'ENUM': tokens.Keyword,
'HASH': tokens.Keyword,
'LOOKUP': tokens.Keyword,
'PRECEDING': tokens.Keyword,
'PROTO': tokens.Keyword,
'RESPECT': tokens.Keyword,
'TABLESAMPLE': tokens.Keyword,

'BIGNUMERIC': tokens.Name.Builtin,
}
2 changes: 2 additions & 0 deletions sqlparse/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def default_initialization(self):
self.add_keywords(keywords.KEYWORDS_HQL)
self.add_keywords(keywords.KEYWORDS_MSACCESS)
self.add_keywords(keywords.KEYWORDS)
self.add_keywords(keywords.KEYWORDS_SNOWFLAKE)
self.add_keywords(keywords.KEYWORDS_BIGQUERY)

def clear(self):
"""Clear all syntax configurations.
Expand Down

0 comments on commit db1ebe2

Please sign in to comment.