Edit on GitHub

sqlglot.dialects.snowflake

  1from __future__ import annotations
  2
  3from itertools import product
  4
  5from sqlglot import exp, jsonpath, tokens
  6from sqlglot.dialects.dialect import (
  7    AliasPrecedence,
  8    Dialect,
  9    NormalizationStrategy,
 10)
 11from sqlglot.generators.snowflake import SnowflakeGenerator
 12from sqlglot.parsers.snowflake import (
 13    SnowflakeParser,
 14)
 15from sqlglot.tokens import TokenType
 16from sqlglot.typing.snowflake import EXPRESSION_METADATA
 17
 18
 19class Snowflake(Dialect):
 20    # https://docs.snowflake.com/en/sql-reference/identifiers-syntax
 21    NORMALIZATION_STRATEGY = NormalizationStrategy.UPPERCASE
 22    # https://docs.snowflake.com/en/sql-reference/data-types-text#escape-sequences
 23    UNESCAPED_SEQUENCES = {"\\a": "a", "\\v": "v"}
 24    NULL_ORDERING = "nulls_are_large"
 25    TIME_FORMAT = "'YYYY-MM-DD HH24:MI:SS'"
 26    SUPPORTS_ORDER_BY_ALL = True
 27    SUPPORTS_USER_DEFINED_TYPES = False
 28    PREFER_CTE_ALIAS_COLUMN = True
 29    COLUMN_ALIAS_PRECEDENCE = {
 30        exp.Having: AliasPrecedence.SOURCE,
 31        exp.Qualify: AliasPrecedence.SOURCE,
 32    }
 33    SUPPORTS_POSITIONAL_COLUMN_REFS = True
 34    TABLESAMPLE_SIZE_IS_PERCENT = True
 35    COPY_PARAMS_ARE_CSV = False
 36    ARRAY_AGG_INCLUDES_NULLS = None
 37    ARRAY_FUNCS_PROPAGATES_NULLS = True
 38    ARRAY_REMOVE_PROPAGATES_NULLS = True
 39    ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN = False
 40    ALTER_TABLE_DROP_REQUIRED_FOR_EACH_COLUMN = False
 41    TRY_CAST_REQUIRES_STRING = True
 42    SUPPORTS_ALIAS_REFS_IN_JOIN_CONDITIONS = True
 43    LEAST_GREATEST_IGNORES_NULLS = False
 44    UUID_IS_STRING_TYPE = True
 45    STAR_ILIKE_BACKSLASH_ESCAPE = True
 46    REGEXP_EXTRACT_MISSING_GROUP_RETURNS_EMPTY = True
 47
 48    # https://docs.snowflake.com/en/sql-reference/functions/split_to_table
 49    DEFAULT_FUNCTIONS_COLUMN_NAMES = {
 50        exp.SplitToTable: ("seq", "index", "value"),
 51        exp.StrtokSplitToTable: ("seq", "index", "value"),
 52    }
 53
 54    EXPRESSION_METADATA = EXPRESSION_METADATA.copy()
 55
 56    # https://docs.snowflake.com/en/en/sql-reference/functions/initcap
 57    INITCAP_DEFAULT_DELIMITER_CHARS = ' \t\n\r\f\v!?@"^#$&~_,.:;+\\-*%/|\\[\\](){}<>'
 58
 59    INVERSE_TIME_MAPPING = {
 60        "%d": "DD",
 61        "%-d": "DD",
 62        "%a": "DY",
 63        "T": "T",  # in TIME_MAPPING we map '"T"' with the double quotes to 'T', and we want to prevent 'T' from being mapped back to '"T"' so that 'AUTO' doesn't become 'AU"T"O'
 64    }
 65
 66    TIME_MAPPING = {
 67        "".join(chars): value
 68        for key, value in {
 69            "YYYY": "%Y",
 70            "YY": "%y",
 71            "MMMM": "%B",
 72            "MON": "%b",
 73            "MM": "%m",
 74            "DD": "%d",
 75            "DY": "%a",
 76            "HH24": "%H",
 77            "HH12": "%I",
 78            "MI": "%M",
 79            "SS": "%S",
 80            "FF": "%f_nine",  # %f_ internal representation with precision specified
 81            "FF0": "%f_zero",
 82            "FF1": "%f_one",
 83            "FF2": "%f_two",
 84            "FF3": "%f_three",
 85            "FF4": "%f_four",
 86            "FF5": "%f_five",
 87            "FF6": "%f",
 88            "FF7": "%f_seven",
 89            "FF8": "%f_eight",
 90            "FF9": "%f_nine",
 91            "TZHTZM": "%z",
 92            "TZH:TZM": "%:z",  # internal representation for ±HH:MM
 93            "TZH": "%-z",  # internal representation ±HH
 94            # Seems like Snowflake treats AM/PM in the format string as equivalent,
 95            # only the time (stamp) value's AM/PM affects the output
 96            "AM": "%p",
 97            "PM": "%p",
 98        }.items()
 99        for chars in product(*zip(key.upper(), key.lower()))
100    } | {'"T"': "T"}
101
102    DATE_PART_MAPPING = {
103        **Dialect.DATE_PART_MAPPING,
104        "ISOWEEK": "WEEKISO",
105        # The base Dialect maps EPOCH_SECOND -> EPOCH, but we need to preserve
106        # EPOCH_SECOND as a distinct value for two reasons:
107        # 1. Type annotation: EPOCH_SECOND returns BIGINT, while EPOCH returns DOUBLE
108        # 2. Transpilation: DuckDB's EPOCH() returns float, so we cast EPOCH_SECOND
109        #    to BIGINT to match Snowflake's integer behavior
110        # Without this override, EXTRACT(EPOCH_SECOND FROM ts) would be normalized
111        # to EXTRACT(EPOCH FROM ts) and lose the integer semantics.
112        "EPOCH_SECOND": "EPOCH_SECOND",
113        "EPOCH_SECONDS": "EPOCH_SECOND",
114    }
115    EXTRACT_DATE_PART_MAPPING = {"ISOYEAR": "YEAROFWEEKISO"}
116
117    PSEUDOCOLUMNS = {"LEVEL"}
118
119    def can_quote(self, identifier: exp.Identifier, identify: str | bool = "safe") -> bool:
120        # This disables quoting DUAL in SELECT ... FROM DUAL, because Snowflake treats an
121        # unquoted DUAL keyword in a special way and does not map it to a user-defined table
122        return super().can_quote(identifier, identify) and not (
123            isinstance(identifier.parent, exp.Table)
124            and not identifier.quoted
125            and identifier.name.lower() == "dual"
126        )
127
128    class JSONPathTokenizer(jsonpath.JSONPathTokenizer):
129        SINGLE_TOKENS = jsonpath.JSONPathTokenizer.SINGLE_TOKENS.copy()
130        SINGLE_TOKENS.pop("$")
131
132    Parser = SnowflakeParser
133
134    class Tokenizer(tokens.Tokenizer):
135        STRING_ESCAPES = ["\\", "'"]
136        NUMERIC_ESCAPES = {"x": (16, 2, 2, 0xFF), "u": (16, 4, 4, 0xFFFF), "0": (8, 1, 3, 0xFF)}
137        DROP_UNKNOWN_ESCAPES = True
138        HEX_STRINGS = [("x'", "'"), ("X'", "'")]
139        RAW_STRINGS = ["$$"]
140        COMMENTS = ["--", "//", ("/*", "*/")]
141        NESTED_COMMENTS = False
142
143        KEYWORDS = {
144            **tokens.Tokenizer.KEYWORDS,
145            "(+)": TokenType.JOIN_MARKER,
146            "@": TokenType.STAGE_PATH,
147            "@~": TokenType.STAGE_PATH,
148            "BYTEINT": TokenType.INT,
149            "FILE://": TokenType.URI_START,
150            "FILE FORMAT": TokenType.FILE_FORMAT,
151            "GET": TokenType.GET,
152            "INTEGRATION": TokenType.INTEGRATION,
153            "LS": TokenType.LIST,
154            "MATCH_CONDITION": TokenType.MATCH_CONDITION,
155            "MATCH_RECOGNIZE": TokenType.MATCH_RECOGNIZE,
156            "MINUS": TokenType.EXCEPT,
157            "NCHAR VARYING": TokenType.VARCHAR,
158            "PACKAGE": TokenType.PACKAGE,
159            "POLICY": TokenType.POLICY,
160            "POOL": TokenType.POOL,
161            "PUT": TokenType.PUT,
162            "UNDROP": TokenType.UNDROP,
163            "REMOVE": TokenType.COMMAND,
164            "RM": TokenType.COMMAND,
165            "ROLE": TokenType.ROLE,
166            "RULE": TokenType.RULE,
167            "SAMPLE": TokenType.TABLE_SAMPLE,
168            "SEMANTIC VIEW": TokenType.SEMANTIC_VIEW,
169            "SQL_DOUBLE": TokenType.DOUBLE,
170            "SQL_VARCHAR": TokenType.VARCHAR,
171            "STAGE": TokenType.STAGE,
172            "STORAGE INTEGRATION": TokenType.STORAGE_INTEGRATION,
173            "STREAMLIT": TokenType.STREAMLIT,
174            "TAG": TokenType.TAG,
175            "TIMESTAMP_TZ": TokenType.TIMESTAMPTZ,
176            "TOP": TokenType.TOP,
177            "VOLUME": TokenType.VOLUME,
178            "WAREHOUSE": TokenType.WAREHOUSE,
179            # https://docs.snowflake.com/en/sql-reference/data-types-numeric#float
180            # FLOAT is a synonym for DOUBLE in Snowflake
181            "FLOAT": TokenType.DOUBLE,
182        }
183        KEYWORDS.pop("/*+")
184        KEYWORDS.pop("GLOB")
185        KEYWORDS.pop("RETURNING")
186
187        SINGLE_TOKENS = {
188            **tokens.Tokenizer.SINGLE_TOKENS,
189            "$": TokenType.PARAMETER,
190            "!": TokenType.EXCLAMATION,
191        }
192
193        VAR_SINGLE_TOKENS = {"$"}
194
195        # https://docs.snowflake.com/en/user-guide/querying-stage
196        UNQUOTED_PATH_TERMINATORS = {",", ";", "(", ")", "'", "`", "~", "<", ">", "|"}
197
198        COMMANDS = tokens.Tokenizer.COMMANDS - {TokenType.SHOW}
199
200    Generator = SnowflakeGenerator
class Snowflake(sqlglot.dialects.dialect.Dialect):
 20class Snowflake(Dialect):
 21    # https://docs.snowflake.com/en/sql-reference/identifiers-syntax
 22    NORMALIZATION_STRATEGY = NormalizationStrategy.UPPERCASE
 23    # https://docs.snowflake.com/en/sql-reference/data-types-text#escape-sequences
 24    UNESCAPED_SEQUENCES = {"\\a": "a", "\\v": "v"}
 25    NULL_ORDERING = "nulls_are_large"
 26    TIME_FORMAT = "'YYYY-MM-DD HH24:MI:SS'"
 27    SUPPORTS_ORDER_BY_ALL = True
 28    SUPPORTS_USER_DEFINED_TYPES = False
 29    PREFER_CTE_ALIAS_COLUMN = True
 30    COLUMN_ALIAS_PRECEDENCE = {
 31        exp.Having: AliasPrecedence.SOURCE,
 32        exp.Qualify: AliasPrecedence.SOURCE,
 33    }
 34    SUPPORTS_POSITIONAL_COLUMN_REFS = True
 35    TABLESAMPLE_SIZE_IS_PERCENT = True
 36    COPY_PARAMS_ARE_CSV = False
 37    ARRAY_AGG_INCLUDES_NULLS = None
 38    ARRAY_FUNCS_PROPAGATES_NULLS = True
 39    ARRAY_REMOVE_PROPAGATES_NULLS = True
 40    ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN = False
 41    ALTER_TABLE_DROP_REQUIRED_FOR_EACH_COLUMN = False
 42    TRY_CAST_REQUIRES_STRING = True
 43    SUPPORTS_ALIAS_REFS_IN_JOIN_CONDITIONS = True
 44    LEAST_GREATEST_IGNORES_NULLS = False
 45    UUID_IS_STRING_TYPE = True
 46    STAR_ILIKE_BACKSLASH_ESCAPE = True
 47    REGEXP_EXTRACT_MISSING_GROUP_RETURNS_EMPTY = True
 48
 49    # https://docs.snowflake.com/en/sql-reference/functions/split_to_table
 50    DEFAULT_FUNCTIONS_COLUMN_NAMES = {
 51        exp.SplitToTable: ("seq", "index", "value"),
 52        exp.StrtokSplitToTable: ("seq", "index", "value"),
 53    }
 54
 55    EXPRESSION_METADATA = EXPRESSION_METADATA.copy()
 56
 57    # https://docs.snowflake.com/en/en/sql-reference/functions/initcap
 58    INITCAP_DEFAULT_DELIMITER_CHARS = ' \t\n\r\f\v!?@"^#$&~_,.:;+\\-*%/|\\[\\](){}<>'
 59
 60    INVERSE_TIME_MAPPING = {
 61        "%d": "DD",
 62        "%-d": "DD",
 63        "%a": "DY",
 64        "T": "T",  # in TIME_MAPPING we map '"T"' with the double quotes to 'T', and we want to prevent 'T' from being mapped back to '"T"' so that 'AUTO' doesn't become 'AU"T"O'
 65    }
 66
 67    TIME_MAPPING = {
 68        "".join(chars): value
 69        for key, value in {
 70            "YYYY": "%Y",
 71            "YY": "%y",
 72            "MMMM": "%B",
 73            "MON": "%b",
 74            "MM": "%m",
 75            "DD": "%d",
 76            "DY": "%a",
 77            "HH24": "%H",
 78            "HH12": "%I",
 79            "MI": "%M",
 80            "SS": "%S",
 81            "FF": "%f_nine",  # %f_ internal representation with precision specified
 82            "FF0": "%f_zero",
 83            "FF1": "%f_one",
 84            "FF2": "%f_two",
 85            "FF3": "%f_three",
 86            "FF4": "%f_four",
 87            "FF5": "%f_five",
 88            "FF6": "%f",
 89            "FF7": "%f_seven",
 90            "FF8": "%f_eight",
 91            "FF9": "%f_nine",
 92            "TZHTZM": "%z",
 93            "TZH:TZM": "%:z",  # internal representation for ±HH:MM
 94            "TZH": "%-z",  # internal representation ±HH
 95            # Seems like Snowflake treats AM/PM in the format string as equivalent,
 96            # only the time (stamp) value's AM/PM affects the output
 97            "AM": "%p",
 98            "PM": "%p",
 99        }.items()
100        for chars in product(*zip(key.upper(), key.lower()))
101    } | {'"T"': "T"}
102
103    DATE_PART_MAPPING = {
104        **Dialect.DATE_PART_MAPPING,
105        "ISOWEEK": "WEEKISO",
106        # The base Dialect maps EPOCH_SECOND -> EPOCH, but we need to preserve
107        # EPOCH_SECOND as a distinct value for two reasons:
108        # 1. Type annotation: EPOCH_SECOND returns BIGINT, while EPOCH returns DOUBLE
109        # 2. Transpilation: DuckDB's EPOCH() returns float, so we cast EPOCH_SECOND
110        #    to BIGINT to match Snowflake's integer behavior
111        # Without this override, EXTRACT(EPOCH_SECOND FROM ts) would be normalized
112        # to EXTRACT(EPOCH FROM ts) and lose the integer semantics.
113        "EPOCH_SECOND": "EPOCH_SECOND",
114        "EPOCH_SECONDS": "EPOCH_SECOND",
115    }
116    EXTRACT_DATE_PART_MAPPING = {"ISOYEAR": "YEAROFWEEKISO"}
117
118    PSEUDOCOLUMNS = {"LEVEL"}
119
120    def can_quote(self, identifier: exp.Identifier, identify: str | bool = "safe") -> bool:
121        # This disables quoting DUAL in SELECT ... FROM DUAL, because Snowflake treats an
122        # unquoted DUAL keyword in a special way and does not map it to a user-defined table
123        return super().can_quote(identifier, identify) and not (
124            isinstance(identifier.parent, exp.Table)
125            and not identifier.quoted
126            and identifier.name.lower() == "dual"
127        )
128
129    class JSONPathTokenizer(jsonpath.JSONPathTokenizer):
130        SINGLE_TOKENS = jsonpath.JSONPathTokenizer.SINGLE_TOKENS.copy()
131        SINGLE_TOKENS.pop("$")
132
133    Parser = SnowflakeParser
134
135    class Tokenizer(tokens.Tokenizer):
136        STRING_ESCAPES = ["\\", "'"]
137        NUMERIC_ESCAPES = {"x": (16, 2, 2, 0xFF), "u": (16, 4, 4, 0xFFFF), "0": (8, 1, 3, 0xFF)}
138        DROP_UNKNOWN_ESCAPES = True
139        HEX_STRINGS = [("x'", "'"), ("X'", "'")]
140        RAW_STRINGS = ["$$"]
141        COMMENTS = ["--", "//", ("/*", "*/")]
142        NESTED_COMMENTS = False
143
144        KEYWORDS = {
145            **tokens.Tokenizer.KEYWORDS,
146            "(+)": TokenType.JOIN_MARKER,
147            "@": TokenType.STAGE_PATH,
148            "@~": TokenType.STAGE_PATH,
149            "BYTEINT": TokenType.INT,
150            "FILE://": TokenType.URI_START,
151            "FILE FORMAT": TokenType.FILE_FORMAT,
152            "GET": TokenType.GET,
153            "INTEGRATION": TokenType.INTEGRATION,
154            "LS": TokenType.LIST,
155            "MATCH_CONDITION": TokenType.MATCH_CONDITION,
156            "MATCH_RECOGNIZE": TokenType.MATCH_RECOGNIZE,
157            "MINUS": TokenType.EXCEPT,
158            "NCHAR VARYING": TokenType.VARCHAR,
159            "PACKAGE": TokenType.PACKAGE,
160            "POLICY": TokenType.POLICY,
161            "POOL": TokenType.POOL,
162            "PUT": TokenType.PUT,
163            "UNDROP": TokenType.UNDROP,
164            "REMOVE": TokenType.COMMAND,
165            "RM": TokenType.COMMAND,
166            "ROLE": TokenType.ROLE,
167            "RULE": TokenType.RULE,
168            "SAMPLE": TokenType.TABLE_SAMPLE,
169            "SEMANTIC VIEW": TokenType.SEMANTIC_VIEW,
170            "SQL_DOUBLE": TokenType.DOUBLE,
171            "SQL_VARCHAR": TokenType.VARCHAR,
172            "STAGE": TokenType.STAGE,
173            "STORAGE INTEGRATION": TokenType.STORAGE_INTEGRATION,
174            "STREAMLIT": TokenType.STREAMLIT,
175            "TAG": TokenType.TAG,
176            "TIMESTAMP_TZ": TokenType.TIMESTAMPTZ,
177            "TOP": TokenType.TOP,
178            "VOLUME": TokenType.VOLUME,
179            "WAREHOUSE": TokenType.WAREHOUSE,
180            # https://docs.snowflake.com/en/sql-reference/data-types-numeric#float
181            # FLOAT is a synonym for DOUBLE in Snowflake
182            "FLOAT": TokenType.DOUBLE,
183        }
184        KEYWORDS.pop("/*+")
185        KEYWORDS.pop("GLOB")
186        KEYWORDS.pop("RETURNING")
187
188        SINGLE_TOKENS = {
189            **tokens.Tokenizer.SINGLE_TOKENS,
190            "$": TokenType.PARAMETER,
191            "!": TokenType.EXCLAMATION,
192        }
193
194        VAR_SINGLE_TOKENS = {"$"}
195
196        # https://docs.snowflake.com/en/user-guide/querying-stage
197        UNQUOTED_PATH_TERMINATORS = {",", ";", "(", ")", "'", "`", "~", "<", ">", "|"}
198
199        COMMANDS = tokens.Tokenizer.COMMANDS - {TokenType.SHOW}
200
201    Generator = SnowflakeGenerator
NORMALIZATION_STRATEGY = <NormalizationStrategy.UPPERCASE: 'UPPERCASE'>

Specifies the strategy according to which identifiers should be normalized.

UNESCAPED_SEQUENCES: dict[str, str] = {'\\a': 'a', '\\b': '\x08', '\\f': '\x0c', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\v': 'v', '\\\\': '\\'}

Mapping of an escaped sequence (\n) to its unescaped version ( ).

NULL_ORDERING = 'nulls_are_large'

Default NULL ordering method to use if not explicitly set. Possible values: "nulls_are_small", "nulls_are_large", "nulls_are_last"

TIME_FORMAT = "'YYYY-MM-DD HH24:MI:SS'"
SUPPORTS_ORDER_BY_ALL = True

Whether ORDER BY ALL is supported (expands to all the selected columns) as in DuckDB, Spark3/Databricks

SUPPORTS_USER_DEFINED_TYPES = False

Whether user-defined data types are supported.

PREFER_CTE_ALIAS_COLUMN = True

Some dialects, such as Snowflake, allow you to reference a CTE column alias in the HAVING clause of the CTE. This flag will cause the CTE alias columns to override any projection aliases in the subquery.

For example, WITH y(c) AS ( SELECT SUM(a) FROM (SELECT 1 a) AS x HAVING c > 0 ) SELECT c FROM y;

will be rewritten as

WITH y(c) AS (
    SELECT SUM(a) AS c FROM (SELECT 1 AS a) AS x HAVING c > 0
) SELECT c FROM y;
COLUMN_ALIAS_PRECEDENCE: dict[type[sqlglot.expressions.core.Expr], sqlglot.dialects.dialect.AliasPrecedence] = {<class 'sqlglot.expressions.query.Having'>: <AliasPrecedence.SOURCE: 'SOURCE'>, <class 'sqlglot.expressions.query.Qualify'>: <AliasPrecedence.SOURCE: 'SOURCE'>}

Alias lookup policies for HAVING, QUALIFY, ORDER BY and DISTINCT ON.

Unspecified clauses prefer aliases. GROUPED_SOURCE prefers grouped input columns and input columns inside aggregates, then aliases. MERGED_SOURCE prefers merged USING keys over other input columns. Standalone ORDER BY / DISTINCT ON names prefer aliases regardless of their clause's expression precedence.

SUPPORTS_POSITIONAL_COLUMN_REFS = True

Whether qualified $N references the Nth column of their source.

TABLESAMPLE_SIZE_IS_PERCENT = True

Whether a size in the table sample clause represents percentage.

COPY_PARAMS_ARE_CSV = False

Whether COPY statement parameters are separated by comma or whitespace

ARRAY_AGG_INCLUDES_NULLS: bool | None = None

Whether ArrayAgg needs to filter NULL values.

ARRAY_FUNCS_PROPAGATES_NULLS = True

Whether Array update functions return NULL when the input array is NULL.

ARRAY_REMOVE_PROPAGATES_NULLS = True

Whether ARRAY_REMOVE returns NULL when the removal value is NULL.

ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN = False
ALTER_TABLE_DROP_REQUIRED_FOR_EACH_COLUMN = False
TRY_CAST_REQUIRES_STRING: bool | None = True
SUPPORTS_ALIAS_REFS_IN_JOIN_CONDITIONS = True

Whether alias references are allowed in JOIN ... ON clauses.

Most dialects do not support this, but Snowflake allows alias expansion in the JOIN ... ON clause (and almost everywhere else)

For example, in Snowflake: SELECT a.id AS user_id FROM a JOIN b ON user_id = b.id -- VALID

Reference: sqlglot.dialects.snowflake.com/en/sql-reference/sql/select#usage-notes">https://docssqlglot.dialects.snowflake.com/en/sql-reference/sql/select#usage-notes

LEAST_GREATEST_IGNORES_NULLS = False

Whether LEAST/GREATEST functions ignore NULL values, e.g:

  • BigQuery, Snowflake, MySQL, Presto/Trino: LEAST(1, NULL, 2) -> NULL
  • Spark, Postgres, DuckDB, TSQL: LEAST(1, NULL, 2) -> 1
UUID_IS_STRING_TYPE: bool = True

Whether a UUID is considered a string or a UUID type.

STAR_ILIKE_BACKSLASH_ESCAPE = True

Whether a backslash in a SELECT * ILIKE '<pattern>' filter escapes the following character, so that e.g. \_ matches a literal underscore (Snowflake). When False, backslashes in the pattern are matched literally (DuckDB).

REGEXP_EXTRACT_MISSING_GROUP_RETURNS_EMPTY = True

Whether REGEXP_EXTRACT returns an empty string for a non-participating capture group.

DEFAULT_FUNCTIONS_COLUMN_NAMES: dict[type[sqlglot.expressions.core.Func], str | tuple[str, ...]] = {<class 'sqlglot.expressions.array.SplitToTable'>: ('seq', 'index', 'value'), <class 'sqlglot.expressions.array.StrtokSplitToTable'>: ('seq', 'index', 'value')}

Maps function expressions to their default output column name(s).

For example, in Postgres, generate_series function outputs a column named "generate_series" by default, so we map the ExplodingGenerateSeries expression to "generate_series" string.

EXPRESSION_METADATA = {<class 'sqlglot.expressions.core.Add'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Adjacent'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.And'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayContainedBy'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayContains'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayContainsAll'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayOverlaps'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayPosition'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Binary'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.BitwiseAnd'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.BitwiseLeftShift'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.BitwiseOr'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.BitwiseRightShift'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.BitwiseXor'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.functions.Collate'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.core.Connector'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.Corr'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.DPipe'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.core.Distance'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.DistanceNd'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Div'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.core.Dot'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.core.EQ'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Escape'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.ExtendsLeft'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.ExtendsRight'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.GT'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.GTE'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Glob'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.ILike'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.IntDiv'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Is'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONArrayContains'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBContains'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBContainsAllTopKeys'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBContainsAnyTopKeys'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBContainsTopKey'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBDeleteAtPath'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBExtract'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBExtractScalar'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONBPathExists'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONExtract'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.json.JSONExtractScalar'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Kwarg'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.LT'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.LTE'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Like'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Match'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Mod'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Mul'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.NEQ'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.NestedJSONSelect'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.NullSafeEQ'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.NullSafeNEQ'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Operator'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Or'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Overlaps'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Pow'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.core.PropertyEQ'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.string.RegexpFullMatch'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.RegexpILike'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.RegexpLike'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.SimilarTo'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Sub'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Xor'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Alias'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.BitwiseNot'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.FormatPhrase'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.IgnoreNulls'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Neg'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Not'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Paren'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.PivotAlias'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Pos'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.RespectNulls'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.TeradataNamed'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.TeradataTitle'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Unary'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.temporal.UnixMillis'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.core.ApproxDistinct'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.temporal.UnixMicros'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.functions.Int64'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.aggregate.CountIf'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.aggregate.Ntile'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.aggregate.Rank'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.array.ArraySize'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.aggregate.RowNumber'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.aggregate.DenseRank'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.UnixSeconds'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.string.FromBase64'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.FromBase32'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.core.All'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.math.IsInf'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.functions.IsArray'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.aggregate.LogicalOr'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.aggregate.LogicalAnd'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.core.In'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.string.EndsWith'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.core.Any'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.functions.Exists'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.string.Contains'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.core.Between'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.math.IsNan'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.string.StartsWith'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.core.Boolean'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.temporal.StrToDate'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.DiToDate'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.DateStrToDate'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.LastDay'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.TimeStrToDate'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.CurrentDate'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.DateFromParts'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.TsOrDsToDate'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.Date'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.DatetimeAdd'>: {'returns': <DType.DATETIME: 'DATETIME'>}, <class 'sqlglot.expressions.temporal.Datetime'>: {'returns': <DType.DATETIME: 'DATETIME'>}, <class 'sqlglot.expressions.temporal.TsOrDsToDatetime'>: {'returns': <DType.DATETIME: 'DATETIME'>}, <class 'sqlglot.expressions.temporal.DatetimeSub'>: {'returns': <DType.DATETIME: 'DATETIME'>}, <class 'sqlglot.expressions.temporal.CurrentDatetime'>: {'returns': <DType.DATETIME: 'DATETIME'>}, <class 'sqlglot.expressions.math.SafeDivide'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Atan'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Tanh'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Cot'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.VariancePop'>: {'annotator': <function _annotate_variance>}, <class 'sqlglot.expressions.aggregate.ApproxQuantile'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Asin'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Sinh'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.string.ToDouble'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.PercentRank'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.PercentileCont'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.CovarSamp'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Radians'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Exp'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.StddevPop'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Cbrt'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.functions.Rand'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.math.Log'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.Skewness'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Cos'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Atanh'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Acos'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.Variance'>: {'annotator': <function _annotate_variance>}, <class 'sqlglot.expressions.math.Asinh'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Tan'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Cosh'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.Kurtosis'>: {'annotator': <function _annotate_kurtosis>}, <class 'sqlglot.expressions.aggregate.Quantile'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Sqrt'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Acosh'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Sin'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Round'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.CumeDist'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.CovarPop'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Degrees'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Pi'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.StddevSamp'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.Stddev'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.Avg'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.Ln'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.math.Getbit'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.TimeDiff'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.math.Sign'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.DatetimeDiff'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.TimestampDiff'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.string.Ascii'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.string.Levenshtein'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.string.Unicode'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.DayOfMonth'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.UnixDate'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.string.BitLength'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.string.StrPosition'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.Quarter'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.TsOrDiToDi'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.Hour'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.DateToDi'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.DayOfYear'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.string.Length'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.DayOfWeek'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.JustifyDays'>: {'returns': <DType.INTERVAL: 'INTERVAL'>}, <class 'sqlglot.expressions.datatypes.Interval'>: {'returns': <DType.INTERVAL: 'INTERVAL'>}, <class 'sqlglot.expressions.temporal.MakeInterval'>: {'returns': <DType.INTERVAL: 'INTERVAL'>}, <class 'sqlglot.expressions.temporal.JustifyInterval'>: {'returns': <DType.INTERVAL: 'INTERVAL'>}, <class 'sqlglot.expressions.temporal.JustifyHours'>: {'returns': <DType.INTERVAL: 'INTERVAL'>}, <class 'sqlglot.expressions.json.ParseJSON'>: {'returns': <DType.JSON: 'JSON'>}, <class 'sqlglot.expressions.temporal.Localtime'>: {'returns': <DType.TIME: 'TIME'>}, <class 'sqlglot.expressions.temporal.CurrentTime'>: {'returns': <DType.TIME: 'TIME'>}, <class 'sqlglot.expressions.temporal.TimeSub'>: {'returns': <DType.TIME: 'TIME'>}, <class 'sqlglot.expressions.temporal.TimeAdd'>: {'annotator': <function _annotate_date_or_time_add>}, <class 'sqlglot.expressions.temporal.Time'>: {'returns': <DType.TIME: 'TIME'>}, <class 'sqlglot.expressions.temporal.TimestampLtzFromParts'>: {'returns': <DType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>}, <class 'sqlglot.expressions.temporal.CurrentTimestampLTZ'>: {'returns': <DType.TIMESTAMPTZ: 'TIMESTAMPTZ'>}, <class 'sqlglot.expressions.temporal.TimestampTzFromParts'>: {'returns': <DType.TIMESTAMPTZ: 'TIMESTAMPTZ'>}, <class 'sqlglot.expressions.temporal.StrToTime'>: {'annotator': <function _annotate_str_to_time>}, <class 'sqlglot.expressions.temporal.TimestampSub'>: {'returns': <DType.TIMESTAMP: 'TIMESTAMP'>}, <class 'sqlglot.expressions.temporal.TimestampAdd'>: {'returns': <DType.TIMESTAMP: 'TIMESTAMP'>}, <class 'sqlglot.expressions.temporal.CurrentTimestamp'>: {'returns': <DType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>}, <class 'sqlglot.expressions.temporal.TimeStrToTime'>: {'returns': <DType.TIMESTAMP: 'TIMESTAMP'>}, <class 'sqlglot.expressions.temporal.UnixToTime'>: {'returns': <DType.TIMESTAMP: 'TIMESTAMP'>}, <class 'sqlglot.expressions.temporal.Year'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.YearOfWeekIso'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.WeekOfYear'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.Day'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.YearOfWeek'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.Week'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.DayOfWeekIso'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.temporal.Month'>: {'returns': <DType.TINYINT: 'TINYINT'>}, <class 'sqlglot.expressions.string.Repeat'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.array.ArrayToString'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentSchema'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentRole'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.ConcatWs'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.Monthname'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Chr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Space'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.SHA2'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.temporal.TimeToStr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.ToBase32'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.temporal.DateToDateStr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.temporal.Dayname'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.temporal.UnixToStr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.aggregate.GroupConcat'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Translate'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Initcap'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Substring'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.query.RawString'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.String'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.SHA'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.temporal.UnixToTimeStr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.temporal.TsOrDsToDateStr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Concat'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.ToChar'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.MD5'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.SessionUser'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.temporal.TimeToTimeStr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.ToBase64'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentVersion'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.core.Typeof'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentCatalog'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Lower'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Upper'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentUser'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Trim'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.ToVariant'>: {'returns': <DType.VARIANT: 'VARIANT'>}, <class 'sqlglot.expressions.math.Ceil'>: {'annotator': <function _annotate_floor_ceil>}, <class 'sqlglot.expressions.math.Floor'>: {'annotator': <function _annotate_floor_ceil>}, <class 'sqlglot.expressions.query.Limit'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.NthValue'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArraySort'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.ArrayConcatAgg'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArraySlice'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Filter'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.FirstValue'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.math.Abs'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayReverse'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.AnyValue'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.LastValue'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.HavingMax'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.query.Window'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.query.Order'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayConcat'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.functions.Greatest'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.functions.Least'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.functions.Coalesce'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.Max'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.Min'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayLast'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayFirst'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.Anonymous'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.DateSub'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.temporal.DateAdd'>: {'annotator': <function _annotate_date_or_time_add>}, <class 'sqlglot.expressions.temporal.DateTrunc'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.functions.Cast'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.core.TeradataConversion'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.functions.TryCast'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.VarMap'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.Map'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.Array'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.aggregate.ArrayAgg'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.core.Bracket'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.functions.Case'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.aggregate.Count'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.DateDiff'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.datatypes.DataType'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.core.Distinct'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.array.Explode'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.Extract'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.query.HexString'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.array.GenerateSeries'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.GenerateDateArray'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.GenerateTimestampArray'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.functions.If'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.aggregate.Lag'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.aggregate.Lead'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.core.Literal'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.core.Null'>: {'returns': <DType.NULL: 'NULL'>}, <class 'sqlglot.expressions.functions.Nullif'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.array.Struct'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.aggregate.Sum'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.temporal.Timestamp'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.array.ToMap'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.array.Unnest'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.core.WithinGroup'>: {'annotator': <function _annotate_within_group>}, <class 'sqlglot.expressions.query.Subquery'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.array.ArrayExcept'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.Pad'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.Stuff'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.Mode'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.temporal.TimeSlice'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.temporal.TimestampTrunc'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.array.ArrayDistinct'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.Right'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.temporal.AddMonths'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.Left'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.aggregate.ApproxTopK'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.aggregate.ApproxTopKEstimate'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.ArrayAppend'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.ArrayCompact'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.ArrayConstructCompact'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.ArrayPrepend'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.ArrayRemove'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.ArraysZip'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.aggregate.ArrayUniqueAgg'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.aggregate.ArrayUnionAgg'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.MapKeys'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.string.RegexpExtractAll'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.string.Split'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.StringToArray'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.array.StrtokToArray'>: {'returns': <DType.ARRAY: 'ARRAY'>}, <class 'sqlglot.expressions.math.BitmapBucketNumber'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.math.Factorial'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.functions.Zipf'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.math.BitmapBitPosition'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.functions.Seq8'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.aggregate.GroupingId'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.string.MD5NumberUpper64'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.string.MD5NumberLower64'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.math.BitmapCount'>: {'returns': <DType.BIGINT: 'BIGINT'>}, <class 'sqlglot.expressions.string.Decrypt'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.ToBinary'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.Compress'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.SHA2Digest'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.TryBase64DecodeBinary'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.Base64DecodeBinary'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.EncryptRaw'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.SHA1Digest'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.Unhex'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.Encrypt'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.MD5Digest'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.math.BitmapOrAgg'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.DecompressBinary'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.DecryptRaw'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.string.TryHexDecodeBinary'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.math.BitmapConstructAgg'>: {'returns': <DType.BINARY: 'BINARY'>}, <class 'sqlglot.expressions.functions.IsNullValue'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.array.MapContainsKey'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.math.BoolxorAgg'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.string.SearchIp'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.math.Boolor'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.functions.ToBoolean'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.string.Search'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.math.Boolnot'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.math.Booland'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.functions.EqualNull'>: {'returns': <DType.BOOLEAN: 'BOOLEAN'>}, <class 'sqlglot.expressions.temporal.PreviousDay'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.temporal.NextDay'>: {'returns': <DType.DATE: 'DATE'>}, <class 'sqlglot.expressions.math.BitwiseAndAgg'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.math.BitwiseOrAgg'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.math.BitwiseXorAgg'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.RegexpCount'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.RegexpInstr'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.string.ToNumber'>: {'annotator': <function <dictcomp>.<lambda>>}, <class 'sqlglot.expressions.math.DotProduct'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.CosineDistance'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.ApproxPercentileEstimate'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.aggregate.ApproximateSimilarity'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.functions.Normal'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.ManhattanDistance'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.temporal.MonthsBetween'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.math.EuclideanDistance'>: {'returns': <DType.DOUBLE: 'DOUBLE'>}, <class 'sqlglot.expressions.string.ToDecfloat'>: {'returns': <DType.DECFLOAT: 'DECFLOAT'>}, <class 'sqlglot.expressions.string.TryToDecfloat'>: {'returns': <DType.DECFLOAT: 'DECFLOAT'>}, <class 'sqlglot.expressions.math.Atan2'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrAvgx'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrSxy'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrSlope'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrIntercept'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrValy'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrAvgy'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrSyy'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrSxx'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrR2'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrCount'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.aggregate.RegrValx'>: {'annotator': <function _annotate_math_with_float_decfloat>}, <class 'sqlglot.expressions.temporal.Minute'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.string.ByteLength'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.array.MapSize'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.functions.WidthBucket'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.string.RtrimmedLength'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.temporal.Second'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.functions.Seq4'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.aggregate.Grouping'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.math.JarowinklerSimilarity'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.functions.Seq2'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.functions.Seq1'>: {'returns': <DType.INT: 'INT'>}, <class 'sqlglot.expressions.aggregate.ObjectAgg'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.aggregate.ApproxPercentileCombine'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.aggregate.ApproxPercentileAccumulate'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.functions.XMLGet'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.aggregate.ApproxTopKCombine'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.string.ParseUrl'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.functions.ParseIp'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.aggregate.ApproxTopKAccumulate'>: {'returns': <DType.OBJECT: 'OBJECT'>}, <class 'sqlglot.expressions.array.MapPick'>: {'returns': <DType.MAP: 'MAP'>}, <class 'sqlglot.expressions.array.MapDelete'>: {'returns': <DType.MAP: 'MAP'>}, <class 'sqlglot.expressions.array.MapCat'>: {'returns': <DType.MAP: 'MAP'>}, <class 'sqlglot.expressions.array.MapInsert'>: {'returns': <DType.MAP: 'MAP'>}, <class 'sqlglot.expressions.string.ToFile'>: {'returns': <DType.FILE: 'FILE'>}, <class 'sqlglot.expressions.temporal.TsOrDsToTime'>: {'returns': <DType.TIME: 'TIME'>}, <class 'sqlglot.expressions.temporal.TimeFromParts'>: {'returns': <DType.TIME: 'TIME'>}, <class 'sqlglot.expressions.temporal.Localtimestamp'>: {'returns': <DType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>}, <class 'sqlglot.expressions.functions.CurrentSecondaryRoles'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Soundex'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.Uuid'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.RegexpReplace'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.RegexpExtract'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentOrganizationUser'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.AIClassify'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.SplitPart'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentIpAddress'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Base64DecodeString'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentWarehouse'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.Randstr'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.TryHexDecodeString'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentClient'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentAvailableRoles'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.DecompressString'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.aggregate.AISummarizeAgg'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentTransaction'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.HexDecodeString'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentAccount'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentSession'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Replace'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentSchemas'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.json.CheckJson'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.json.JSONFormat'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentRoleType'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentRegion'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Strtok'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentOrganizationName'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Base64Encode'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.TryBase64DecodeString'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentDatabase'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.SoundexP123'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.aggregate.AIAgg'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CheckXml'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentAccountName'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.CurrentStatement'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.functions.Collation'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.string.Hex'>: {'returns': <DType.VARCHAR: 'VARCHAR'>}, <class 'sqlglot.expressions.aggregate.MinhashCombine'>: {'returns': <DType.VARIANT: 'VARIANT'>}, <class 'sqlglot.expressions.aggregate.Minhash'>: {'returns': <DType.VARIANT: 'VARIANT'>}, <class 'sqlglot.expressions.aggregate.ArgMax'>: {'annotator': <function _annotate_arg_max_min>}, <class 'sqlglot.expressions.aggregate.ArgMin'>: {'annotator': <function _annotate_arg_max_min>}, <class 'sqlglot.expressions.temporal.ConvertTimezone'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.functions.DecodeCase'>: {'annotator': <function _annotate_decode_case>}, <class 'sqlglot.expressions.core.HashAgg'>: {'annotator': <function <lambda>>}, <class 'sqlglot.expressions.aggregate.Median'>: {'annotator': <function _annotate_median>}, <class 'sqlglot.expressions.string.Reverse'>: {'annotator': <function _annotate_reverse>}, <class 'sqlglot.expressions.temporal.TimestampFromParts'>: {'annotator': <function _annotate_timestamp_from_parts>}}
INITCAP_DEFAULT_DELIMITER_CHARS = ' \t\n\r\x0c\x0b!?@"^#$&~_,.:;+\\-*%/|\\[\\](){}<>'
INVERSE_TIME_MAPPING: dict[str, str] = {'%Y': 'yyyy', '%y': 'yy', '%B': 'mmmm', '%b': 'mon', '%m': 'mm', '%d': 'DD', '%a': 'DY', '%H': 'hh24', '%I': 'hh12', '%M': 'mi', '%S': 'ss', '%f_nine': 'ff9', '%f_zero': 'ff0', '%f_one': 'ff1', '%f_two': 'ff2', '%f_three': 'ff3', '%f_four': 'ff4', '%f_five': 'ff5', '%f': 'ff6', '%f_seven': 'ff7', '%f_eight': 'ff8', '%z': 'tzhtzm', '%:z': 'tzh:tzm', '%-z': 'tzh', '%p': 'pm', 'T': 'T', '%-d': 'DD', '%mstrict': 'mm', '%dstrict': 'DD', '%Hstrict': 'hh24', '%Istrict': 'hh12', '%Mstrict': 'mi', '%Sstrict': 'ss'}
TIME_MAPPING: dict[str, str] = {'YYYY': '%Y', 'YYYy': '%Y', 'YYyY': '%Y', 'YYyy': '%Y', 'YyYY': '%Y', 'YyYy': '%Y', 'YyyY': '%Y', 'Yyyy': '%Y', 'yYYY': '%Y', 'yYYy': '%Y', 'yYyY': '%Y', 'yYyy': '%Y', 'yyYY': '%Y', 'yyYy': '%Y', 'yyyY': '%Y', 'yyyy': '%Y', 'YY': '%y', 'Yy': '%y', 'yY': '%y', 'yy': '%y', 'MMMM': '%B', 'MMMm': '%B', 'MMmM': '%B', 'MMmm': '%B', 'MmMM': '%B', 'MmMm': '%B', 'MmmM': '%B', 'Mmmm': '%B', 'mMMM': '%B', 'mMMm': '%B', 'mMmM': '%B', 'mMmm': '%B', 'mmMM': '%B', 'mmMm': '%B', 'mmmM': '%B', 'mmmm': '%B', 'MON': '%b', 'MOn': '%b', 'MoN': '%b', 'Mon': '%b', 'mON': '%b', 'mOn': '%b', 'moN': '%b', 'mon': '%b', 'MM': '%m', 'Mm': '%m', 'mM': '%m', 'mm': '%m', 'DD': '%d', 'Dd': '%d', 'dD': '%d', 'dd': '%d', 'DY': '%a', 'Dy': '%a', 'dY': '%a', 'dy': '%a', 'HH24': '%H', 'Hh24': '%H', 'hH24': '%H', 'hh24': '%H', 'HH12': '%I', 'Hh12': '%I', 'hH12': '%I', 'hh12': '%I', 'MI': '%M', 'Mi': '%M', 'mI': '%M', 'mi': '%M', 'SS': '%S', 'Ss': '%S', 'sS': '%S', 'ss': '%S', 'FF': '%f_nine', 'Ff': '%f_nine', 'fF': '%f_nine', 'ff': '%f_nine', 'FF0': '%f_zero', 'Ff0': '%f_zero', 'fF0': '%f_zero', 'ff0': '%f_zero', 'FF1': '%f_one', 'Ff1': '%f_one', 'fF1': '%f_one', 'ff1': '%f_one', 'FF2': '%f_two', 'Ff2': '%f_two', 'fF2': '%f_two', 'ff2': '%f_two', 'FF3': '%f_three', 'Ff3': '%f_three', 'fF3': '%f_three', 'ff3': '%f_three', 'FF4': '%f_four', 'Ff4': '%f_four', 'fF4': '%f_four', 'ff4': '%f_four', 'FF5': '%f_five', 'Ff5': '%f_five', 'fF5': '%f_five', 'ff5': '%f_five', 'FF6': '%f', 'Ff6': '%f', 'fF6': '%f', 'ff6': '%f', 'FF7': '%f_seven', 'Ff7': '%f_seven', 'fF7': '%f_seven', 'ff7': '%f_seven', 'FF8': '%f_eight', 'Ff8': '%f_eight', 'fF8': '%f_eight', 'ff8': '%f_eight', 'FF9': '%f_nine', 'Ff9': '%f_nine', 'fF9': '%f_nine', 'ff9': '%f_nine', 'TZHTZM': '%z', 'TZHTZm': '%z', 'TZHTzM': '%z', 'TZHTzm': '%z', 'TZHtZM': '%z', 'TZHtZm': '%z', 'TZHtzM': '%z', 'TZHtzm': '%z', 'TZhTZM': '%z', 'TZhTZm': '%z', 'TZhTzM': '%z', 'TZhTzm': '%z', 'TZhtZM': '%z', 'TZhtZm': '%z', 'TZhtzM': '%z', 'TZhtzm': '%z', 'TzHTZM': '%z', 'TzHTZm': '%z', 'TzHTzM': '%z', 'TzHTzm': '%z', 'TzHtZM': '%z', 'TzHtZm': '%z', 'TzHtzM': '%z', 'TzHtzm': '%z', 'TzhTZM': '%z', 'TzhTZm': '%z', 'TzhTzM': '%z', 'TzhTzm': '%z', 'TzhtZM': '%z', 'TzhtZm': '%z', 'TzhtzM': '%z', 'Tzhtzm': '%z', 'tZHTZM': '%z', 'tZHTZm': '%z', 'tZHTzM': '%z', 'tZHTzm': '%z', 'tZHtZM': '%z', 'tZHtZm': '%z', 'tZHtzM': '%z', 'tZHtzm': '%z', 'tZhTZM': '%z', 'tZhTZm': '%z', 'tZhTzM': '%z', 'tZhTzm': '%z', 'tZhtZM': '%z', 'tZhtZm': '%z', 'tZhtzM': '%z', 'tZhtzm': '%z', 'tzHTZM': '%z', 'tzHTZm': '%z', 'tzHTzM': '%z', 'tzHTzm': '%z', 'tzHtZM': '%z', 'tzHtZm': '%z', 'tzHtzM': '%z', 'tzHtzm': '%z', 'tzhTZM': '%z', 'tzhTZm': '%z', 'tzhTzM': '%z', 'tzhTzm': '%z', 'tzhtZM': '%z', 'tzhtZm': '%z', 'tzhtzM': '%z', 'tzhtzm': '%z', 'TZH:TZM': '%:z', 'TZH:TZm': '%:z', 'TZH:TzM': '%:z', 'TZH:Tzm': '%:z', 'TZH:tZM': '%:z', 'TZH:tZm': '%:z', 'TZH:tzM': '%:z', 'TZH:tzm': '%:z', 'TZh:TZM': '%:z', 'TZh:TZm': '%:z', 'TZh:TzM': '%:z', 'TZh:Tzm': '%:z', 'TZh:tZM': '%:z', 'TZh:tZm': '%:z', 'TZh:tzM': '%:z', 'TZh:tzm': '%:z', 'TzH:TZM': '%:z', 'TzH:TZm': '%:z', 'TzH:TzM': '%:z', 'TzH:Tzm': '%:z', 'TzH:tZM': '%:z', 'TzH:tZm': '%:z', 'TzH:tzM': '%:z', 'TzH:tzm': '%:z', 'Tzh:TZM': '%:z', 'Tzh:TZm': '%:z', 'Tzh:TzM': '%:z', 'Tzh:Tzm': '%:z', 'Tzh:tZM': '%:z', 'Tzh:tZm': '%:z', 'Tzh:tzM': '%:z', 'Tzh:tzm': '%:z', 'tZH:TZM': '%:z', 'tZH:TZm': '%:z', 'tZH:TzM': '%:z', 'tZH:Tzm': '%:z', 'tZH:tZM': '%:z', 'tZH:tZm': '%:z', 'tZH:tzM': '%:z', 'tZH:tzm': '%:z', 'tZh:TZM': '%:z', 'tZh:TZm': '%:z', 'tZh:TzM': '%:z', 'tZh:Tzm': '%:z', 'tZh:tZM': '%:z', 'tZh:tZm': '%:z', 'tZh:tzM': '%:z', 'tZh:tzm': '%:z', 'tzH:TZM': '%:z', 'tzH:TZm': '%:z', 'tzH:TzM': '%:z', 'tzH:Tzm': '%:z', 'tzH:tZM': '%:z', 'tzH:tZm': '%:z', 'tzH:tzM': '%:z', 'tzH:tzm': '%:z', 'tzh:TZM': '%:z', 'tzh:TZm': '%:z', 'tzh:TzM': '%:z', 'tzh:Tzm': '%:z', 'tzh:tZM': '%:z', 'tzh:tZm': '%:z', 'tzh:tzM': '%:z', 'tzh:tzm': '%:z', 'TZH': '%-z', 'TZh': '%-z', 'TzH': '%-z', 'Tzh': '%-z', 'tZH': '%-z', 'tZh': '%-z', 'tzH': '%-z', 'tzh': '%-z', 'AM': '%p', 'Am': '%p', 'aM': '%p', 'am': '%p', 'PM': '%p', 'Pm': '%p', 'pM': '%p', 'pm': '%p', '"T"': 'T'}

Associates this dialect's time formats with their equivalent Python strftime formats.

DATE_PART_MAPPING = {'Y': 'YEAR', 'YY': 'YEAR', 'YYY': 'YEAR', 'YYYY': 'YEAR', 'YR': 'YEAR', 'YEARS': 'YEAR', 'YRS': 'YEAR', 'MM': 'MONTH', 'MON': 'MONTH', 'MONS': 'MONTH', 'MONTHS': 'MONTH', 'D': 'DAY', 'DD': 'DAY', 'DAYS': 'DAY', 'DAYOFMONTH': 'DAY', 'DAY OF WEEK': 'DAYOFWEEK', 'WEEKDAY': 'DAYOFWEEK', 'DOW': 'DAYOFWEEK', 'DW': 'DAYOFWEEK', 'WEEKDAY_ISO': 'DAYOFWEEKISO', 'DOW_ISO': 'DAYOFWEEKISO', 'DW_ISO': 'DAYOFWEEKISO', 'DAYOFWEEK_ISO': 'DAYOFWEEKISO', 'DAY OF YEAR': 'DAYOFYEAR', 'DOY': 'DAYOFYEAR', 'DY': 'DAYOFYEAR', 'W': 'WEEK', 'WK': 'WEEK', 'WEEKOFYEAR': 'WEEK', 'WOY': 'WEEK', 'WY': 'WEEK', 'WEEK_ISO': 'WEEKISO', 'WEEKOFYEARISO': 'WEEKISO', 'WEEKOFYEAR_ISO': 'WEEKISO', 'Q': 'QUARTER', 'QTR': 'QUARTER', 'QTRS': 'QUARTER', 'QUARTERS': 'QUARTER', 'H': 'HOUR', 'HH': 'HOUR', 'HR': 'HOUR', 'HOURS': 'HOUR', 'HRS': 'HOUR', 'M': 'MINUTE', 'MI': 'MINUTE', 'MIN': 'MINUTE', 'MINUTES': 'MINUTE', 'MINS': 'MINUTE', 'S': 'SECOND', 'SEC': 'SECOND', 'SECONDS': 'SECOND', 'SECS': 'SECOND', 'MS': 'MILLISECOND', 'MSEC': 'MILLISECOND', 'MSECS': 'MILLISECOND', 'MSECOND': 'MILLISECOND', 'MSECONDS': 'MILLISECOND', 'MILLISEC': 'MILLISECOND', 'MILLISECS': 'MILLISECOND', 'MILLISECON': 'MILLISECOND', 'MILLISECONDS': 'MILLISECOND', 'US': 'MICROSECOND', 'USEC': 'MICROSECOND', 'USECS': 'MICROSECOND', 'MICROSEC': 'MICROSECOND', 'MICROSECS': 'MICROSECOND', 'USECOND': 'MICROSECOND', 'USECONDS': 'MICROSECOND', 'MICROSECONDS': 'MICROSECOND', 'NS': 'NANOSECOND', 'NSEC': 'NANOSECOND', 'NANOSEC': 'NANOSECOND', 'NSECOND': 'NANOSECOND', 'NSECONDS': 'NANOSECOND', 'NANOSECS': 'NANOSECOND', 'EPOCH_SECOND': 'EPOCH_SECOND', 'EPOCH_SECONDS': 'EPOCH_SECOND', 'EPOCH_MILLISECONDS': 'EPOCH_MILLISECOND', 'EPOCH_MICROSECONDS': 'EPOCH_MICROSECOND', 'EPOCH_NANOSECONDS': 'EPOCH_NANOSECOND', 'TZH': 'TIMEZONE_HOUR', 'TZM': 'TIMEZONE_MINUTE', 'DEC': 'DECADE', 'DECS': 'DECADE', 'DECADES': 'DECADE', 'MIL': 'MILLENNIUM', 'MILS': 'MILLENNIUM', 'MILLENIA': 'MILLENNIUM', 'C': 'CENTURY', 'CENT': 'CENTURY', 'CENTS': 'CENTURY', 'CENTURIES': 'CENTURY', 'ISOWEEK': 'WEEKISO'}
EXTRACT_DATE_PART_MAPPING: ClassVar[dict[str, str]] = {'ISOYEAR': 'YEAROFWEEKISO'}
PSEUDOCOLUMNS: set[str] = {'LEVEL'}

Columns that are auto-generated by the engine corresponding to this dialect. For example, such columns may be excluded from SELECT * queries.

def can_quote( self, identifier: sqlglot.expressions.core.Identifier, identify: str | bool = 'safe') -> bool:
120    def can_quote(self, identifier: exp.Identifier, identify: str | bool = "safe") -> bool:
121        # This disables quoting DUAL in SELECT ... FROM DUAL, because Snowflake treats an
122        # unquoted DUAL keyword in a special way and does not map it to a user-defined table
123        return super().can_quote(identifier, identify) and not (
124            isinstance(identifier.parent, exp.Table)
125            and not identifier.quoted
126            and identifier.name.lower() == "dual"
127        )

Checks if an identifier can be quoted

Arguments:
  • identifier: The identifier to check.
  • identify: True: Always returns True except for certain cases. "safe": Only returns True if the identifier is case-insensitive. "unsafe": Only returns True if the identifier is case-sensitive.
Returns:

Whether the given text can be identified.

SUPPORTS_COLUMN_JOIN_MARKS = True

Whether the old-style outer join (+) syntax is supported.

STRINGS_SUPPORT_ESCAPED_SEQUENCES: bool = True

Whether string literals support escape sequences (e.g. \n). Set by the metaclass based on the tokenizer's STRING_ESCAPES.

BYTE_STRINGS_SUPPORT_ESCAPED_SEQUENCES: bool = True

Whether byte string literals support escape sequences. Set by the metaclass based on the tokenizer's BYTE_STRING_ESCAPES.

IDENTIFIER_ESCAPED_SEQUENCES: dict[str, str] = {}

Mapping of an identifier escape char (\) to its escaped version (\\). Set by the metaclass based on the tokenizer's IDENTIFIER_ESCAPES.

tokenizer_class = <class 'Snowflake.Tokenizer'>
jsonpath_tokenizer_class = <class 'Snowflake.JSONPathTokenizer'>
TIME_TRIE: dict = {'Y': {'Y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}, 'y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}}, 'y': {'Y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}, 'y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}}, 'M': {'M': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'm': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'O': {'N': {0: True}, 'n': {0: True}}, 'o': {'N': {0: True}, 'n': {0: True}}, 'I': {0: True}, 'i': {0: True}}, 'm': {'M': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'm': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'O': {'N': {0: True}, 'n': {0: True}}, 'o': {'N': {0: True}, 'n': {0: True}}, 'I': {0: True}, 'i': {0: True}}, 'D': {'D': {0: True}, 'd': {0: True}, 'Y': {0: True}, 'y': {0: True}}, 'd': {'D': {0: True}, 'd': {0: True}, 'Y': {0: True}, 'y': {0: True}}, 'H': {'H': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}, 'h': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}}, 'h': {'H': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}, 'h': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}}, 'S': {'S': {0: True}, 's': {0: True}}, 's': {'S': {0: True}, 's': {0: True}}, 'F': {'F': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}, 'f': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}}, 'f': {'F': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}, 'f': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}}, 'T': {'Z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}, 'z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}}, 't': {'Z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}, 'z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}}, 'A': {'M': {0: True}, 'm': {0: True}}, 'a': {'M': {0: True}, 'm': {0: True}}, 'P': {'M': {0: True}, 'm': {0: True}}, 'p': {'M': {0: True}, 'm': {0: True}}, '"': {'T': {'"': {0: True}}}}
FORMAT_TRIE: dict = {'Y': {'Y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}, 'y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}}, 'y': {'Y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}, 'y': {'Y': {'Y': {0: True}, 'y': {0: True}}, 'y': {'Y': {0: True}, 'y': {0: True}}, 0: True}}, 'M': {'M': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'm': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'O': {'N': {0: True}, 'n': {0: True}}, 'o': {'N': {0: True}, 'n': {0: True}}, 'I': {0: True}, 'i': {0: True}}, 'm': {'M': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'm': {'M': {'M': {0: True}, 'm': {0: True}}, 'm': {'M': {0: True}, 'm': {0: True}}, 0: True}, 'O': {'N': {0: True}, 'n': {0: True}}, 'o': {'N': {0: True}, 'n': {0: True}}, 'I': {0: True}, 'i': {0: True}}, 'D': {'D': {0: True}, 'd': {0: True}, 'Y': {0: True}, 'y': {0: True}}, 'd': {'D': {0: True}, 'd': {0: True}, 'Y': {0: True}, 'y': {0: True}}, 'H': {'H': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}, 'h': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}}, 'h': {'H': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}, 'h': {'2': {'4': {0: True}}, '1': {'2': {0: True}}}}, 'S': {'S': {0: True}, 's': {0: True}}, 's': {'S': {0: True}, 's': {0: True}}, 'F': {'F': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}, 'f': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}}, 'f': {'F': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}, 'f': {0: True, '0': {0: True}, '1': {0: True}, '2': {0: True}, '3': {0: True}, '4': {0: True}, '5': {0: True}, '6': {0: True}, '7': {0: True}, '8': {0: True}, '9': {0: True}}}, 'T': {'Z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}, 'z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}}, 't': {'Z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}, 'z': {'H': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}, 'h': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, ':': {'T': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}, 't': {'Z': {'M': {0: True}, 'm': {0: True}}, 'z': {'M': {0: True}, 'm': {0: True}}}}, 0: True}}}, 'A': {'M': {0: True}, 'm': {0: True}}, 'a': {'M': {0: True}, 'm': {0: True}}, 'P': {'M': {0: True}, 'm': {0: True}}, 'p': {'M': {0: True}, 'm': {0: True}}, '"': {'T': {'"': {0: True}}}}
INVERSE_TIME_TRIE: dict = {'%': {'Y': {0: True}, 'y': {0: True}, 'B': {0: True}, 'b': {0: True}, 'm': {0: True, 's': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'd': {0: True, 's': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'a': {0: True}, 'H': {0: True, 's': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'I': {0: True, 's': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'M': {0: True, 's': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'S': {0: True, 's': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'f': {'_': {'n': {'i': {'n': {'e': {0: True}}}}, 'z': {'e': {'r': {'o': {0: True}}}}, 'o': {'n': {'e': {0: True}}}, 't': {'w': {'o': {0: True}}, 'h': {'r': {'e': {'e': {0: True}}}}}, 'f': {'o': {'u': {'r': {0: True}}}, 'i': {'v': {'e': {0: True}}}}, 's': {'e': {'v': {'e': {'n': {0: True}}}}}, 'e': {'i': {'g': {'h': {'t': {0: True}}}}}}, 0: True}, 'z': {0: True}, ':': {'z': {0: True}}, '-': {'z': {0: True}, 'd': {0: True}}, 'p': {0: True}}, 'T': {0: True}}
INVERSE_FORMAT_MAPPING: dict[str, str] = {'%mstrict': '%m', '%dstrict': '%d', '%Hstrict': '%H', '%Istrict': '%I', '%Mstrict': '%M', '%Sstrict': '%S'}
INVERSE_FORMAT_TRIE: dict = {'%': {'m': {'s': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'd': {'s': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'H': {'s': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'I': {'s': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'M': {'s': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}, 'S': {'s': {'t': {'r': {'i': {'c': {'t': {0: True}}}}}}}}}
INVERSE_CREATABLE_KIND_MAPPING: dict[str, str] = {}
ESCAPED_SEQUENCES: dict[str, str] = {'\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\\': '\\\\', '\x00': '\\x00', '\x01': '\\x01', '\x02': '\\x02', '\x03': '\\x03', '\x04': '\\x04', '\x05': '\\x05', '\x06': '\\x06', '\x07': '\\x07', '\x0b': '\\x0b', '\x0e': '\\x0e', '\x0f': '\\x0f', '\x10': '\\x10', '\x11': '\\x11', '\x12': '\\x12', '\x13': '\\x13', '\x14': '\\x14', '\x15': '\\x15', '\x16': '\\x16', '\x17': '\\x17', '\x18': '\\x18', '\x19': '\\x19', '\x1a': '\\x1a', '\x1b': '\\x1b', '\x1c': '\\x1c', '\x1d': '\\x1d', '\x1e': '\\x1e', '\x1f': '\\x1f', '\x7f': '\\x7f'}
QUOTE_START = "'"
QUOTE_END = "'"
IDENTIFIER_START = '"'
IDENTIFIER_END = '"'
VALID_INTERVAL_UNITS: set[str] = {'MM', 'SEC', 'DAYOFWEEK', 'H', 'YR', 'MILLENNIUM', 'WEEKDAY', 'DAY OF WEEK', 'MIL', 'DY', 'SECOND', 'NSECOND', 'MSECONDS', 'QUARTERS', 'NANOSECS', 'EPOCH', 'DEC', 'DECADE', 'CENTS', 'MILLISECON', 'DECADES', 'DAYOFWEEK_ISO', 'ISOWEEK', 'NS', 'MON', 'MINUTES', 'M', 'DAYOFMONTH', 'MILLISECOND', 'USECONDS', 'NANOSECOND', 'HRS', 'EPOCH_MILLISECOND', 'YEARS', 'WEEKOFYEAR', 'SECS', 'D', 'DW_ISO', 'MI', 'DOY', 'MILS', 'CENTURY', 'MILLISECS', 'NSEC', 'MONTH', 'DOW_ISO', 'DD', 'SECONDS', 'WK', 'EPOCH_NANOSECONDS', 'MICROSECOND', 'MICROSECS', 'YRS', 'TIMEZONE_HOUR', 'MSEC', 'US', 'EPOCH_SECOND', 'DAYOFWEEKISO', 'C', 'DAY', 'WOY', 'QUARTER', 'MILLENIA', 'HOUR', 'TIMEZONE_MINUTE', 'DAYOFYEAR', 'USECS', 'MS', 'NSECONDS', 'TZH', 'YEAR', 'Y', 'WEEK', 'DW', 'EPOCH_NANOSECOND', 'MSECOND', 'YYY', 'DAY OF YEAR', 'MONTHS', 'MINS', 'MILLISECONDS', 'MIN', 'EPOCH_MICROSECONDS', 'TZM', 'EPOCH_MICROSECOND', 'NANOSEC', 'MSECS', 'MILLISEC', 'EPOCH_MILLISECONDS', 'HOURS', 'WEEKISO', 'DECS', 'HR', 'WEEK_ISO', 'HH', 'USEC', 'Q', 'WEEKOFYEAR_ISO', 'CENT', 'QTRS', 'MINUTE', 'MONS', 'WY', 'YYYY', 'W', 'CENTURIES', 'DAYS', 'MICROSECONDS', 'MICROSEC', 'DOW', 'YY', 'QTR', 'EPOCH_SECONDS', 'WEEKOFYEARISO', 'WEEKDAY_ISO', 'USECOND', 'S'}
BIT_START: str | None = None
BIT_END: str | None = None
HEX_START: str | None = "x'"
HEX_END: str | None = "'"
BYTE_START: str | None = None
BYTE_END: str | None = None
UNICODE_START: str | None = None
UNICODE_END: str | None = None
class Snowflake.JSONPathTokenizer(sqlglot.jsonpath.JSONPathTokenizer):
129    class JSONPathTokenizer(jsonpath.JSONPathTokenizer):
130        SINGLE_TOKENS = jsonpath.JSONPathTokenizer.SINGLE_TOKENS.copy()
131        SINGLE_TOKENS.pop("$")
SINGLE_TOKENS = {'(': <TokenType.L_PAREN: 1>, ')': <TokenType.R_PAREN: 2>, '[': <TokenType.L_BRACKET: 3>, ']': <TokenType.R_BRACKET: 4>, ':': <TokenType.COLON: 11>, ',': <TokenType.COMMA: 7>, '-': <TokenType.DASH: 9>, '.': <TokenType.DOT: 8>, '?': <TokenType.PLACEHOLDER: 366>, '@': <TokenType.PARAMETER: 59>, "'": <TokenType.QUOTE: 379>, '"': <TokenType.QUOTE: 379>, '*': <TokenType.STAR: 20>}
class Snowflake.Tokenizer(sqlglot.tokens.Tokenizer):
135    class Tokenizer(tokens.Tokenizer):
136        STRING_ESCAPES = ["\\", "'"]
137        NUMERIC_ESCAPES = {"x": (16, 2, 2, 0xFF), "u": (16, 4, 4, 0xFFFF), "0": (8, 1, 3, 0xFF)}
138        DROP_UNKNOWN_ESCAPES = True
139        HEX_STRINGS = [("x'", "'"), ("X'", "'")]
140        RAW_STRINGS = ["$$"]
141        COMMENTS = ["--", "//", ("/*", "*/")]
142        NESTED_COMMENTS = False
143
144        KEYWORDS = {
145            **tokens.Tokenizer.KEYWORDS,
146            "(+)": TokenType.JOIN_MARKER,
147            "@": TokenType.STAGE_PATH,
148            "@~": TokenType.STAGE_PATH,
149            "BYTEINT": TokenType.INT,
150            "FILE://": TokenType.URI_START,
151            "FILE FORMAT": TokenType.FILE_FORMAT,
152            "GET": TokenType.GET,
153            "INTEGRATION": TokenType.INTEGRATION,
154            "LS": TokenType.LIST,
155            "MATCH_CONDITION": TokenType.MATCH_CONDITION,
156            "MATCH_RECOGNIZE": TokenType.MATCH_RECOGNIZE,
157            "MINUS": TokenType.EXCEPT,
158            "NCHAR VARYING": TokenType.VARCHAR,
159            "PACKAGE": TokenType.PACKAGE,
160            "POLICY": TokenType.POLICY,
161            "POOL": TokenType.POOL,
162            "PUT": TokenType.PUT,
163            "UNDROP": TokenType.UNDROP,
164            "REMOVE": TokenType.COMMAND,
165            "RM": TokenType.COMMAND,
166            "ROLE": TokenType.ROLE,
167            "RULE": TokenType.RULE,
168            "SAMPLE": TokenType.TABLE_SAMPLE,
169            "SEMANTIC VIEW": TokenType.SEMANTIC_VIEW,
170            "SQL_DOUBLE": TokenType.DOUBLE,
171            "SQL_VARCHAR": TokenType.VARCHAR,
172            "STAGE": TokenType.STAGE,
173            "STORAGE INTEGRATION": TokenType.STORAGE_INTEGRATION,
174            "STREAMLIT": TokenType.STREAMLIT,
175            "TAG": TokenType.TAG,
176            "TIMESTAMP_TZ": TokenType.TIMESTAMPTZ,
177            "TOP": TokenType.TOP,
178            "VOLUME": TokenType.VOLUME,
179            "WAREHOUSE": TokenType.WAREHOUSE,
180            # https://docs.snowflake.com/en/sql-reference/data-types-numeric#float
181            # FLOAT is a synonym for DOUBLE in Snowflake
182            "FLOAT": TokenType.DOUBLE,
183        }
184        KEYWORDS.pop("/*+")
185        KEYWORDS.pop("GLOB")
186        KEYWORDS.pop("RETURNING")
187
188        SINGLE_TOKENS = {
189            **tokens.Tokenizer.SINGLE_TOKENS,
190            "$": TokenType.PARAMETER,
191            "!": TokenType.EXCLAMATION,
192        }
193
194        VAR_SINGLE_TOKENS = {"$"}
195
196        # https://docs.snowflake.com/en/user-guide/querying-stage
197        UNQUOTED_PATH_TERMINATORS = {",", ";", "(", ")", "'", "`", "~", "<", ">", "|"}
198
199        COMMANDS = tokens.Tokenizer.COMMANDS - {TokenType.SHOW}
STRING_ESCAPES = ['\\', "'"]
NUMERIC_ESCAPES = {'x': (16, 2, 2, 255), 'u': (16, 4, 4, 65535), '0': (8, 1, 3, 255)}
DROP_UNKNOWN_ESCAPES = True
HEX_STRINGS = [("x'", "'"), ("X'", "'")]
RAW_STRINGS = ['$$']
COMMENTS = ['--', '//', ('/*', '*/')]
NESTED_COMMENTS = False
KEYWORDS = {'{%': <TokenType.BLOCK_START: 75>, '{%+': <TokenType.BLOCK_START: 75>, '{%-': <TokenType.BLOCK_START: 75>, '%}': <TokenType.BLOCK_END: 76>, '+%}': <TokenType.BLOCK_END: 76>, '-%}': <TokenType.BLOCK_END: 76>, '{{+': <TokenType.BLOCK_START: 75>, '{{-': <TokenType.BLOCK_START: 75>, '+}}': <TokenType.BLOCK_END: 76>, '-}}': <TokenType.BLOCK_END: 76>, '&<': <TokenType.AMP_LT: 64>, '&>': <TokenType.AMP_GT: 65>, '==': <TokenType.EQ: 28>, '::': <TokenType.DCOLON: 14>, '||': <TokenType.DPIPE: 37>, '|>': <TokenType.PIPE_GT: 38>, '>=': <TokenType.GTE: 26>, '<=': <TokenType.LTE: 24>, '<>': <TokenType.NEQ: 29>, '!=': <TokenType.NEQ: 29>, ':=': <TokenType.COLON_EQ: 31>, '<=>': <TokenType.NULLSAFE_EQ: 30>, '->': <TokenType.ARROW: 45>, '->>': <TokenType.DARROW: 46>, '=>': <TokenType.FARROW: 47>, '#>': <TokenType.HASH_ARROW: 49>, '#>>': <TokenType.DHASH_ARROW: 50>, '<->': <TokenType.LR_ARROW: 51>, '<<->>': <TokenType.LLRR_ARROW: 52>, '&&': <TokenType.DAMP: 63>, '??': <TokenType.DQMARK: 18>, '~~~': <TokenType.GLOB: 296>, '~~': <TokenType.LIKE: 327>, '~~*': <TokenType.ILIKE: 304>, '~*': <TokenType.IRLIKE: 316>, '-|-': <TokenType.ADJACENT: 66>, 'ALL': <TokenType.ALL: 227>, 'AND': <TokenType.AND: 34>, 'ANTI': <TokenType.ANTI: 228>, 'ANY': <TokenType.ANY: 229>, 'ASC': <TokenType.ASC: 232>, 'AS': <TokenType.ALIAS: 225>, 'ASOF': <TokenType.ASOF: 233>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 235>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 235>, 'BEGIN': <TokenType.BEGIN: 236>, 'BETWEEN': <TokenType.BETWEEN: 237>, 'CACHE': <TokenType.CACHE: 239>, 'UNCACHE': <TokenType.UNCACHE: 424>, 'CASE': <TokenType.CASE: 240>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 242>, 'COLLATE': <TokenType.COLLATE: 243>, 'COLUMN': <TokenType.COLUMN: 83>, 'COMMIT': <TokenType.COMMIT: 246>, 'CONNECT BY': <TokenType.CONNECT_BY: 248>, 'CONSTRAINT': <TokenType.CONSTRAINT: 249>, 'COPY': <TokenType.COPY: 250>, 'CREATE': <TokenType.CREATE: 251>, 'CROSS': <TokenType.CROSS: 252>, 'CUBE': <TokenType.CUBE: 253>, 'CURRENT_DATE': <TokenType.CURRENT_DATE: 254>, 'CURRENT_SCHEMA': <TokenType.CURRENT_SCHEMA: 256>, 'CURRENT_TIME': <TokenType.CURRENT_TIME: 257>, 'CURRENT_TIMESTAMP': <TokenType.CURRENT_TIMESTAMP: 258>, 'CURRENT_USER': <TokenType.CURRENT_USER: 259>, 'CURRENT_CATALOG': <TokenType.CURRENT_CATALOG: 262>, 'DATABASE': <TokenType.DATABASE: 82>, 'DEFAULT': <TokenType.DEFAULT: 264>, 'DELETE': <TokenType.DELETE: 265>, 'DESC': <TokenType.DESC: 266>, 'DESCRIBE': <TokenType.DESCRIBE: 267>, 'DISTINCT': <TokenType.DISTINCT: 271>, 'DISTRIBUTE BY': <TokenType.DISTRIBUTE_BY: 272>, 'DIV': <TokenType.DIV: 273>, 'DROP': <TokenType.DROP: 274>, 'ELSE': <TokenType.ELSE: 275>, 'END': <TokenType.END: 276>, 'ENUM': <TokenType.ENUM: 212>, 'ESCAPE': <TokenType.ESCAPE: 277>, 'EXCEPT': <TokenType.EXCEPT: 278>, 'EXECUTE': <TokenType.EXECUTE: 279>, 'EXISTS': <TokenType.EXISTS: 280>, 'FALSE': <TokenType.FALSE: 281>, 'FETCH': <TokenType.FETCH: 282>, 'FILTER': <TokenType.FILTER: 285>, 'FILE': <TokenType.FILE: 283>, 'FIRST': <TokenType.FIRST: 287>, 'FULL': <TokenType.FULL: 293>, 'FUNCTION': <TokenType.FUNCTION: 294>, 'FOR': <TokenType.FOR: 288>, 'FOREIGN KEY': <TokenType.FOREIGN_KEY: 290>, 'FORMAT': <TokenType.FORMAT: 291>, 'FROM': <TokenType.FROM: 292>, 'GEOGRAPHY': <TokenType.GEOGRAPHY: 177>, 'GEOMETRY': <TokenType.GEOMETRY: 180>, 'GROUP BY': <TokenType.GROUP_BY: 299>, 'GROUPING SETS': <TokenType.GROUPING_SETS: 300>, 'HAVING': <TokenType.HAVING: 301>, 'ILIKE': <TokenType.ILIKE: 304>, 'IN': <TokenType.IN: 305>, 'INDEX': <TokenType.INDEX: 306>, 'INET': <TokenType.INET: 207>, 'INNER': <TokenType.INNER: 308>, 'INSERT': <TokenType.INSERT: 309>, 'INTERVAL': <TokenType.INTERVAL: 313>, 'INTERSECT': <TokenType.INTERSECT: 312>, 'INTO': <TokenType.INTO: 314>, 'IS': <TokenType.IS: 317>, 'ISNULL': <TokenType.ISNULL: 318>, 'JOIN': <TokenType.JOIN: 319>, 'KEEP': <TokenType.KEEP: 321>, 'KILL': <TokenType.KILL: 323>, 'LATERAL': <TokenType.LATERAL: 325>, 'LEFT': <TokenType.LEFT: 326>, 'LIKE': <TokenType.LIKE: 327>, 'LIMIT': <TokenType.LIMIT: 328>, 'LOAD': <TokenType.LOAD: 330>, 'LOCALTIME': <TokenType.LOCALTIME: 185>, 'LOCALTIMESTAMP': <TokenType.LOCALTIMESTAMP: 186>, 'LOCK': <TokenType.LOCK: 331>, 'MERGE': <TokenType.MERGE: 337>, 'NAMESPACE': <TokenType.NAMESPACE: 451>, 'NATURAL': <TokenType.NATURAL: 340>, 'NEXT': <TokenType.NEXT: 341>, 'NOT': <TokenType.NOT: 27>, 'NOTNULL': <TokenType.NOTNULL: 343>, 'NULL': <TokenType.NULL: 344>, 'OBJECT': <TokenType.OBJECT: 205>, 'REF': <TokenType.REF: 206>, 'OFFSET': <TokenType.OFFSET: 346>, 'ON': <TokenType.ON: 347>, 'OR': <TokenType.OR: 35>, 'XOR': <TokenType.XOR: 67>, 'ORDER BY': <TokenType.ORDER_BY: 350>, 'ORDINALITY': <TokenType.ORDINALITY: 353>, 'OUT': <TokenType.OUT: 354>, 'OUTER': <TokenType.OUTER: 356>, 'OVER': <TokenType.OVER: 357>, 'OVERLAPS': <TokenType.OVERLAPS: 358>, 'OVERWRITE': <TokenType.OVERWRITE: 359>, 'PARTITION': <TokenType.PARTITION: 361>, 'PARTITION BY': <TokenType.PARTITION_BY: 362>, 'PARTITIONED BY': <TokenType.PARTITION_BY: 362>, 'PARTITIONED_BY': <TokenType.PARTITION_BY: 362>, 'PERCENT': <TokenType.PERCENT: 364>, 'PIVOT': <TokenType.PIVOT: 365>, 'PRAGMA': <TokenType.PRAGMA: 370>, 'PRIMARY KEY': <TokenType.PRIMARY_KEY: 372>, 'PROCEDURE': <TokenType.PROCEDURE: 373>, 'OPERATOR': <TokenType.OPERATOR: 349>, 'QUALIFY': <TokenType.QUALIFY: 378>, 'RANGE': <TokenType.RANGE: 381>, 'RECURSIVE': <TokenType.RECURSIVE: 382>, 'REGEXP': <TokenType.RLIKE: 390>, 'RENAME': <TokenType.RENAME: 384>, 'REPLACE': <TokenType.REPLACE: 385>, 'REFERENCES': <TokenType.REFERENCES: 388>, 'RIGHT': <TokenType.RIGHT: 389>, 'RLIKE': <TokenType.RLIKE: 390>, 'ROLLBACK': <TokenType.ROLLBACK: 392>, 'ROLLUP': <TokenType.ROLLUP: 393>, 'ROW': <TokenType.ROW: 394>, 'ROWS': <TokenType.ROWS: 395>, 'SCHEMA': <TokenType.SCHEMA: 85>, 'SELECT': <TokenType.SELECT: 397>, 'SEMI': <TokenType.SEMI: 398>, 'SESSION': <TokenType.SESSION: 60>, 'SESSION_USER': <TokenType.SESSION_USER: 62>, 'SET': <TokenType.SET: 402>, 'SETTINGS': <TokenType.SETTINGS: 403>, 'SHOW': <TokenType.SHOW: 404>, 'SIMILAR TO': <TokenType.SIMILAR_TO: 405>, 'SOME': <TokenType.SOME: 406>, 'SORT BY': <TokenType.SORT_BY: 407>, 'SQL SECURITY': <TokenType.SQL_SECURITY: 409>, 'STRAIGHT_JOIN': <TokenType.STRAIGHT_JOIN: 412>, 'TABLE': <TokenType.TABLE: 86>, 'TABLESAMPLE': <TokenType.TABLE_SAMPLE: 415>, 'TEMP': <TokenType.TEMPORARY: 417>, 'TEMPORARY': <TokenType.TEMPORARY: 417>, 'THEN': <TokenType.THEN: 419>, 'TRUE': <TokenType.TRUE: 420>, 'TRUNCATE': <TokenType.TRUNCATE: 421>, 'TRIGGER': <TokenType.TRIGGER: 422>, 'UNION': <TokenType.UNION: 426>, 'UNKNOWN': <TokenType.UNKNOWN: 221>, 'UNNEST': <TokenType.UNNEST: 427>, 'UNPIVOT': <TokenType.UNPIVOT: 428>, 'UPDATE': <TokenType.UPDATE: 429>, 'USE': <TokenType.USE: 430>, 'USING': <TokenType.USING: 431>, 'UUID': <TokenType.UUID: 176>, 'VALUES': <TokenType.VALUES: 432>, 'VIEW': <TokenType.VIEW: 434>, 'VOLATILE': <TokenType.VOLATILE: 436>, 'WHEN': <TokenType.WHEN: 438>, 'WHERE': <TokenType.WHERE: 439>, 'WINDOW': <TokenType.WINDOW: 440>, 'WITH': <TokenType.WITH: 441>, 'APPLY': <TokenType.APPLY: 230>, 'ARRAY': <TokenType.ARRAY: 231>, 'BIT': <TokenType.BIT: 102>, 'BOOL': <TokenType.BOOLEAN: 103>, 'BOOLEAN': <TokenType.BOOLEAN: 103>, 'BYTE': <TokenType.TINYINT: 104>, 'MEDIUMINT': <TokenType.MEDIUMINT: 108>, 'INT1': <TokenType.TINYINT: 104>, 'TINYINT': <TokenType.TINYINT: 104>, 'INT16': <TokenType.SMALLINT: 106>, 'SHORT': <TokenType.SMALLINT: 106>, 'SMALLINT': <TokenType.SMALLINT: 106>, 'HUGEINT': <TokenType.INT128: 115>, 'UHUGEINT': <TokenType.UINT128: 116>, 'INT2': <TokenType.SMALLINT: 106>, 'INTEGER': <TokenType.INT: 110>, 'INT': <TokenType.INT: 110>, 'INT4': <TokenType.INT: 110>, 'INT32': <TokenType.INT: 110>, 'INT64': <TokenType.BIGINT: 112>, 'INT128': <TokenType.INT128: 115>, 'INT256': <TokenType.INT256: 117>, 'LONG': <TokenType.BIGINT: 112>, 'BIGINT': <TokenType.BIGINT: 112>, 'INT8': <TokenType.TINYINT: 104>, 'UINT': <TokenType.UINT: 111>, 'UINT128': <TokenType.UINT128: 116>, 'UINT256': <TokenType.UINT256: 118>, 'DEC': <TokenType.DECIMAL: 122>, 'DECIMAL': <TokenType.DECIMAL: 122>, 'DECIMAL32': <TokenType.DECIMAL32: 123>, 'DECIMAL64': <TokenType.DECIMAL64: 124>, 'DECIMAL128': <TokenType.DECIMAL128: 125>, 'DECIMAL256': <TokenType.DECIMAL256: 126>, 'DECFLOAT': <TokenType.DECFLOAT: 127>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 129>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 129>, 'BIGNUM': <TokenType.BIGNUM: 114>, 'LIST': <TokenType.LIST: 329>, 'MAP': <TokenType.MAP: 332>, 'NULLABLE': <TokenType.NULLABLE: 179>, 'NUMBER': <TokenType.DECIMAL: 122>, 'NUMERIC': <TokenType.DECIMAL: 122>, 'FIXED': <TokenType.DECIMAL: 122>, 'REAL': <TokenType.FLOAT: 119>, 'FLOAT': <TokenType.DOUBLE: 120>, 'FLOAT4': <TokenType.FLOAT: 119>, 'FLOAT8': <TokenType.DOUBLE: 120>, 'DOUBLE': <TokenType.DOUBLE: 120>, 'DOUBLE PRECISION': <TokenType.DOUBLE: 120>, 'JSON': <TokenType.JSON: 146>, 'JSONB': <TokenType.JSONB: 147>, 'CHAR': <TokenType.CHAR: 130>, 'CHARACTER': <TokenType.CHAR: 130>, 'CHAR VARYING': <TokenType.VARCHAR: 132>, 'CHARACTER VARYING': <TokenType.VARCHAR: 132>, 'NCHAR': <TokenType.NCHAR: 131>, 'VARCHAR': <TokenType.VARCHAR: 132>, 'VARCHAR2': <TokenType.VARCHAR: 132>, 'NVARCHAR': <TokenType.NVARCHAR: 133>, 'NVARCHAR2': <TokenType.NVARCHAR: 133>, 'BPCHAR': <TokenType.BPCHAR: 134>, 'STR': <TokenType.TEXT: 135>, 'STRING': <TokenType.TEXT: 135>, 'TEXT': <TokenType.TEXT: 135>, 'LONGTEXT': <TokenType.LONGTEXT: 137>, 'MEDIUMTEXT': <TokenType.MEDIUMTEXT: 136>, 'TINYTEXT': <TokenType.TINYTEXT: 142>, 'CLOB': <TokenType.TEXT: 135>, 'LONGVARCHAR': <TokenType.TEXT: 135>, 'BINARY': <TokenType.BINARY: 144>, 'BLOB': <TokenType.VARBINARY: 145>, 'LONGBLOB': <TokenType.LONGBLOB: 140>, 'MEDIUMBLOB': <TokenType.MEDIUMBLOB: 139>, 'TINYBLOB': <TokenType.TINYBLOB: 141>, 'BYTEA': <TokenType.VARBINARY: 145>, 'VARBINARY': <TokenType.VARBINARY: 145>, 'TIME': <TokenType.TIME: 148>, 'TIMETZ': <TokenType.TIMETZ: 149>, 'TIME_NS': <TokenType.TIME_NS: 150>, 'TIMESTAMP': <TokenType.TIMESTAMP: 151>, 'TIMESTAMPTZ': <TokenType.TIMESTAMPTZ: 152>, 'TIMESTAMPLTZ': <TokenType.TIMESTAMPLTZ: 153>, 'TIMESTAMP_LTZ': <TokenType.TIMESTAMPLTZ: 153>, 'TIMESTAMPNTZ': <TokenType.TIMESTAMPNTZ: 154>, 'TIMESTAMP_NTZ': <TokenType.TIMESTAMPNTZ: 154>, 'DATE': <TokenType.DATE: 162>, 'DATETIME': <TokenType.DATETIME: 158>, 'INT4RANGE': <TokenType.INT4RANGE: 164>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 165>, 'INT8RANGE': <TokenType.INT8RANGE: 166>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 167>, 'NUMRANGE': <TokenType.NUMRANGE: 168>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 169>, 'TSRANGE': <TokenType.TSRANGE: 170>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 171>, 'TSTZRANGE': <TokenType.TSTZRANGE: 172>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 173>, 'DATERANGE': <TokenType.DATERANGE: 174>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 175>, 'UNIQUE': <TokenType.UNIQUE: 442>, 'VECTOR': <TokenType.VECTOR: 222>, 'STRUCT': <TokenType.STRUCT: 413>, 'SEQUENCE': <TokenType.SEQUENCE: 400>, 'VARIANT': <TokenType.VARIANT: 204>, 'ALTER': <TokenType.ALTER: 226>, 'ANALYZE': <TokenType.ANALYZE: 449>, 'CALL': <TokenType.COMMAND: 244>, 'COMMENT': <TokenType.COMMENT: 245>, 'EXPLAIN': <TokenType.COMMAND: 244>, 'GRANT': <TokenType.GRANT: 298>, 'REVOKE': <TokenType.REVOKE: 387>, 'OPTIMIZE': <TokenType.COMMAND: 244>, 'PREPARE': <TokenType.COMMAND: 244>, 'RELEASE': <TokenType.COMMAND: 244>, 'SAVEPOINT': <TokenType.COMMAND: 244>, 'VACUUM': <TokenType.COMMAND: 244>, 'USER-DEFINED': <TokenType.USERDEFINED: 199>, '(+)': <TokenType.JOIN_MARKER: 320>, '@': <TokenType.STAGE_PATH: 74>, '@~': <TokenType.STAGE_PATH: 74>, 'BYTEINT': <TokenType.INT: 110>, 'FILE://': <TokenType.URI_START: 73>, 'FILE FORMAT': <TokenType.FILE_FORMAT: 284>, 'GET': <TokenType.GET: 295>, 'INTEGRATION': <TokenType.INTEGRATION: 311>, 'LS': <TokenType.LIST: 329>, 'MATCH_CONDITION': <TokenType.MATCH_CONDITION: 334>, 'MATCH_RECOGNIZE': <TokenType.MATCH_RECOGNIZE: 335>, 'MINUS': <TokenType.EXCEPT: 278>, 'NCHAR VARYING': <TokenType.VARCHAR: 132>, 'PACKAGE': <TokenType.PACKAGE: 360>, 'POLICY': <TokenType.POLICY: 367>, 'POOL': <TokenType.POOL: 368>, 'PUT': <TokenType.PUT: 377>, 'UNDROP': <TokenType.UNDROP: 425>, 'REMOVE': <TokenType.COMMAND: 244>, 'RM': <TokenType.COMMAND: 244>, 'ROLE': <TokenType.ROLE: 391>, 'RULE': <TokenType.RULE: 396>, 'SAMPLE': <TokenType.TABLE_SAMPLE: 415>, 'SEMANTIC VIEW': <TokenType.SEMANTIC_VIEW: 435>, 'SQL_DOUBLE': <TokenType.DOUBLE: 120>, 'SQL_VARCHAR': <TokenType.VARCHAR: 132>, 'STAGE': <TokenType.STAGE: 88>, 'STORAGE INTEGRATION': <TokenType.STORAGE_INTEGRATION: 411>, 'STREAMLIT': <TokenType.STREAMLIT: 90>, 'TAG': <TokenType.TAG: 416>, 'TIMESTAMP_TZ': <TokenType.TIMESTAMPTZ: 152>, 'TOP': <TokenType.TOP: 418>, 'VOLUME': <TokenType.VOLUME: 437>, 'WAREHOUSE': <TokenType.WAREHOUSE: 87>}
SINGLE_TOKENS = {'(': <TokenType.L_PAREN: 1>, ')': <TokenType.R_PAREN: 2>, '[': <TokenType.L_BRACKET: 3>, ']': <TokenType.R_BRACKET: 4>, '{': <TokenType.L_BRACE: 5>, '}': <TokenType.R_BRACE: 6>, '&': <TokenType.AMP: 36>, '^': <TokenType.CARET: 42>, ':': <TokenType.COLON: 11>, ',': <TokenType.COMMA: 7>, '.': <TokenType.DOT: 8>, '-': <TokenType.DASH: 9>, '=': <TokenType.EQ: 28>, '>': <TokenType.GT: 25>, '<': <TokenType.LT: 23>, '%': <TokenType.MOD: 338>, '!': <TokenType.EXCLAMATION: 72>, '|': <TokenType.PIPE: 39>, '+': <TokenType.PLUS: 10>, ';': <TokenType.SEMICOLON: 19>, '/': <TokenType.SLASH: 22>, '\\': <TokenType.BACKSLASH: 21>, '*': <TokenType.STAR: 20>, '~': <TokenType.TILDE: 44>, '?': <TokenType.PLACEHOLDER: 366>, '@': <TokenType.PARAMETER: 59>, '#': <TokenType.HASH: 48>, "'": <TokenType.UNKNOWN: 221>, '`': <TokenType.UNKNOWN: 221>, '"': <TokenType.UNKNOWN: 221>, '$': <TokenType.PARAMETER: 59>}
VAR_SINGLE_TOKENS = {'$'}
UNQUOTED_PATH_TERMINATORS = {'`', "'", '(', '|', ')', '>', ',', '<', '~', ';'}
COMMANDS = {<TokenType.RENAME: 384>, <TokenType.FETCH: 282>, <TokenType.COMMAND: 244>, <TokenType.EXECUTE: 279>}
BYTE_STRING_ESCAPES: ClassVar[list[str]] = ['\\', "'"]