Edit on GitHub

# sqlglot.dialects.materialize

View Source

     1from __future__ import annotations
     2
     3from sqlglot import exp
     4from sqlglot.helper import seq_get
     5from sqlglot.dialects.postgres import Postgres
     6
     7from sqlglot.tokens import TokenType
     8from sqlglot.transforms import (
     9    remove_unique_constraints,
    10    ctas_with_tmp_tables_to_create_tmp_view,
    11    preprocess,
    12)
    13import typing as t
    14
    15
    16class Materialize(Postgres):
    17    class Parser(Postgres.Parser):
    18        NO_PAREN_FUNCTION_PARSERS = {
    19            **Postgres.Parser.NO_PAREN_FUNCTION_PARSERS,
    20            "MAP": lambda self: self._parse_map(),
    21        }
    22
    23        LAMBDAS = {
    24            **Postgres.Parser.LAMBDAS,
    25            TokenType.FARROW: lambda self, expressions: self.expression(
    26                exp.Kwarg, this=seq_get(expressions, 0), expression=self._parse_assignment()
    27            ),
    28        }
    29
    30        def _parse_lambda_arg(self) -> t.Optional[exp.Expression]:
    31            return self._parse_field()
    32
    33        def _parse_map(self) -> exp.ToMap:
    34            if self._match(TokenType.L_PAREN):
    35                to_map = self.expression(exp.ToMap, this=self._parse_select())
    36                self._match_r_paren()
    37                return to_map
    38
    39            if not self._match(TokenType.L_BRACKET):
    40                self.raise_error("Expecting [")
    41
    42            entries = [
    43                exp.PropertyEQ(this=e.this, expression=e.expression)
    44                for e in self._parse_csv(self._parse_lambda)
    45            ]
    46
    47            if not self._match(TokenType.R_BRACKET):
    48                self.raise_error("Expecting ]")
    49
    50            return self.expression(exp.ToMap, this=self.expression(exp.Struct, expressions=entries))
    51
    52    class Generator(Postgres.Generator):
    53        SUPPORTS_CREATE_TABLE_LIKE = False
    54
    55        TRANSFORMS = {
    56            **Postgres.Generator.TRANSFORMS,
    57            exp.AutoIncrementColumnConstraint: lambda self, e: "",
    58            exp.Create: preprocess(
    59                [
    60                    remove_unique_constraints,
    61                    ctas_with_tmp_tables_to_create_tmp_view,
    62                ]
    63            ),
    64            exp.GeneratedAsIdentityColumnConstraint: lambda self, e: "",
    65            exp.OnConflict: lambda self, e: "",
    66            exp.PrimaryKeyColumnConstraint: lambda self, e: "",
    67        }
    68        TRANSFORMS.pop(exp.ToMap)
    69
    70        def propertyeq_sql(self, expression: exp.PropertyEQ) -> str:
    71            return self.binary(expression, "=>")
    72
    73        def datatype_sql(self, expression: exp.DataType) -> str:
    74            if expression.is_type(exp.DataType.Type.LIST):
    75                if expression.expressions:
    76                    return f"{self.expressions(expression, flat=True)} LIST"
    77                return "LIST"
    78
    79            if expression.is_type(exp.DataType.Type.MAP) and len(expression.expressions) == 2:
    80                key, value = expression.expressions
    81                return f"MAP[{self.sql(key)} => {self.sql(value)}]"
    82
    83            return super().datatype_sql(expression)
    84
    85        def list_sql(self, expression: exp.List) -> str:
    86            if isinstance(seq_get(expression.expressions, 0), exp.Select):
    87                return self.func("LIST", seq_get(expression.expressions, 0))
    88
    89            return f"{self.normalize_func('LIST')}[{self.expressions(expression, flat=True)}]"
    90
    91        def tomap_sql(self, expression: exp.ToMap) -> str:
    92            if isinstance(expression.this, exp.Select):
    93                return self.func("MAP", expression.this)
    94            return f"{self.normalize_func('MAP')}[{self.expressions(expression.this)}]"

class Materialize(sqlglot.dialects.postgres.Postgres): View Source

    17class Materialize(Postgres):
    18    class Parser(Postgres.Parser):
    19        NO_PAREN_FUNCTION_PARSERS = {
    20            **Postgres.Parser.NO_PAREN_FUNCTION_PARSERS,
    21            "MAP": lambda self: self._parse_map(),
    22        }
    23
    24        LAMBDAS = {
    25            **Postgres.Parser.LAMBDAS,
    26            TokenType.FARROW: lambda self, expressions: self.expression(
    27                exp.Kwarg, this=seq_get(expressions, 0), expression=self._parse_assignment()
    28            ),
    29        }
    30
    31        def _parse_lambda_arg(self) -> t.Optional[exp.Expression]:
    32            return self._parse_field()
    33
    34        def _parse_map(self) -> exp.ToMap:
    35            if self._match(TokenType.L_PAREN):
    36                to_map = self.expression(exp.ToMap, this=self._parse_select())
    37                self._match_r_paren()
    38                return to_map
    39
    40            if not self._match(TokenType.L_BRACKET):
    41                self.raise_error("Expecting [")
    42
    43            entries = [
    44                exp.PropertyEQ(this=e.this, expression=e.expression)
    45                for e in self._parse_csv(self._parse_lambda)
    46            ]
    47
    48            if not self._match(TokenType.R_BRACKET):
    49                self.raise_error("Expecting ]")
    50
    51            return self.expression(exp.ToMap, this=self.expression(exp.Struct, expressions=entries))
    52
    53    class Generator(Postgres.Generator):
    54        SUPPORTS_CREATE_TABLE_LIKE = False
    55
    56        TRANSFORMS = {
    57            **Postgres.Generator.TRANSFORMS,
    58            exp.AutoIncrementColumnConstraint: lambda self, e: "",
    59            exp.Create: preprocess(
    60                [
    61                    remove_unique_constraints,
    62                    ctas_with_tmp_tables_to_create_tmp_view,
    63                ]
    64            ),
    65            exp.GeneratedAsIdentityColumnConstraint: lambda self, e: "",
    66            exp.OnConflict: lambda self, e: "",
    67            exp.PrimaryKeyColumnConstraint: lambda self, e: "",
    68        }
    69        TRANSFORMS.pop(exp.ToMap)
    70
    71        def propertyeq_sql(self, expression: exp.PropertyEQ) -> str:
    72            return self.binary(expression, "=>")
    73
    74        def datatype_sql(self, expression: exp.DataType) -> str:
    75            if expression.is_type(exp.DataType.Type.LIST):
    76                if expression.expressions:
    77                    return f"{self.expressions(expression, flat=True)} LIST"
    78                return "LIST"
    79
    80            if expression.is_type(exp.DataType.Type.MAP) and len(expression.expressions) == 2:
    81                key, value = expression.expressions
    82                return f"MAP[{self.sql(key)} => {self.sql(value)}]"
    83
    84            return super().datatype_sql(expression)
    85
    86        def list_sql(self, expression: exp.List) -> str:
    87            if isinstance(seq_get(expression.expressions, 0), exp.Select):
    88                return self.func("LIST", seq_get(expression.expressions, 0))
    89
    90            return f"{self.normalize_func('LIST')}[{self.expressions(expression, flat=True)}]"
    91
    92        def tomap_sql(self, expression: exp.ToMap) -> str:
    93            if isinstance(expression.this, exp.Select):
    94                return self.func("MAP", expression.this)
    95            return f"{self.normalize_func('MAP')}[{self.expressions(expression.this)}]"

SUPPORTS_COLUMN_JOIN_MARKS = False

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

tokenizer_class = <class 'sqlglot.tokens.Tokenizer'>
jsonpath_tokenizer_class = <class 'sqlglot.tokens.JSONPathTokenizer'>
parser_class = <class 'Materialize.Parser'>
generator_class = <class 'Materialize.Generator'>
TIME_TRIE: Dict = {'A': {'M': {0: True}}, 'P': {'M': {0: True}}, 'D': {0: True, 'D': {0: True, 'D': {0: True}}}, 'F': {'M': {'D': {'D': {0: True, 'D': {0: True}}}, 'H': {'H': {'1': {'2': {0: True}}, '2': {'4': {0: True}}}}, 'M': {'I': {0: True}, 'M': {0: True}}, 'S': {'S': {0: True}}}}, 'H': {'H': {'1': {'2': {0: True}}, '2': {'4': {0: True}}}}, 'M': {'I': {0: True}, 'M': {0: True}}, 'O': {'F': {0: True}}, 'S': {'S': {0: True}}, 'T': {'M': {'D': {'a': {'y': {0: True}}, 'y': {0: True}}, 'M': {'o': {'n': {0: True, 't': {'h': {0: True}}}}}}, 'Z': {0: True}}, 'U': {'S': {0: True}}, 'W': {'W': {0: True}}, 'Y': {'Y': {0: True, 'Y': {'Y': {0: True}}}}}
FORMAT_TRIE: Dict = {'A': {'M': {0: True}}, 'P': {'M': {0: True}}, 'D': {0: True, 'D': {0: True, 'D': {0: True}}}, 'F': {'M': {'D': {'D': {0: True, 'D': {0: True}}}, 'H': {'H': {'1': {'2': {0: True}}, '2': {'4': {0: True}}}}, 'M': {'I': {0: True}, 'M': {0: True}}, 'S': {'S': {0: True}}}}, 'H': {'H': {'1': {'2': {0: True}}, '2': {'4': {0: True}}}}, 'M': {'I': {0: True}, 'M': {0: True}}, 'O': {'F': {0: True}}, 'S': {'S': {0: True}}, 'T': {'M': {'D': {'a': {'y': {0: True}}, 'y': {0: True}}, 'M': {'o': {'n': {0: True, 't': {'h': {0: True}}}}}}, 'Z': {0: True}}, 'U': {'S': {0: True}}, 'W': {'W': {0: True}}, 'Y': {'Y': {0: True, 'Y': {'Y': {0: True}}}}}
INVERSE_TIME_MAPPING: Dict[str, str] = {'%p': 'PM', '%u': 'D', '%d': 'DD', '%j': 'DDD', '%-d': 'FMDD', '%-j': 'FMDDD', '%-I': 'FMHH12', '%-H': 'FMHH24', '%-M': 'FMMI', '%-m': 'FMMM', '%-S': 'FMSS', '%I': 'HH12', '%H': 'HH24', '%M': 'MI', '%m': 'MM', '%z': 'OF', '%S': 'SS', '%A': 'TMDay', '%a': 'TMDy', '%b': 'TMMon', '%B': 'TMMonth', '%Z': 'TZ', '%f': 'US', '%U': 'WW', '%y': 'YY', '%Y': 'YYYY'}
INVERSE_TIME_TRIE: Dict = {'%': {'p': {0: True}, 'u': {0: True}, 'd': {0: True}, 'j': {0: True}, '-': {'d': {0: True}, 'j': {0: True}, 'I': {0: True}, 'H': {0: True}, 'M': {0: True}, 'm': {0: True}, 'S': {0: True}}, 'I': {0: True}, 'H': {0: True}, 'M': {0: True}, 'm': {0: True}, 'z': {0: True}, 'S': {0: True}, 'A': {0: True}, 'a': {0: True}, 'b': {0: True}, 'B': {0: True}, 'Z': {0: True}, 'f': {0: True}, 'U': {0: True}, 'y': {0: True}, 'Y': {0: True}}}
INVERSE_FORMAT_MAPPING: Dict[str, str] = {}
INVERSE_FORMAT_TRIE: Dict = {}
INVERSE_CREATABLE_KIND_MAPPING: dict[str, str] = {}
ESCAPED_SEQUENCES: Dict[str, str] = {}
QUOTE_START = "'"
QUOTE_END = "'"
IDENTIFIER_START = '"'
IDENTIFIER_END = '"'
BIT_START: Optional[str] = "b'"
BIT_END: Optional[str] = "'"
HEX_START: Optional[str] = "x'"
HEX_END: Optional[str] = "'"
BYTE_START: Optional[str] = "e'"
BYTE_END: Optional[str] = "'"
UNICODE_START: Optional[str] = None
UNICODE_END: Optional[str] = None

##### Inherited Members

sqlglot.dialects.dialect.Dialect
  Dialect
  WEEK_OFFSET
  UNNEST_COLUMN_ONLY
  ALIAS_POST_TABLESAMPLE
  NORMALIZATION_STRATEGY
  IDENTIFIERS_CAN_START_WITH_DIGIT
  DPIPE_IS_STRING_CONCAT
  STRICT_STRING_CONCAT
  SUPPORTS_USER_DEFINED_TYPES
  SUPPORTS_SEMI_ANTI_JOIN
  COPY_PARAMS_ARE_CSV
  NORMALIZE_FUNCTIONS
  PRESERVE_ORIGINAL_NAMES
  LOG_BASE_FIRST
  SAFE_DIVISION
  HEX_LOWERCASE
  DATE_FORMAT
  DATEINT_FORMAT
  FORMAT_MAPPING
  UNESCAPED_SEQUENCES
  PSEUDOCOLUMNS
  PREFER_CTE_ALIAS_COLUMN
  FORCE_EARLY_ALIAS_REF_EXPANSION
  EXPAND_ALIAS_REFS_EARLY_ONLY_IN_GROUP_BY
  SUPPORTS_ORDER_BY_ALL
  HAS_DISTINCT_ARRAY_CONSTRUCTORS
  SUPPORTS_FIXED_SIZE_ARRAYS
  STRICT_JSON_PATH_SYNTAX
  ON_CONDITION_EMPTY_BEFORE_ERROR
  ARRAY_AGG_INCLUDES_NULLS
  PROMOTE_TO_INFERRED_DATETIME_TYPE
  SUPPORTS_VALUES_DEFAULT
  NUMBERS_CAN_BE_UNDERSCORE_SEPARATED
  REGEXP_EXTRACT_DEFAULT_GROUP
  SET_OP_DISTINCT_BY_DEFAULT
  CREATABLE_KIND_MAPPING
  DATE_PART_MAPPING
  TYPE_TO_EXPRESSIONS
  ANNOTATORS
  get_or_raise
  format_time
  settings
  normalize_identifier
  case_sensitive
  can_identify
  quote_identifier
  to_json_path
  parse
  parse_into
  generate
  transpile
  tokenize
  tokenizer
  jsonpath_tokenizer
  parser
  generator
sqlglot.dialects.postgres.Postgres
  INDEX_OFFSET
  TYPED_DIVISION
  CONCAT_COALESCE
  NULL_ORDERING
  TIME_FORMAT
  TABLESAMPLE_SIZE_IS_PERCENT
  TIME_MAPPING
  Tokenizer

class Materialize.Parser(sqlglot.dialects.postgres.Postgres.Parser): View Source

    18    class Parser(Postgres.Parser):
    19        NO_PAREN_FUNCTION_PARSERS = {
    20            **Postgres.Parser.NO_PAREN_FUNCTION_PARSERS,
    21            "MAP": lambda self: self._parse_map(),
    22        }
    23
    24        LAMBDAS = {
    25            **Postgres.Parser.LAMBDAS,
    26            TokenType.FARROW: lambda self, expressions: self.expression(
    27                exp.Kwarg, this=seq_get(expressions, 0), expression=self._parse_assignment()
    28            ),
    29        }
    30
    31        def _parse_lambda_arg(self) -> t.Optional[exp.Expression]:
    32            return self._parse_field()
    33
    34        def _parse_map(self) -> exp.ToMap:
    35            if self._match(TokenType.L_PAREN):
    36                to_map = self.expression(exp.ToMap, this=self._parse_select())
    37                self._match_r_paren()
    38                return to_map
    39
    40            if not self._match(TokenType.L_BRACKET):
    41                self.raise_error("Expecting [")
    42
    43            entries = [
    44                exp.PropertyEQ(this=e.this, expression=e.expression)
    45                for e in self._parse_csv(self._parse_lambda)
    46            ]
    47
    48            if not self._match(TokenType.R_BRACKET):
    49                self.raise_error("Expecting ]")
    50
    51            return self.expression(exp.ToMap, this=self.expression(exp.Struct, expressions=entries))

Parser consumes a list of tokens produced by the Tokenizer and produces a parsed syntax tree.

###### Arguments:

- error_level: The desired error level. Default: ErrorLevel.IMMEDIATE
- error_message_context: The amount of context to capture from a query string when displaying the error message (in number of characters). Default: 100
- max_errors: Maximum number of error messages to include in a raised ParseError. This is only relevant if error_level is ErrorLevel.RAISE. Default: 3

NO_PAREN_FUNCTION_PARSERS = {'ANY': <function Parser.<lambda>>, 'CASE': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <function Parser.<lambda>>, 'IF': <function Parser.<lambda>>, 'MAP': <function Materialize.Parser.<lambda>>}
LAMBDAS = {<TokenType.ARROW: 'ARROW'>: <function Parser.<lambda>>, <TokenType.FARROW: 'FARROW'>: <function Materialize.Parser.<lambda>>}
ID_VAR_TOKENS = {<TokenType.NEXT: 'NEXT'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.ROW: 'ROW'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.POINT: 'POINT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.CASE: 'CASE'>, <TokenType.TIME: 'TIME'>, <TokenType.LOAD: 'LOAD'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.ASC: 'ASC'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.MODEL: 'MODEL'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SET: 'SET'>, <TokenType.VIEW: 'VIEW'>, <TokenType.INT: 'INT'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.FULL: 'FULL'>, <TokenType.JSON: 'JSON'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.COPY: 'COPY'>, <TokenType.BINARY: 'BINARY'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.INT128: 'INT128'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.TOP: 'TOP'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.UINT256: 'UINT256'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.RENAME: 'RENAME'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.NAME: 'NAME'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.MONEY: 'MONEY'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.ANY: 'ANY'>, <TokenType.RING: 'RING'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.DATE: 'DATE'>, <TokenType.NULL: 'NULL'>, <TokenType.LEFT: 'LEFT'>, <TokenType.FIRST: 'FIRST'>, <TokenType.KILL: 'KILL'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.DIV: 'DIV'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.CUBE: 'CUBE'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.UINT: 'UINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.VAR: 'VAR'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.SOME: 'SOME'>, <TokenType.ANTI: 'ANTI'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.IPV4: 'IPV4'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.INET: 'INET'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.FALSE: 'FALSE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.DETACH: 'DETACH'>, <TokenType.YEAR: 'YEAR'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.UINT128: 'UINT128'>, <TokenType.TEXT: 'TEXT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.ENUM: 'ENUM'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.ASOF: 'ASOF'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.INDEX: 'INDEX'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.USE: 'USE'>, <TokenType.TAG: 'TAG'>, <TokenType.CACHE: 'CACHE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.LIST: 'LIST'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DESC: 'DESC'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.END: 'END'>, <TokenType.XML: 'XML'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.FILTER: 'FILTER'>, <TokenType.SEMI: 'SEMI'>, <TokenType.IS: 'IS'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.NESTED: 'NESTED'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.BIT: 'BIT'>, <TokenType.INT256: 'INT256'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.FINAL: 'FINAL'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.SUPER: 'SUPER'>, <TokenType.SINK: 'SINK'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.RANGE: 'RANGE'>, <TokenType.ALL: 'ALL'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.MAP: 'MAP'>}
TABLE_ALIAS_TOKENS = {<TokenType.NEXT: 'NEXT'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.ROW: 'ROW'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.POINT: 'POINT'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.CASE: 'CASE'>, <TokenType.TIME: 'TIME'>, <TokenType.LOAD: 'LOAD'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.ASC: 'ASC'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.MODEL: 'MODEL'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SET: 'SET'>, <TokenType.VIEW: 'VIEW'>, <TokenType.INT: 'INT'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.JSON: 'JSON'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.COPY: 'COPY'>, <TokenType.BINARY: 'BINARY'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.INT128: 'INT128'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.TOP: 'TOP'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.UINT256: 'UINT256'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.RENAME: 'RENAME'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.NAME: 'NAME'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.MONEY: 'MONEY'>, <TokenType.DATE32: 'DATE32'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.ANY: 'ANY'>, <TokenType.RING: 'RING'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.DATE: 'DATE'>, <TokenType.NULL: 'NULL'>, <TokenType.FIRST: 'FIRST'>, <TokenType.KILL: 'KILL'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.DIV: 'DIV'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.CUBE: 'CUBE'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.UINT: 'UINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.VAR: 'VAR'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.SOME: 'SOME'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.IPV4: 'IPV4'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.INET: 'INET'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.FALSE: 'FALSE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.DETACH: 'DETACH'>, <TokenType.YEAR: 'YEAR'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.UINT128: 'UINT128'>, <TokenType.TEXT: 'TEXT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TRUE: 'TRUE'>, <TokenType.ENUM: 'ENUM'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.INDEX: 'INDEX'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.USE: 'USE'>, <TokenType.TAG: 'TAG'>, <TokenType.CACHE: 'CACHE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.LIST: 'LIST'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DESC: 'DESC'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.END: 'END'>, <TokenType.XML: 'XML'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.FILTER: 'FILTER'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.IS: 'IS'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.NESTED: 'NESTED'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.BIT: 'BIT'>, <TokenType.INT256: 'INT256'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.FINAL: 'FINAL'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.SUPER: 'SUPER'>, <TokenType.SINK: 'SINK'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.RANGE: 'RANGE'>, <TokenType.ALL: 'ALL'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.UUID: 'UUID'>, <TokenType.ROWS: 'ROWS'>, <TokenType.MAP: 'MAP'>}
SHOW_TRIE: Dict = {}
SET_TRIE: Dict = {'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}}

##### Inherited Members

sqlglot.parser.Parser
  Parser
  NO_PAREN_FUNCTIONS
  STRUCT_TYPE_TOKENS
  NESTED_TYPE_TOKENS
  ENUM_TYPE_TOKENS
  AGGREGATE_TYPE_TOKENS
  TYPE_TOKENS
  SIGNED_TO_UNSIGNED_TYPE_TOKEN
  SUBQUERY_PREDICATES
  RESERVED_TOKENS
  DB_CREATABLES
  CREATABLES
  ALTERABLES
  INTERVAL_VARS
  ALIAS_TOKENS
  ARRAY_CONSTRUCTORS
  COMMENT_TABLE_ALIAS_TOKENS
  UPDATE_ALIAS_TOKENS
  TRIM_TYPES
  FUNC_TOKENS
  CONJUNCTION
  ASSIGNMENT
  DISJUNCTION
  EQUALITY
  COMPARISON
  TERM
  FACTOR
  TIMES
  TIMESTAMPS
  SET_OPERATIONS
  JOIN_METHODS
  JOIN_SIDES
  JOIN_KINDS
  JOIN_HINTS
  EXPRESSION_PARSERS
  UNARY_PARSERS
  STRING_PARSERS
  NUMERIC_PARSERS
  PRIMARY_PARSERS
  PLACEHOLDER_PARSERS
  CONSTRAINT_PARSERS
  ALTER_PARSERS
  ALTER_ALTER_PARSERS
  SCHEMA_UNNAMED_CONSTRAINTS
  INVALID_FUNC_NAME_TOKENS
  FUNCTIONS_WITH_ALIASED_ARGS
  KEY_VALUE_DEFINITIONS
  QUERY_MODIFIER_PARSERS
  SET_PARSERS
  SHOW_PARSERS
  TYPE_LITERAL_PARSERS
  TYPE_CONVERTERS
  DDL_SELECT_TOKENS
  PRE_VOLATILE_TOKENS
  TRANSACTION_KIND
  TRANSACTION_CHARACTERISTICS
  CONFLICT_ACTIONS
  CREATE_SEQUENCE
  ISOLATED_LOADING_OPTIONS
  USABLES
  CAST_ACTIONS
  SCHEMA_BINDING_OPTIONS
  PROCEDURE_OPTIONS
  EXECUTE_AS_OPTIONS
  KEY_CONSTRAINT_OPTIONS
  INSERT_ALTERNATIVES
  CLONE_KEYWORDS
  HISTORICAL_DATA_PREFIX
  HISTORICAL_DATA_KIND
  OPCLASS_FOLLOW_KEYWORDS
  OPTYPE_FOLLOW_TOKENS
  TABLE_INDEX_HINT_TOKENS
  VIEW_ATTRIBUTES
  WINDOW_ALIAS_TOKENS
  WINDOW_BEFORE_PAREN_TOKENS
  WINDOW_SIDES
  JSON_KEY_VALUE_SEPARATOR_TOKENS
  FETCH_TOKENS
  ADD_CONSTRAINT_TOKENS
  DISTINCT_TOKENS
  NULL_TOKENS
  UNNEST_OFFSET_ALIAS_TOKENS
  SELECT_START_TOKENS
  COPY_INTO_VARLEN_OPTIONS
  IS_JSON_PREDICATE_KIND
  ODBC_DATETIME_LITERALS
  ON_CONDITION_TOKENS
  PRIVILEGE_FOLLOW_TOKENS
  DESCRIBE_STYLES
  ANALYZE_STYLES
  ANALYZE_EXPRESSION_PARSERS
  PARTITION_KEYWORDS
  AMBIGUOUS_ALIAS_TOKENS
  OPERATION_MODIFIERS
  STRICT_CAST
  PREFIXED_PIVOT_COLUMNS
  IDENTIFY_PIVOT_STRINGS
  LOG_DEFAULTS_TO_LN
  ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN
  TABLESAMPLE_CSV
  DEFAULT_SAMPLING_METHOD
  SET_REQUIRES_ASSIGNMENT_DELIMITER
  TRIM_PATTERN_FIRST
  STRING_ALIASES
  MODIFIERS_ATTACHED_TO_SET_OP
  SET_OP_MODIFIERS
  NO_PAREN_IF_COMMANDS
  COLON_IS_VARIANT_EXTRACT
  VALUES_FOLLOWED_BY_PAREN
  SUPPORTS_IMPLICIT_UNNEST
  INTERVAL_SPANS
  SUPPORTS_PARTITION_SELECTION
  WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
  OPTIONAL_ALIAS_TOKEN_CTE
  error_level
  error_message_context
  max_errors
  dialect
  reset
  parse
  parse_into
  check_errors
  raise_error
  expression
  validate_expression
  errors
  sql
sqlglot.dialects.postgres.Postgres.Parser
  PROPERTY_PARSERS
  FUNCTIONS
  FUNCTION_PARSERS
  BITWISE
  EXPONENT
  RANGE_PARSERS
  STATEMENT_PARSERS
  JSON_ARROWS_REQUIRE_JSON_TYPE
  COLUMN_OPERATORS

class Materialize.Generator(sqlglot.dialects.postgres.Postgres.Generator): View Source

    53    class Generator(Postgres.Generator):
    54        SUPPORTS_CREATE_TABLE_LIKE = False
    55
    56        TRANSFORMS = {
    57            **Postgres.Generator.TRANSFORMS,
    58            exp.AutoIncrementColumnConstraint: lambda self, e: "",
    59            exp.Create: preprocess(
    60                [
    61                    remove_unique_constraints,
    62                    ctas_with_tmp_tables_to_create_tmp_view,
    63                ]
    64            ),
    65            exp.GeneratedAsIdentityColumnConstraint: lambda self, e: "",
    66            exp.OnConflict: lambda self, e: "",
    67            exp.PrimaryKeyColumnConstraint: lambda self, e: "",
    68        }
    69        TRANSFORMS.pop(exp.ToMap)
    70
    71        def propertyeq_sql(self, expression: exp.PropertyEQ) -> str:
    72            return self.binary(expression, "=>")
    73
    74        def datatype_sql(self, expression: exp.DataType) -> str:
    75            if expression.is_type(exp.DataType.Type.LIST):
    76                if expression.expressions:
    77                    return f"{self.expressions(expression, flat=True)} LIST"
    78                return "LIST"
    79
    80            if expression.is_type(exp.DataType.Type.MAP) and len(expression.expressions) == 2:
    81                key, value = expression.expressions
    82                return f"MAP[{self.sql(key)} => {self.sql(value)}]"
    83
    84            return super().datatype_sql(expression)
    85
    86        def list_sql(self, expression: exp.List) -> str:
    87            if isinstance(seq_get(expression.expressions, 0), exp.Select):
    88                return self.func("LIST", seq_get(expression.expressions, 0))
    89
    90            return f"{self.normalize_func('LIST')}[{self.expressions(expression, flat=True)}]"
    91
    92        def tomap_sql(self, expression: exp.ToMap) -> str:
    93            if isinstance(expression.this, exp.Select):
    94                return self.func("MAP", expression.this)
    95            return f"{self.normalize_func('MAP')}[{self.expressions(expression.this)}]"

Generator converts a given syntax tree to the corresponding SQL string.

###### Arguments:

- pretty: Whether to format the produced SQL string. Default: False.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
- normalize: Whether to normalize identifiers to lowercase. Default: False.
- pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
- indent: The indentation size in a formatted string. For example, this affects the indentation of subqueries and filters under a `WHERE` clause. Default: 2.
- normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
- unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
- max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
- leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
- max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
- comments: Whether to preserve comments in the output SQL code. Default: True

SUPPORTS_CREATE_TABLE_LIKE = False
TRANSFORMS = {<class 'sqlglot.expressions.JSONPathKey'>: <function json_path_key_only_name>, <class 'sqlglot.expressions.JSONPathRoot'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeColumns'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeWith'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayContainsAll'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayOverlaps'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Ceil'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Except'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Floor'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Intersect'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Int64'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Union'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingData'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Uuid'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnyValue'>: <function any_value_to_max_sql>, <class 'sqlglot.expressions.ArrayConcat'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.ArrayFilter'>: <function filter_array_using_unnest>, <class 'sqlglot.expressions.BitwiseXor'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.ColumnDef'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.CurrentDate'>: <function no_paren_current_date_sql>, <class 'sqlglot.expressions.CurrentTimestamp'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.CurrentUser'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.DateAdd'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.DateDiff'>: <function _date_diff_sql>, <class 'sqlglot.expressions.DateStrToDate'>: <function datestrtodate_sql>, <class 'sqlglot.expressions.DateSub'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.Explode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ExplodingGenerateSeries'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.GroupConcat'>: <function _string_agg_sql>, <class 'sqlglot.expressions.IntDiv'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.JSONExtract'>: <function _json_extract_sql.<locals>._generate>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function _json_extract_sql.<locals>._generate>, <class 'sqlglot.expressions.JSONBExtract'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.JSONBExtractScalar'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContains'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.ParseJSON'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.LastDay'>: <function no_last_day_sql>, <class 'sqlglot.expressions.LogicalOr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.LogicalAnd'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Max'>: <function max_or_greatest>, <class 'sqlglot.expressions.MapFromEntries'>: <function no_map_from_entries_sql>, <class 'sqlglot.expressions.Min'>: <function min_or_least>, <class 'sqlglot.expressions.Merge'>: <function merge_without_target_sql>, <class 'sqlglot.expressions.PartitionedByProperty'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.PercentileCont'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.PercentileDisc'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Pow'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.RegexpLike'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.RegexpILike'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.SHA2'>: <function sha256_sql>, <class 'sqlglot.expressions.StrPosition'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.StrToDate'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.StrToTime'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.StructExtract'>: <function struct_extract_sql>, <class 'sqlglot.expressions.Substring'>: <function _substring_sql>, <class 'sqlglot.expressions.TimeFromParts'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimestampFromParts'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimestampTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.TimeStrToTime'>: <function timestrtotime_sql>, <class 'sqlglot.expressions.TimeToStr'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.ToChar'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.Trim'>: <function trim_sql>, <class 'sqlglot.expressions.TryCast'>: <function no_trycast_sql>, <class 'sqlglot.expressions.TsOrDsAdd'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.TsOrDsDiff'>: <function _date_diff_sql>, <class 'sqlglot.expressions.UnixToTime'>: <function _unix_to_time_sql>, <class 'sqlglot.expressions.TimeToUnix'>: <function Postgres.Generator.<lambda>>, <class 'sqlglot.expressions.VariancePop'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Variance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Xor'>: <function bool_xor_sql>, <class 'sqlglot.expressions.Unicode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Levenshtein'>: <function _levenshtein_sql>, <class 'sqlglot.expressions.AutoIncrementColumnConstraint'>: <function Materialize.Generator.<lambda>>, <class 'sqlglot.expressions.Create'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.GeneratedAsIdentityColumnConstraint'>: <function Materialize.Generator.<lambda>>, <class 'sqlglot.expressions.OnConflict'>: <function Materialize.Generator.<lambda>>, <class 'sqlglot.expressions.PrimaryKeyColumnConstraint'>: <function Materialize.Generator.<lambda>>}
def propertyeq_sql(self, expression: sqlglot.expressions.PropertyEQ) -> str: View Source

    71        def propertyeq_sql(self, expression: exp.PropertyEQ) -> str:
    72            return self.binary(expression, "=>")

def datatype_sql(self, expression: sqlglot.expressions.DataType) -> str: View Source

    74        def datatype_sql(self, expression: exp.DataType) -> str:
    75            if expression.is_type(exp.DataType.Type.LIST):
    76                if expression.expressions:
    77                    return f"{self.expressions(expression, flat=True)} LIST"
    78                return "LIST"
    79
    80            if expression.is_type(exp.DataType.Type.MAP) and len(expression.expressions) == 2:
    81                key, value = expression.expressions
    82                return f"MAP[{self.sql(key)} => {self.sql(value)}]"
    83
    84            return super().datatype_sql(expression)

def list_sql(self, expression: sqlglot.expressions.List) -> str: View Source

    86        def list_sql(self, expression: exp.List) -> str:
    87            if isinstance(seq_get(expression.expressions, 0), exp.Select):
    88                return self.func("LIST", seq_get(expression.expressions, 0))
    89
    90            return f"{self.normalize_func('LIST')}[{self.expressions(expression, flat=True)}]"

def tomap_sql(self, expression: sqlglot.expressions.ToMap) -> str: View Source

    92        def tomap_sql(self, expression: exp.ToMap) -> str:
    93            if isinstance(expression.this, exp.Select):
    94                return self.func("MAP", expression.this)
    95            return f"{self.normalize_func('MAP')}[{self.expressions(expression.this)}]"

SELECT_KINDS: Tuple[str, ...] = ()
TRY_SUPPORTED = False
SUPPORTS_UESCAPE = False
AFTER_HAVING_MODIFIER_TRANSFORMS = {'windows': <function Generator.<lambda>>, 'qualify': <function Generator.<lambda>>}

##### Inherited Members

sqlglot.generator.Generator
  Generator
  NULL_ORDERING_SUPPORTED
  IGNORE_NULLS_IN_FUNC
  EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE
  WRAP_DERIVED_VALUES
  CREATE_FUNCTION_RETURN_AS
  MATCHED_BY_SOURCE
  INTERVAL_ALLOWS_PLURAL_FORM
  LIMIT_FETCH
  LIMIT_ONLY_LITERALS
  GROUPINGS_SEP
  INDEX_ON
  QUERY_HINT_SEP
  IS_BOOL_ALLOWED
  DUPLICATE_KEY_UPDATE_WITH_SET
  LIMIT_IS_TOP
  RETURNING_END
  EXTRACT_ALLOWS_QUOTES
  TZ_TO_WITH_TIME_ZONE
  VALUES_AS_TABLE
  ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
  UNNEST_WITH_ORDINALITY
  AGGREGATE_FILTER_SUPPORTED
  SEMI_ANTI_JOIN_WITH_SIDE
  COMPUTED_COLUMN_WITH_TYPE
  SUPPORTS_TABLE_COPY
  TABLESAMPLE_REQUIRES_PARENS
  TABLESAMPLE_KEYWORDS
  TABLESAMPLE_WITH_METHOD
  COLLATE_IS_FUNC
  DATA_TYPE_SPECIFIERS_ALLOWED
  ENSURE_BOOLS
  CTE_RECURSIVE_KEYWORD_REQUIRED
  SUPPORTS_SINGLE_ARG_CONCAT
  LAST_DAY_SUPPORTS_DATE_PART
  SUPPORTS_TABLE_ALIAS_COLUMNS
  UNPIVOT_ALIASES_ARE_IDENTIFIERS
  JSON_KEY_VALUE_PAIR_SEP
  INSERT_OVERWRITE
  JSON_PATH_BRACKETED_KEY_SUPPORTED
  JSON_PATH_SINGLE_QUOTE_ESCAPE
  SUPPORTS_TO_NUMBER
  SET_OP_MODIFIERS
  COPY_PARAMS_ARE_WRAPPED
  COPY_PARAMS_EQ_REQUIRED
  STAR_EXCEPT
  HEX_FUNC
  WITH_PROPERTIES_PREFIX
  QUOTE_JSON_PATH
  PAD_FILL_PATTERN_IS_REQUIRED
  SUPPORTS_EXPLODING_PROJECTIONS
  SUPPORTS_CONVERT_TIMEZONE
  SUPPORTS_UNIX_SECONDS
  PARSE_JSON_NAME
  ARRAY_SIZE_NAME
  TIME_PART_SINGULARS
  TOKEN_MAPPING
  STRUCT_DELIMITER
  NAMED_PLACEHOLDER_TOKEN
  EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
  RESERVED_KEYWORDS
  WITH_SEPARATED_COMMENTS
  EXCLUDE_COMMENTS
  UNWRAPPED_INTERVAL_VALUES
  PARAMETERIZABLE_TEXT_TYPES
  EXPRESSIONS_WITHOUT_NESTED_CTES
  SENTINEL_LINE_BREAK
  pretty
  identify
  normalize
  pad
  unsupported_level
  max_unsupported
  leading_comma
  max_text_width
  comments
  dialect
  normalize_functions
  unsupported_messages
  generate
  preprocess
  unsupported
  sep
  seg
  pad_comment
  maybe_comment
  wrap
  no_identify
  normalize_func
  indent
  sql
  uncache_sql
  cache_sql
  characterset_sql
  column_parts
  column_sql
  columnposition_sql
  columndef_sql
  columnconstraint_sql
  autoincrementcolumnconstraint_sql
  compresscolumnconstraint_sql
  generatedasidentitycolumnconstraint_sql
  generatedasrowcolumnconstraint_sql
  periodforsystemtimeconstraint_sql
  notnullcolumnconstraint_sql
  transformcolumnconstraint_sql
  primarykeycolumnconstraint_sql
  uniquecolumnconstraint_sql
  createable_sql
  create_sql
  sequenceproperties_sql
  clone_sql
  describe_sql
  heredoc_sql
  prepend_ctes
  with_sql
  cte_sql
  tablealias_sql
  bitstring_sql
  hexstring_sql
  bytestring_sql
  unicodestring_sql
  rawstring_sql
  datatypeparam_sql
  directory_sql
  delete_sql
  drop_sql
  set_operation
  set_operations
  fetch_sql
  filter_sql
  hint_sql
  indexparameters_sql
  index_sql
  identifier_sql
  hex_sql
  lowerhex_sql
  inputoutputformat_sql
  national_sql
  partition_sql
  properties_sql
  root_properties
  properties
  with_properties
  locate_properties
  property_name
  property_sql
  likeproperty_sql
  fallbackproperty_sql
  journalproperty_sql
  freespaceproperty_sql
  checksumproperty_sql
  mergeblockratioproperty_sql
  datablocksizeproperty_sql
  blockcompressionproperty_sql
  isolatedloadingproperty_sql
  partitionboundspec_sql
  partitionedofproperty_sql
  lockingproperty_sql
  withdataproperty_sql
  withsystemversioningproperty_sql
  insert_sql
  introducer_sql
  kill_sql
  pseudotype_sql
  objectidentifier_sql
  onconflict_sql
  returning_sql
  rowformatdelimitedproperty_sql
  withtablehint_sql
  indextablehint_sql
  historicaldata_sql
  table_parts
  table_sql
  tablesample_sql
  pivot_sql
  version_sql
  tuple_sql
  update_sql
  values_sql
  var_sql
  into_sql
  from_sql
  groupingsets_sql
  rollup_sql
  cube_sql
  group_sql
  having_sql
  connect_sql
  prior_sql
  join_sql
  lambda_sql
  lateral_op
  lateral_sql
  limit_sql
  offset_sql
  setitem_sql
  set_sql
  pragma_sql
  lock_sql
  literal_sql
  escape_str
  loaddata_sql
  null_sql
  boolean_sql
  order_sql
  withfill_sql
  cluster_sql
  distribute_sql
  sort_sql
  ordered_sql
  matchrecognizemeasure_sql
  matchrecognize_sql
  query_modifiers
  options_modifier
  queryoption_sql
  offset_limit_modifiers
  after_limit_modifiers
  select_sql
  schema_sql
  schema_columns_sql
  star_sql
  parameter_sql
  sessionparameter_sql
  placeholder_sql
  subquery_sql
  qualify_sql
  prewhere_sql
  where_sql
  window_sql
  partition_by_sql
  windowspec_sql
  withingroup_sql
  between_sql
  bracket_offset_expressions
  all_sql
  any_sql
  exists_sql
  case_sql
  constraint_sql
  nextvaluefor_sql
  extract_sql
  trim_sql
  convert_concat_args
  concat_sql
  concatws_sql
  check_sql
  foreignkey_sql
  primarykey_sql
  if_sql
  jsonkeyvalue_sql
  jsonpath_sql
  json_path_part
  formatjson_sql
  jsonobject_sql
  jsonobjectagg_sql
  jsonarray_sql
  jsonarrayagg_sql
  jsoncolumndef_sql
  jsonschema_sql
  jsontable_sql
  openjsoncolumndef_sql
  openjson_sql
  in_sql
  in_unnest_op
  interval_sql
  return_sql
  reference_sql
  anonymous_sql
  paren_sql
  neg_sql
  not_sql
  alias_sql
  pivotalias_sql
  aliases_sql
  atindex_sql
  attimezone_sql
  fromtimezone_sql
  add_sql
  and_sql
  or_sql
  xor_sql
  connector_sql
  bitwiseand_sql
  bitwiseleftshift_sql
  bitwisenot_sql
  bitwiseor_sql
  bitwiserightshift_sql
  bitwisexor_sql
  currentdate_sql
  collate_sql
  command_sql
  comment_sql
  mergetreettlaction_sql
  mergetreettl_sql
  transaction_sql
  commit_sql
  rollback_sql
  altercolumn_sql
  alterdiststyle_sql
  altersortkey_sql
  alterrename_sql
  renamecolumn_sql
  alter_sql
  add_column_sql
  droppartition_sql
  addconstraint_sql
  distinct_sql
  ignorenulls_sql
  respectnulls_sql
  havingmax_sql
  intdiv_sql
  dpipe_sql
  div_sql
  safedivide_sql
  overlaps_sql
  distance_sql
  dot_sql
  eq_sql
  escape_sql
  glob_sql
  gt_sql
  gte_sql
  ilike_sql
  ilikeany_sql
  is_sql
  like_sql
  likeany_sql
  similarto_sql
  lt_sql
  lte_sql
  mod_sql
  mul_sql
  neq_sql
  nullsafeeq_sql
  nullsafeneq_sql
  slice_sql
  sub_sql
  trycast_sql
  try_sql
  log_sql
  use_sql
  binary
  ceil_floor
  function_fallback_sql
  func
  format_args
  too_wide
  format_time
  expressions
  op_expressions
  naked_property
  tag_sql
  token_sql
  userdefinedfunction_sql
  joinhint_sql
  kwarg_sql
  when_sql
  whens_sql
  merge_sql
  tochar_sql
  tonumber_sql
  dictproperty_sql
  dictrange_sql
  dictsubproperty_sql
  duplicatekeyproperty_sql
  uniquekeyproperty_sql
  distributedbyproperty_sql
  oncluster_sql
  clusteredbyproperty_sql
  anyvalue_sql
  querytransform_sql
  indexconstraintoption_sql
  checkcolumnconstraint_sql
  indexcolumnconstraint_sql
  nvl2_sql
  comprehension_sql
  columnprefix_sql
  opclass_sql
  predict_sql
  forin_sql
  refresh_sql
  toarray_sql
  tsordstotime_sql
  tsordstotimestamp_sql
  tsordstodatetime_sql
  tsordstodate_sql
  unixdate_sql
  lastday_sql
  dateadd_sql
  arrayany_sql
  struct_sql
  partitionrange_sql
  truncatetable_sql
  convert_sql
  copyparameter_sql
  credentials_sql
  copy_sql
  semicolon_sql
  datadeletionproperty_sql
  maskingpolicycolumnconstraint_sql
  gapfill_sql
  scope_resolution
  scoperesolution_sql
  parsejson_sql
  rand_sql
  changes_sql
  pad_sql
  summarize_sql
  explodinggenerateseries_sql
  arrayconcat_sql
  converttimezone_sql
  json_sql
  jsonvalue_sql
  conditionalinsert_sql
  multitableinserts_sql
  oncondition_sql
  jsonextractquote_sql
  jsonexists_sql
  arrayagg_sql
  apply_sql
  grant_sql
  grantprivilege_sql
  grantprincipal_sql
  columns_sql
  overlay_sql
  todouble_sql
  string_sql
  median_sql
  overflowtruncatebehavior_sql
  unixseconds_sql
  arraysize_sql
  attach_sql
  detach_sql
  attachoption_sql
  featuresattime_sql
  watermarkcolumnconstraint_sql
  encodeproperty_sql
  includeproperty_sql
  xmlelement_sql
  partitionbyrangeproperty_sql
  partitionbyrangepropertydynamic_sql
  unpivotcolumns_sql
  analyzesample_sql
  analyzestatistics_sql
  analyzehistogram_sql
  analyzedelete_sql
  analyzelistchainedrows_sql
  analyzevalidate_sql
  analyze_sql
  xmltable_sql
  xmlnamespace_sql
sqlglot.dialects.postgres.Postgres.Generator
  SINGLE_STRING_INTERVAL
  RENAME_TABLE_WITH_DB
  LOCKING_READS_SUPPORTED
  JOIN_HINTS
  TABLE_HINTS
  QUERY_HINTS
  NVL2_SUPPORTED
  PARAMETER_TOKEN
  TABLESAMPLE_SIZE_IS_ROWS
  TABLESAMPLE_SEED_KEYWORD
  SUPPORTS_SELECT_INTO
  JSON_TYPE_REQUIRED_FOR_EXTRACTION
  SUPPORTS_UNLOGGED_TABLES
  LIKE_PROPERTY_INSIDE_SCHEMA
  MULTI_ARG_DISTINCT
  CAN_IMPLEMENT_ARRAY_ANY
  COPY_HAS_INTO_KEYWORD
  ARRAY_CONCAT_IS_VAR_LEN
  SUPPORTS_MEDIAN
  ARRAY_SIZE_DIM_REQUIRED
  SUPPORTED_JSON_PATH_PARTS
  TYPE_MAPPING
  PROPERTIES_LOCATION
  schemacommentproperty_sql
  commentcolumnconstraint_sql
  unnest_sql
  bracket_sql
  matchagainst_sql
  alterset_sql
  cast_sql
  array_sql
  computedcolumnconstraint_sql
  isascii_sql