From db1ebe21a1a1c34b510b79fd52bf5130a99606bc Mon Sep 17 00:00:00 2001 From: griff <70294474+griffatrasgo@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:12:59 -0500 Subject: [PATCH] add snowflake and bq keywords --- sqlparse/keywords.py | 32 ++++++++++++++++++++++++++++++++ sqlparse/lexer.py | 2 ++ 2 files changed, 34 insertions(+) diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index d734bdff..130485d9 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -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, +} diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index 9548bfe1..0ff99bf3 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -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.