Edit on GitHub

# sqlglot.dialects.redshift

View Source

      1from __future__ import annotations
      2
      3import typing as t
      4
      5from sqlglot import exp, transforms
      6from sqlglot.dialects.dialect import rename_func
      7from sqlglot.dialects.postgres import Postgres
      8from sqlglot.helper import seq_get
      9from sqlglot.tokens import TokenType
     10
     11
     12class Redshift(Postgres):
     13    time_format = "'YYYY-MM-DD HH:MI:SS'"
     14    time_mapping = {
     15        **Postgres.time_mapping,  # type: ignore
     16        "MON": "%b",
     17        "HH": "%H",
     18    }
     19
     20    class Parser(Postgres.Parser):
     21        FUNCTIONS = {
     22            **Postgres.Parser.FUNCTIONS,  # type: ignore
     23            "DATEDIFF": lambda args: exp.DateDiff(
     24                this=seq_get(args, 2),
     25                expression=seq_get(args, 1),
     26                unit=seq_get(args, 0),
     27            ),
     28            "DECODE": exp.Matches.from_arg_list,
     29            "NVL": exp.Coalesce.from_arg_list,
     30        }
     31
     32        def _parse_types(self, check_func: bool = False) -> t.Optional[exp.Expression]:
     33            this = super()._parse_types(check_func=check_func)
     34
     35            if (
     36                isinstance(this, exp.DataType)
     37                and this.this == exp.DataType.Type.VARCHAR
     38                and this.expressions
     39                and this.expressions[0] == exp.column("MAX")
     40            ):
     41                this.set("expressions", [exp.Var(this="MAX")])
     42
     43            return this
     44
     45    class Tokenizer(Postgres.Tokenizer):
     46        STRING_ESCAPES = ["\\"]
     47
     48        KEYWORDS = {
     49            **Postgres.Tokenizer.KEYWORDS,  # type: ignore
     50            "GEOMETRY": TokenType.GEOMETRY,
     51            "GEOGRAPHY": TokenType.GEOGRAPHY,
     52            "HLLSKETCH": TokenType.HLLSKETCH,
     53            "SUPER": TokenType.SUPER,
     54            "TIME": TokenType.TIMESTAMP,
     55            "TIMETZ": TokenType.TIMESTAMPTZ,
     56            "UNLOAD": TokenType.COMMAND,
     57            "VARBYTE": TokenType.VARBINARY,
     58        }
     59
     60    class Generator(Postgres.Generator):
     61        TYPE_MAPPING = {
     62            **Postgres.Generator.TYPE_MAPPING,  # type: ignore
     63            exp.DataType.Type.BINARY: "VARBYTE",
     64            exp.DataType.Type.VARBINARY: "VARBYTE",
     65            exp.DataType.Type.INT: "INTEGER",
     66        }
     67
     68        PROPERTIES_LOCATION = {
     69            **Postgres.Generator.PROPERTIES_LOCATION,  # type: ignore
     70            exp.LikeProperty: exp.Properties.Location.POST_WITH,
     71        }
     72
     73        TRANSFORMS = {
     74            **Postgres.Generator.TRANSFORMS,  # type: ignore
     75            **transforms.ELIMINATE_DISTINCT_ON,  # type: ignore
     76            exp.DateDiff: lambda self, e: self.func(
     77                "DATEDIFF", e.args.get("unit") or "day", e.expression, e.this
     78            ),
     79            exp.DistKeyProperty: lambda self, e: f"DISTKEY({e.name})",
     80            exp.SortKeyProperty: lambda self, e: f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})",
     81            exp.DistStyleProperty: lambda self, e: self.naked_property(e),
     82            exp.Matches: rename_func("DECODE"),
     83        }
     84
     85        def values_sql(self, expression: exp.Values) -> str:
     86            """
     87            Converts `VALUES...` expression into a series of unions.
     88
     89            Note: If you have a lot of unions then this will result in a large number of recursive statements to
     90            evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be
     91            very slow.
     92            """
     93            if not isinstance(expression.unnest().parent, exp.From):
     94                return super().values_sql(expression)
     95            rows = [tuple_exp.expressions for tuple_exp in expression.expressions]
     96            selects = []
     97            for i, row in enumerate(rows):
     98                if i == 0 and expression.alias:
     99                    row = [
    100                        exp.alias_(value, column_name)
    101                        for value, column_name in zip(row, expression.args["alias"].args["columns"])
    102                    ]
    103                selects.append(exp.Select(expressions=row))
    104            subquery_expression = selects[0]
    105            if len(selects) > 1:
    106                for select in selects[1:]:
    107                    subquery_expression = exp.union(subquery_expression, select, distinct=False)
    108            return self.subquery_sql(subquery_expression.subquery(expression.alias))
    109
    110        def with_properties(self, properties: exp.Properties) -> str:
    111            """Redshift doesn't have `WITH` as part of their with_properties so we remove it"""
    112            return self.properties(properties, prefix=" ", suffix="")
    113
    114        def renametable_sql(self, expression: exp.RenameTable) -> str:
    115            """Redshift only supports defining the table name itself (not the db) when renaming tables"""
    116            expression = expression.copy()
    117            target_table = expression.this
    118            for arg in target_table.args:
    119                if arg != "this":
    120                    target_table.set(arg, None)
    121            this = self.sql(expression, "this")
    122            return f"RENAME TO {this}"
    123
    124        def datatype_sql(self, expression: exp.DataType) -> str:
    125            """
    126            Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
    127            VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
    128            without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
    129            `TEXT` to `VARCHAR`.
    130            """
    131            if expression.this == exp.DataType.Type.TEXT:
    132                expression = expression.copy()
    133                expression.set("this", exp.DataType.Type.VARCHAR)
    134                precision = expression.args.get("expressions")
    135                if not precision:
    136                    expression.append("expressions", exp.Var(this="MAX"))
    137            return super().datatype_sql(expression)

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

     13class Redshift(Postgres):
     14    time_format = "'YYYY-MM-DD HH:MI:SS'"
     15    time_mapping = {
     16        **Postgres.time_mapping,  # type: ignore
     17        "MON": "%b",
     18        "HH": "%H",
     19    }
     20
     21    class Parser(Postgres.Parser):
     22        FUNCTIONS = {
     23            **Postgres.Parser.FUNCTIONS,  # type: ignore
     24            "DATEDIFF": lambda args: exp.DateDiff(
     25                this=seq_get(args, 2),
     26                expression=seq_get(args, 1),
     27                unit=seq_get(args, 0),
     28            ),
     29            "DECODE": exp.Matches.from_arg_list,
     30            "NVL": exp.Coalesce.from_arg_list,
     31        }
     32
     33        def _parse_types(self, check_func: bool = False) -> t.Optional[exp.Expression]:
     34            this = super()._parse_types(check_func=check_func)
     35
     36            if (
     37                isinstance(this, exp.DataType)
     38                and this.this == exp.DataType.Type.VARCHAR
     39                and this.expressions
     40                and this.expressions[0] == exp.column("MAX")
     41            ):
     42                this.set("expressions", [exp.Var(this="MAX")])
     43
     44            return this
     45
     46    class Tokenizer(Postgres.Tokenizer):
     47        STRING_ESCAPES = ["\\"]
     48
     49        KEYWORDS = {
     50            **Postgres.Tokenizer.KEYWORDS,  # type: ignore
     51            "GEOMETRY": TokenType.GEOMETRY,
     52            "GEOGRAPHY": TokenType.GEOGRAPHY,
     53            "HLLSKETCH": TokenType.HLLSKETCH,
     54            "SUPER": TokenType.SUPER,
     55            "TIME": TokenType.TIMESTAMP,
     56            "TIMETZ": TokenType.TIMESTAMPTZ,
     57            "UNLOAD": TokenType.COMMAND,
     58            "VARBYTE": TokenType.VARBINARY,
     59        }
     60
     61    class Generator(Postgres.Generator):
     62        TYPE_MAPPING = {
     63            **Postgres.Generator.TYPE_MAPPING,  # type: ignore
     64            exp.DataType.Type.BINARY: "VARBYTE",
     65            exp.DataType.Type.VARBINARY: "VARBYTE",
     66            exp.DataType.Type.INT: "INTEGER",
     67        }
     68
     69        PROPERTIES_LOCATION = {
     70            **Postgres.Generator.PROPERTIES_LOCATION,  # type: ignore
     71            exp.LikeProperty: exp.Properties.Location.POST_WITH,
     72        }
     73
     74        TRANSFORMS = {
     75            **Postgres.Generator.TRANSFORMS,  # type: ignore
     76            **transforms.ELIMINATE_DISTINCT_ON,  # type: ignore
     77            exp.DateDiff: lambda self, e: self.func(
     78                "DATEDIFF", e.args.get("unit") or "day", e.expression, e.this
     79            ),
     80            exp.DistKeyProperty: lambda self, e: f"DISTKEY({e.name})",
     81            exp.SortKeyProperty: lambda self, e: f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})",
     82            exp.DistStyleProperty: lambda self, e: self.naked_property(e),
     83            exp.Matches: rename_func("DECODE"),
     84        }
     85
     86        def values_sql(self, expression: exp.Values) -> str:
     87            """
     88            Converts `VALUES...` expression into a series of unions.
     89
     90            Note: If you have a lot of unions then this will result in a large number of recursive statements to
     91            evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be
     92            very slow.
     93            """
     94            if not isinstance(expression.unnest().parent, exp.From):
     95                return super().values_sql(expression)
     96            rows = [tuple_exp.expressions for tuple_exp in expression.expressions]
     97            selects = []
     98            for i, row in enumerate(rows):
     99                if i == 0 and expression.alias:
    100                    row = [
    101                        exp.alias_(value, column_name)
    102                        for value, column_name in zip(row, expression.args["alias"].args["columns"])
    103                    ]
    104                selects.append(exp.Select(expressions=row))
    105            subquery_expression = selects[0]
    106            if len(selects) > 1:
    107                for select in selects[1:]:
    108                    subquery_expression = exp.union(subquery_expression, select, distinct=False)
    109            return self.subquery_sql(subquery_expression.subquery(expression.alias))
    110
    111        def with_properties(self, properties: exp.Properties) -> str:
    112            """Redshift doesn't have `WITH` as part of their with_properties so we remove it"""
    113            return self.properties(properties, prefix=" ", suffix="")
    114
    115        def renametable_sql(self, expression: exp.RenameTable) -> str:
    116            """Redshift only supports defining the table name itself (not the db) when renaming tables"""
    117            expression = expression.copy()
    118            target_table = expression.this
    119            for arg in target_table.args:
    120                if arg != "this":
    121                    target_table.set(arg, None)
    122            this = self.sql(expression, "this")
    123            return f"RENAME TO {this}"
    124
    125        def datatype_sql(self, expression: exp.DataType) -> str:
    126            """
    127            Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
    128            VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
    129            without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
    130            `TEXT` to `VARCHAR`.
    131            """
    132            if expression.this == exp.DataType.Type.TEXT:
    133                expression = expression.copy()
    134                expression.set("this", exp.DataType.Type.VARCHAR)
    135                precision = expression.args.get("expressions")
    136                if not precision:
    137                    expression.append("expressions", exp.Var(this="MAX"))
    138            return super().datatype_sql(expression)

##### Inherited Members

sqlglot.dialects.dialect.Dialect
  get_or_raise
  format_time
  parse
  parse_into
  generate
  transpile
  parser
  generator

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

    21    class Parser(Postgres.Parser):
    22        FUNCTIONS = {
    23            **Postgres.Parser.FUNCTIONS,  # type: ignore
    24            "DATEDIFF": lambda args: exp.DateDiff(
    25                this=seq_get(args, 2),
    26                expression=seq_get(args, 1),
    27                unit=seq_get(args, 0),
    28            ),
    29            "DECODE": exp.Matches.from_arg_list,
    30            "NVL": exp.Coalesce.from_arg_list,
    31        }
    32
    33        def _parse_types(self, check_func: bool = False) -> t.Optional[exp.Expression]:
    34            this = super()._parse_types(check_func=check_func)
    35
    36            if (
    37                isinstance(this, exp.DataType)
    38                and this.this == exp.DataType.Type.VARCHAR
    39                and this.expressions
    40                and this.expressions[0] == exp.column("MAX")
    41            ):
    42                this.set("expressions", [exp.Var(this="MAX")])
    43
    44            return this

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

###### Arguments:

- error_level: the desired error level. Default: ErrorLevel.RAISE
- error_message_context: determines the amount of context to capture from a query string when displaying the error message (in number of characters). Default: 50.
- index_offset: Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. Default: 0
- alias_post_tablesample: If the table alias comes after tablesample. Default: False
- 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
- null_ordering: Indicates the default null ordering method to use if not explicitly set. Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". Default: "nulls_are_small"

##### Inherited Members

sqlglot.parser.Parser
  Parser
  reset
  parse
  parse_into
  check_errors
  raise_error
  expression
  validate_expression

class Redshift.Tokenizer(sqlglot.dialects.postgres.Postgres.Tokenizer): View Source

    46    class Tokenizer(Postgres.Tokenizer):
    47        STRING_ESCAPES = ["\\"]
    48
    49        KEYWORDS = {
    50            **Postgres.Tokenizer.KEYWORDS,  # type: ignore
    51            "GEOMETRY": TokenType.GEOMETRY,
    52            "GEOGRAPHY": TokenType.GEOGRAPHY,
    53            "HLLSKETCH": TokenType.HLLSKETCH,
    54            "SUPER": TokenType.SUPER,
    55            "TIME": TokenType.TIMESTAMP,
    56            "TIMETZ": TokenType.TIMESTAMPTZ,
    57            "UNLOAD": TokenType.COMMAND,
    58            "VARBYTE": TokenType.VARBINARY,
    59        }

##### Inherited Members

sqlglot.tokens.Tokenizer
  reset
  tokenize

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

     61    class Generator(Postgres.Generator):
     62        TYPE_MAPPING = {
     63            **Postgres.Generator.TYPE_MAPPING,  # type: ignore
     64            exp.DataType.Type.BINARY: "VARBYTE",
     65            exp.DataType.Type.VARBINARY: "VARBYTE",
     66            exp.DataType.Type.INT: "INTEGER",
     67        }
     68
     69        PROPERTIES_LOCATION = {
     70            **Postgres.Generator.PROPERTIES_LOCATION,  # type: ignore
     71            exp.LikeProperty: exp.Properties.Location.POST_WITH,
     72        }
     73
     74        TRANSFORMS = {
     75            **Postgres.Generator.TRANSFORMS,  # type: ignore
     76            **transforms.ELIMINATE_DISTINCT_ON,  # type: ignore
     77            exp.DateDiff: lambda self, e: self.func(
     78                "DATEDIFF", e.args.get("unit") or "day", e.expression, e.this
     79            ),
     80            exp.DistKeyProperty: lambda self, e: f"DISTKEY({e.name})",
     81            exp.SortKeyProperty: lambda self, e: f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})",
     82            exp.DistStyleProperty: lambda self, e: self.naked_property(e),
     83            exp.Matches: rename_func("DECODE"),
     84        }
     85
     86        def values_sql(self, expression: exp.Values) -> str:
     87            """
     88            Converts `VALUES...` expression into a series of unions.
     89
     90            Note: If you have a lot of unions then this will result in a large number of recursive statements to
     91            evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be
     92            very slow.
     93            """
     94            if not isinstance(expression.unnest().parent, exp.From):
     95                return super().values_sql(expression)
     96            rows = [tuple_exp.expressions for tuple_exp in expression.expressions]
     97            selects = []
     98            for i, row in enumerate(rows):
     99                if i == 0 and expression.alias:
    100                    row = [
    101                        exp.alias_(value, column_name)
    102                        for value, column_name in zip(row, expression.args["alias"].args["columns"])
    103                    ]
    104                selects.append(exp.Select(expressions=row))
    105            subquery_expression = selects[0]
    106            if len(selects) > 1:
    107                for select in selects[1:]:
    108                    subquery_expression = exp.union(subquery_expression, select, distinct=False)
    109            return self.subquery_sql(subquery_expression.subquery(expression.alias))
    110
    111        def with_properties(self, properties: exp.Properties) -> str:
    112            """Redshift doesn't have `WITH` as part of their with_properties so we remove it"""
    113            return self.properties(properties, prefix=" ", suffix="")
    114
    115        def renametable_sql(self, expression: exp.RenameTable) -> str:
    116            """Redshift only supports defining the table name itself (not the db) when renaming tables"""
    117            expression = expression.copy()
    118            target_table = expression.this
    119            for arg in target_table.args:
    120                if arg != "this":
    121                    target_table.set(arg, None)
    122            this = self.sql(expression, "this")
    123            return f"RENAME TO {this}"
    124
    125        def datatype_sql(self, expression: exp.DataType) -> str:
    126            """
    127            Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
    128            VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
    129            without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
    130            `TEXT` to `VARCHAR`.
    131            """
    132            if expression.this == exp.DataType.Type.TEXT:
    133                expression = expression.copy()
    134                expression.set("this", exp.DataType.Type.VARCHAR)
    135                precision = expression.args.get("expressions")
    136                if not precision:
    137                    expression.append("expressions", exp.Var(this="MAX"))
    138            return super().datatype_sql(expression)

Generator interprets the given syntax tree and produces a SQL string as an output.

###### Arguments:

- time_mapping (dict): the dictionary of custom time mappings in which the key represents a python time format and the output the target time format
- time_trie (trie): a trie of the time_mapping keys
- pretty (bool): if set to True the returned string will be formatted. Default: False.
- quote_start (str): specifies which starting character to use to delimit quotes. Default: '.
- quote_end (str): specifies which ending character to use to delimit quotes. Default: '.
- identifier_start (str): specifies which starting character to use to delimit identifiers. Default: ".
- identifier_end (str): specifies which ending character to use to delimit identifiers. Default: ".
- identify (bool): if set to True all identifiers will be delimited by the corresponding character.
- normalize (bool): if set to True all identifiers will lower cased
- string_escape (str): specifies a string escape character. Default: '.
- identifier_escape (str): specifies an identifier escape character. Default: ".
- pad (int): determines padding in a formatted string. Default: 2.
- indent (int): determines the size of indentation in a formatted string. Default: 4.
- unnest_column_only (bool): if true unnest table aliases are considered only as column aliases
- normalize_functions (str): normalize function names, "upper", "lower", or None Default: "upper"
- alias_post_tablesample (bool): if the table alias comes after tablesample Default: False
- unsupported_level (ErrorLevel): determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
- null_ordering (str): Indicates the default null ordering method to use if not explicitly set. Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". Default: "nulls_are_small"
- max_unsupported (int): 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 (bool): if the the comma is leading or trailing in select statements 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 or not to preserve comments in the output SQL code. Default: True

def values_sql(self, expression: sqlglot.expressions.Values) -> str: View Source

     86        def values_sql(self, expression: exp.Values) -> str:
     87            """
     88            Converts `VALUES...` expression into a series of unions.
     89
     90            Note: If you have a lot of unions then this will result in a large number of recursive statements to
     91            evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be
     92            very slow.
     93            """
     94            if not isinstance(expression.unnest().parent, exp.From):
     95                return super().values_sql(expression)
     96            rows = [tuple_exp.expressions for tuple_exp in expression.expressions]
     97            selects = []
     98            for i, row in enumerate(rows):
     99                if i == 0 and expression.alias:
    100                    row = [
    101                        exp.alias_(value, column_name)
    102                        for value, column_name in zip(row, expression.args["alias"].args["columns"])
    103                    ]
    104                selects.append(exp.Select(expressions=row))
    105            subquery_expression = selects[0]
    106            if len(selects) > 1:
    107                for select in selects[1:]:
    108                    subquery_expression = exp.union(subquery_expression, select, distinct=False)
    109            return self.subquery_sql(subquery_expression.subquery(expression.alias))

Converts `VALUES...` expression into a series of unions.

Note: If you have a lot of unions then this will result in a large number of recursive statements to evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be very slow.

def with_properties(self, properties: sqlglot.expressions.Properties) -> str: View Source

    111        def with_properties(self, properties: exp.Properties) -> str:
    112            """Redshift doesn't have `WITH` as part of their with_properties so we remove it"""
    113            return self.properties(properties, prefix=" ", suffix="")

Redshift doesn't have `WITH` as part of their with_properties so we remove it

def renametable_sql(self, expression: sqlglot.expressions.RenameTable) -> str: View Source

    115        def renametable_sql(self, expression: exp.RenameTable) -> str:
    116            """Redshift only supports defining the table name itself (not the db) when renaming tables"""
    117            expression = expression.copy()
    118            target_table = expression.this
    119            for arg in target_table.args:
    120                if arg != "this":
    121                    target_table.set(arg, None)
    122            this = self.sql(expression, "this")
    123            return f"RENAME TO {this}"

Redshift only supports defining the table name itself (not the db) when renaming tables

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

    125        def datatype_sql(self, expression: exp.DataType) -> str:
    126            """
    127            Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
    128            VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
    129            without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
    130            `TEXT` to `VARCHAR`.
    131            """
    132            if expression.this == exp.DataType.Type.TEXT:
    133                expression = expression.copy()
    134                expression.set("this", exp.DataType.Type.VARCHAR)
    135                precision = expression.args.get("expressions")
    136                if not precision:
    137                    expression.append("expressions", exp.Var(this="MAX"))
    138            return super().datatype_sql(expression)

Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert `TEXT` to `VARCHAR`.

##### Inherited Members

sqlglot.generator.Generator
  Generator
  generate
  unsupported
  sep
  seg
  pad_comment
  maybe_comment
  wrap
  no_identify
  normalize_func
  indent
  sql
  uncache_sql
  cache_sql
  characterset_sql
  column_sql
  columndef_sql
  columnconstraint_sql
  autoincrementcolumnconstraint_sql
  compresscolumnconstraint_sql
  generatedasidentitycolumnconstraint_sql
  notnullcolumnconstraint_sql
  primarykeycolumnconstraint_sql
  uniquecolumnconstraint_sql
  create_sql
  describe_sql
  prepend_ctes
  with_sql
  cte_sql
  tablealias_sql
  bitstring_sql
  hexstring_sql
  directory_sql
  delete_sql
  drop_sql
  except_sql
  except_op
  fetch_sql
  filter_sql
  hint_sql
  index_sql
  identifier_sql
  national_sql
  partition_sql
  properties_sql
  root_properties
  properties
  locate_properties
  property_sql
  likeproperty_sql
  fallbackproperty_sql
  journalproperty_sql
  freespaceproperty_sql
  afterjournalproperty_sql
  checksumproperty_sql
  mergeblockratioproperty_sql
  datablocksizeproperty_sql
  blockcompressionproperty_sql
  isolatedloadingproperty_sql
  lockingproperty_sql
  withdataproperty_sql
  insert_sql
  intersect_sql
  intersect_op
  introducer_sql
  pseudotype_sql
  rowformatdelimitedproperty_sql
  table_sql
  tablesample_sql
  pivot_sql
  tuple_sql
  update_sql
  var_sql
  into_sql
  from_sql
  group_sql
  having_sql
  join_sql
  lambda_sql
  lateral_sql
  limit_sql
  offset_sql
  lock_sql
  literal_sql
  loaddata_sql
  null_sql
  boolean_sql
  order_sql
  cluster_sql
  distribute_sql
  sort_sql
  ordered_sql
  matchrecognize_sql
  query_modifiers
  select_sql
  schema_sql
  star_sql
  structkwarg_sql
  parameter_sql
  sessionparameter_sql
  placeholder_sql
  subquery_sql
  qualify_sql
  union_sql
  union_op
  unnest_sql
  where_sql
  window_sql
  partition_by_sql
  window_spec_sql
  withingroup_sql
  between_sql
  bracket_sql
  all_sql
  any_sql
  exists_sql
  case_sql
  constraint_sql
  extract_sql
  trim_sql
  concat_sql
  check_sql
  foreignkey_sql
  primarykey_sql
  unique_sql
  if_sql
  in_sql
  in_unnest_op
  interval_sql
  return_sql
  reference_sql
  anonymous_sql
  paren_sql
  neg_sql
  not_sql
  alias_sql
  aliases_sql
  attimezone_sql
  add_sql
  and_sql
  connector_sql
  bitwiseand_sql
  bitwiseleftshift_sql
  bitwisenot_sql
  bitwiseor_sql
  bitwiserightshift_sql
  bitwisexor_sql
  cast_sql
  currentdate_sql
  collate_sql
  command_sql
  comment_sql
  transaction_sql
  commit_sql
  rollback_sql
  altercolumn_sql
  altertable_sql
  droppartition_sql
  addconstraint_sql
  distinct_sql
  ignorenulls_sql
  respectnulls_sql
  intdiv_sql
  dpipe_sql
  div_sql
  overlaps_sql
  distance_sql
  dot_sql
  eq_sql
  escape_sql
  glob_sql
  gt_sql
  gte_sql
  ilike_sql
  is_sql
  like_sql
  similarto_sql
  lt_sql
  lte_sql
  mod_sql
  mul_sql
  neq_sql
  nullsafeeq_sql
  nullsafeneq_sql
  or_sql
  slice_sql
  sub_sql
  trycast_sql
  use_sql
  binary
  function_fallback_sql
  func
  format_args
  text_width
  format_time
  expressions
  op_expressions
  naked_property
  set_operation
  tag_sql
  token_sql
  userdefinedfunction_sql
  joinhint_sql
  kwarg_sql
  when_sql
  merge_sql