Edit on GitHub

sqlglot.generators.redshift

  1from __future__ import annotations
  2
  3
  4from sqlglot import exp, transforms
  5from sqlglot.dialects.dialect import (
  6    DATE_ADD_OR_DIFF,
  7    array_concat_sql,
  8    concat_to_dpipe_sql,
  9    concat_ws_to_dpipe_sql,
 10    generatedasidentitycolumnconstraint_sql,
 11    groupconcat_sql,
 12    json_extract_segments,
 13    no_tablesample_sql,
 14    rename_func,
 15    unit_to_var,
 16)
 17from sqlglot.generator import Generator
 18from sqlglot.generators.postgres import PostgresGenerator
 19from sqlglot.helper import seq_get
 20
 21
 22class RedshiftGenerator(PostgresGenerator):
 23    DATE_PART_WITH_EXPRESSION = "PGDATE_PART"
 24    LOCKING_READS_SUPPORTED = False
 25    QUERY_HINTS = False
 26    CAST_TO_INT_ROUNDS = True
 27    VALUES_AS_TABLE = False
 28    TZ_TO_WITH_TIME_ZONE = True
 29    NVL2_SUPPORTED = True
 30    LAST_DAY_SUPPORTS_DATE_PART = False
 31    CAN_IMPLEMENT_ARRAY_ANY = False
 32    MULTI_ARG_DISTINCT = True
 33    COPY_PARAMS_ARE_WRAPPED = False
 34    HEX_FUNC = "TO_HEX"
 35    PARSE_JSON_NAME: str | None = "JSON_PARSE"
 36    ARRAY_CONCAT_IS_VAR_LEN = False
 37    SUPPORTS_CONVERT_TIMEZONE = True
 38    EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE = False
 39    SUPPORTS_MEDIAN = True
 40    ALTER_SET_TYPE = "TYPE"
 41    SUPPORTS_DECODE_CASE = True
 42    SUPPORTS_BETWEEN_FLAGS = False
 43    LIMIT_FETCH = "LIMIT"
 44    STAR_EXCEPT = "EXCLUDE"
 45    STAR_EXCLUDE_REQUIRES_DERIVED_TABLE = False
 46
 47    # Redshift doesn't have `WITH` as part of their with_properties so we remove it
 48    WITH_PROPERTIES_PREFIX = " "
 49
 50    PROPERTIES_LOCATION = {
 51        **PostgresGenerator.PROPERTIES_LOCATION,
 52        exp.DistKeyProperty: exp.Properties.Location.POST_SCHEMA,
 53        exp.DistStyleProperty: exp.Properties.Location.POST_SCHEMA,
 54        exp.SortKeyProperty: exp.Properties.Location.POST_SCHEMA,
 55    }
 56
 57    TYPE_MAPPING = {
 58        **PostgresGenerator.TYPE_MAPPING,
 59        exp.DType.BINARY: "VARBYTE",
 60        exp.DType.BLOB: "VARBYTE",
 61        exp.DType.INT: "INTEGER",
 62        exp.DType.TIMETZ: "TIME",
 63        exp.DType.TIMESTAMPTZ: "TIMESTAMP",
 64        exp.DType.VARBINARY: "VARBYTE",
 65        exp.DType.ROWVERSION: "VARBYTE",
 66    }
 67
 68    TRANSFORMS = {
 69        **{
 70            k: v
 71            for k, v in PostgresGenerator.TRANSFORMS.items()
 72            if k
 73            not in {
 74                exp.Pivot,
 75                exp.ParseJSON,
 76                exp.AnyValue,
 77                exp.LastDay,
 78                exp.SHA2,
 79                exp.Getbit,
 80                exp.IntDiv,
 81                exp.Round,
 82                exp.TryCast,
 83            }
 84        },
 85        exp.ArrayConcat: array_concat_sql("ARRAY_CONCAT"),
 86        exp.Concat: concat_to_dpipe_sql,
 87        exp.ConcatWs: concat_ws_to_dpipe_sql,
 88        exp.ApproxDistinct: lambda self, e: f"APPROXIMATE COUNT(DISTINCT {self.sql(e, 'this')})",
 89        exp.CurrentTimestamp: lambda self, e: "SYSDATE" if e.args.get("sysdate") else "GETDATE()",
 90        exp.CurrentUserId: lambda *_: "CURRENT_USER_ID",
 91        exp.DateAdd: lambda self, e: self._date_delta_sql(e, "DATEADD"),
 92        exp.DateDiff: lambda self, e: self._date_delta_sql(e, "DATEDIFF"),
 93        exp.DistKeyProperty: lambda self, e: self.func("DISTKEY", e.this),
 94        exp.DistStyleProperty: lambda self, e: self.naked_property(e),
 95        exp.Explode: lambda self, e: self.explode_sql(e),
 96        exp.FarmFingerprint: rename_func("FARMFINGERPRINT64"),
 97        exp.FromBase: rename_func("STRTOL"),
 98        exp.GeneratedAsIdentityColumnConstraint: generatedasidentitycolumnconstraint_sql,
 99        exp.JSONExtract: json_extract_segments("JSON_EXTRACT_PATH_TEXT"),
100        exp.JSONExtractScalar: json_extract_segments("JSON_EXTRACT_PATH_TEXT"),
101        exp.GroupConcat: groupconcat_sql,
102        exp.Hex: lambda self, e: self.func("UPPER", self.func("TO_HEX", self.sql(e, "this"))),
103        exp.RegexpExtract: rename_func("REGEXP_SUBSTR"),
104        exp.Select: transforms.preprocess(
105            [
106                transforms.eliminate_window_clause,
107                transforms.eliminate_distinct_on,
108                transforms.eliminate_semi_and_anti_joins,
109                transforms.unqualify_unnest,
110                transforms.unnest_generate_date_array_using_recursive_cte,
111            ]
112        ),
113        exp.SortKeyProperty: lambda self, e: (
114            f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})"
115        ),
116        exp.StartsWith: lambda self, e: f"{self.sql(e.this)} LIKE {self.sql(e.expression)} || '%'",
117        exp.StringToArray: rename_func("SPLIT_TO_ARRAY"),
118        exp.TableSample: no_tablesample_sql,
119        exp.TsOrDsAdd: lambda self, e: self._date_delta_sql(e, "DATEADD"),
120        exp.TsOrDsDiff: lambda self, e: self._date_delta_sql(e, "DATEDIFF"),
121        exp.UnixToTime: lambda self, e: self._unix_to_time_sql(e),
122        exp.SHA2Digest: lambda self, e: self.func(
123            "SHA2", e.this, e.args.get("length") or exp.Literal.number(256)
124        ),
125    }
126
127    RESERVED_KEYWORDS = {
128        "aes128",
129        "aes256",
130        "all",
131        "allowoverwrite",
132        "analyse",
133        "analyze",
134        "and",
135        "any",
136        "array",
137        "as",
138        "asc",
139        "authorization",
140        "az64",
141        "backup",
142        "between",
143        "binary",
144        "blanksasnull",
145        "both",
146        "bytedict",
147        "bzip2",
148        "case",
149        "cast",
150        "check",
151        "collate",
152        "column",
153        "constraint",
154        "create",
155        "credentials",
156        "cross",
157        "current_date",
158        "current_time",
159        "current_timestamp",
160        "current_user",
161        "current_user_id",
162        "default",
163        "deferrable",
164        "deflate",
165        "defrag",
166        "delta",
167        "delta32k",
168        "desc",
169        "disable",
170        "distinct",
171        "do",
172        "else",
173        "emptyasnull",
174        "enable",
175        "encode",
176        "encrypt     ",
177        "encryption",
178        "end",
179        "except",
180        "explicit",
181        "false",
182        "for",
183        "foreign",
184        "freeze",
185        "from",
186        "full",
187        "globaldict256",
188        "globaldict64k",
189        "grant",
190        "group",
191        "gzip",
192        "having",
193        "identity",
194        "ignore",
195        "ilike",
196        "in",
197        "initially",
198        "inner",
199        "intersect",
200        "interval",
201        "into",
202        "is",
203        "isnull",
204        "join",
205        "leading",
206        "left",
207        "like",
208        "limit",
209        "localtime",
210        "localtimestamp",
211        "lun",
212        "luns",
213        "lzo",
214        "lzop",
215        "minus",
216        "mostly16",
217        "mostly32",
218        "mostly8",
219        "natural",
220        "new",
221        "not",
222        "notnull",
223        "null",
224        "nulls",
225        "off",
226        "offline",
227        "offset",
228        "oid",
229        "old",
230        "on",
231        "only",
232        "open",
233        "or",
234        "order",
235        "outer",
236        "overlaps",
237        "parallel",
238        "partition",
239        "percent",
240        "permissions",
241        "pivot",
242        "placing",
243        "primary",
244        "raw",
245        "readratio",
246        "recover",
247        "references",
248        "rejectlog",
249        "resort",
250        "respect",
251        "restore",
252        "right",
253        "select",
254        "session_user",
255        "similar",
256        "snapshot",
257        "some",
258        "sysdate",
259        "system",
260        "table",
261        "tag",
262        "tdes",
263        "text255",
264        "text32k",
265        "then",
266        "timestamp",
267        "to",
268        "top",
269        "trailing",
270        "true",
271        "truncatecolumns",
272        "type",
273        "union",
274        "unique",
275        "unnest",
276        "unpivot",
277        "user",
278        "using",
279        "verbose",
280        "wallet",
281        "when",
282        "where",
283        "with",
284        "without",
285    }
286
287    def _date_delta_sql(self, expression: DATE_ADD_OR_DIFF, name: str) -> str:
288        unit = unit_to_var(expression)
289        if unit and not isinstance(unit, exp.Var):
290            # The underscored functions accept date-part expressions instead of keywords.
291            name = name.replace("DATE", "DATE_")
292        return self.func(name, unit, expression.expression, expression.this)
293
294    def bytestring_sql(self, expression: exp.ByteString) -> str:
295        if not expression.args.get("is_bytes"):
296            return self.sql(exp.Literal.string(expression.this))
297
298        return self.func("FROM_HEX", exp.Literal.string(expression.this.encode("latin-1").hex()))
299
300    def stpoint_sql(self, expression: exp.StPoint) -> str:
301        # ST_POINT only accepts 2 args in Redshift; use ST_MAKEPOINT for 3 or 4 args
302        if expression.args.get("z") or expression.args.get("m"):
303            return self.func(
304                "ST_MAKEPOINT",
305                expression.this,
306                expression.expression,
307                expression.args.get("z"),
308                expression.args.get("m"),
309            )
310        return self.func("ST_POINT", expression.this, expression.expression)
311
312    def arraycontains_sql(self, expression: exp.ArrayContains) -> str:
313        return self.func(
314            "ARRAY_CONTAINS",
315            expression.this,
316            expression.expression,
317            expression.args.get("check_null"),
318        )
319
320    def objecttransform_sql(self, expression: exp.ObjectTransform) -> str:
321        this = self.sql(expression, "this")
322        keep = self.expressions(expression, key="keep", flat=True)
323        set_ = self.expressions(expression, key="set_", flat=True)
324        keep_sql = " KEEP " + keep if keep else ""
325        set_sql = " SET " + set_ if set_ else ""
326        return f"OBJECT_TRANSFORM({this}{keep_sql}{set_sql})"
327
328    def approxquantile_sql(self, expression: exp.ApproxQuantile) -> str:
329        return "APPROXIMATE " + self.sql(
330            exp.WithinGroup(
331                this=exp.PercentileDisc(this=expression.args["quantile"]),
332                expression=exp.Order(expressions=[exp.Ordered(this=expression.this)]),
333            )
334        )
335
336    def unnest_sql(self, expression: exp.Unnest) -> str:
337        args = expression.expressions
338        num_args = len(args)
339
340        if num_args != 1:
341            self.unsupported(f"Unsupported number of arguments in UNNEST: {num_args}")
342            return ""
343
344        if isinstance(expression.find_ancestor(exp.From, exp.Join, exp.Select), exp.Select):
345            self.unsupported("Unsupported UNNEST when not used in FROM/JOIN clauses")
346            return ""
347
348        arg = self.sql(seq_get(args, 0))
349
350        alias = self.expressions(expression.args.get("alias"), key="columns", flat=True)
351        return f"{arg} AS {alias}" if alias else arg
352
353    def cast_sql(self, expression: exp.Cast, safe_prefix: str | None = None) -> str:
354        if expression.is_type(exp.DType.JSON):
355            # Redshift doesn't support a JSON type, so casting to it is treated as a noop
356            return self.sql(expression, "this")
357
358        return super().cast_sql(expression, safe_prefix=safe_prefix)
359
360    def datatype_sql(self, expression: exp.DataType) -> str:
361        """
362        Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
363        VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
364        without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
365        `TEXT` to `VARCHAR`.
366        """
367        if expression.is_type("text"):
368            expression.set("this", exp.DType.VARCHAR)
369            precision = expression.args.get("expressions")
370
371            if not precision:
372                expression.append("expressions", exp.var("MAX"))
373
374        return super().datatype_sql(expression)
375
376    def alterset_sql(self, expression: exp.AlterSet) -> str:
377        exprs = self.expressions(expression, flat=True)
378        exprs = f" TABLE PROPERTIES ({exprs})" if exprs else ""
379        location = self.sql(expression, "location")
380        location = f" LOCATION {location}" if location else ""
381        file_format = self.expressions(expression, key="file_format", flat=True, sep=" ")
382        file_format = f" FILE FORMAT {file_format}" if file_format else ""
383
384        return f"SET{exprs}{location}{file_format}"
385
386    def arraysize_sql(self, expression: exp.ArraySize) -> str:
387        if not expression.expression:
388            return self.func("GET_ARRAY_LENGTH", expression.this)
389
390        return Generator.arraysize_sql(self, expression)
391
392    def array_sql(self, expression: exp.Array) -> str:
393        if expression.args.get("bracket_notation"):
394            return super().array_sql(expression)
395
396        return rename_func("ARRAY")(self, expression)
397
398    def struct_sql(self, expression: exp.Struct) -> str:
399        self.unsupported("Redshift does not support row constructors")
400        return super().struct_sql(expression)
401
402    def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
403        return Generator.ignorenulls_sql(self, expression)
404
405    def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
406        return Generator.respectnulls_sql(self, expression)
407
408    def explode_sql(self, expression: exp.Explode) -> str:
409        self.unsupported("Unsupported EXPLODE() function")
410        return ""
411
412    def _unix_to_time_sql(self, expression: exp.UnixToTime) -> str:
413        scale = expression.args.get("scale")
414        this = self.sql(expression.this)
415
416        if scale is not None and scale != exp.UnixToTime.SECONDS and scale.is_int:
417            this = f"({this} / POWER(10, {scale.to_py()}))"
418
419        return f"(TIMESTAMP 'epoch' + {this} * INTERVAL '1 SECOND')"
class RedshiftGenerator(sqlglot.generators.postgres.PostgresGenerator):
 23class RedshiftGenerator(PostgresGenerator):
 24    DATE_PART_WITH_EXPRESSION = "PGDATE_PART"
 25    LOCKING_READS_SUPPORTED = False
 26    QUERY_HINTS = False
 27    CAST_TO_INT_ROUNDS = True
 28    VALUES_AS_TABLE = False
 29    TZ_TO_WITH_TIME_ZONE = True
 30    NVL2_SUPPORTED = True
 31    LAST_DAY_SUPPORTS_DATE_PART = False
 32    CAN_IMPLEMENT_ARRAY_ANY = False
 33    MULTI_ARG_DISTINCT = True
 34    COPY_PARAMS_ARE_WRAPPED = False
 35    HEX_FUNC = "TO_HEX"
 36    PARSE_JSON_NAME: str | None = "JSON_PARSE"
 37    ARRAY_CONCAT_IS_VAR_LEN = False
 38    SUPPORTS_CONVERT_TIMEZONE = True
 39    EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE = False
 40    SUPPORTS_MEDIAN = True
 41    ALTER_SET_TYPE = "TYPE"
 42    SUPPORTS_DECODE_CASE = True
 43    SUPPORTS_BETWEEN_FLAGS = False
 44    LIMIT_FETCH = "LIMIT"
 45    STAR_EXCEPT = "EXCLUDE"
 46    STAR_EXCLUDE_REQUIRES_DERIVED_TABLE = False
 47
 48    # Redshift doesn't have `WITH` as part of their with_properties so we remove it
 49    WITH_PROPERTIES_PREFIX = " "
 50
 51    PROPERTIES_LOCATION = {
 52        **PostgresGenerator.PROPERTIES_LOCATION,
 53        exp.DistKeyProperty: exp.Properties.Location.POST_SCHEMA,
 54        exp.DistStyleProperty: exp.Properties.Location.POST_SCHEMA,
 55        exp.SortKeyProperty: exp.Properties.Location.POST_SCHEMA,
 56    }
 57
 58    TYPE_MAPPING = {
 59        **PostgresGenerator.TYPE_MAPPING,
 60        exp.DType.BINARY: "VARBYTE",
 61        exp.DType.BLOB: "VARBYTE",
 62        exp.DType.INT: "INTEGER",
 63        exp.DType.TIMETZ: "TIME",
 64        exp.DType.TIMESTAMPTZ: "TIMESTAMP",
 65        exp.DType.VARBINARY: "VARBYTE",
 66        exp.DType.ROWVERSION: "VARBYTE",
 67    }
 68
 69    TRANSFORMS = {
 70        **{
 71            k: v
 72            for k, v in PostgresGenerator.TRANSFORMS.items()
 73            if k
 74            not in {
 75                exp.Pivot,
 76                exp.ParseJSON,
 77                exp.AnyValue,
 78                exp.LastDay,
 79                exp.SHA2,
 80                exp.Getbit,
 81                exp.IntDiv,
 82                exp.Round,
 83                exp.TryCast,
 84            }
 85        },
 86        exp.ArrayConcat: array_concat_sql("ARRAY_CONCAT"),
 87        exp.Concat: concat_to_dpipe_sql,
 88        exp.ConcatWs: concat_ws_to_dpipe_sql,
 89        exp.ApproxDistinct: lambda self, e: f"APPROXIMATE COUNT(DISTINCT {self.sql(e, 'this')})",
 90        exp.CurrentTimestamp: lambda self, e: "SYSDATE" if e.args.get("sysdate") else "GETDATE()",
 91        exp.CurrentUserId: lambda *_: "CURRENT_USER_ID",
 92        exp.DateAdd: lambda self, e: self._date_delta_sql(e, "DATEADD"),
 93        exp.DateDiff: lambda self, e: self._date_delta_sql(e, "DATEDIFF"),
 94        exp.DistKeyProperty: lambda self, e: self.func("DISTKEY", e.this),
 95        exp.DistStyleProperty: lambda self, e: self.naked_property(e),
 96        exp.Explode: lambda self, e: self.explode_sql(e),
 97        exp.FarmFingerprint: rename_func("FARMFINGERPRINT64"),
 98        exp.FromBase: rename_func("STRTOL"),
 99        exp.GeneratedAsIdentityColumnConstraint: generatedasidentitycolumnconstraint_sql,
100        exp.JSONExtract: json_extract_segments("JSON_EXTRACT_PATH_TEXT"),
101        exp.JSONExtractScalar: json_extract_segments("JSON_EXTRACT_PATH_TEXT"),
102        exp.GroupConcat: groupconcat_sql,
103        exp.Hex: lambda self, e: self.func("UPPER", self.func("TO_HEX", self.sql(e, "this"))),
104        exp.RegexpExtract: rename_func("REGEXP_SUBSTR"),
105        exp.Select: transforms.preprocess(
106            [
107                transforms.eliminate_window_clause,
108                transforms.eliminate_distinct_on,
109                transforms.eliminate_semi_and_anti_joins,
110                transforms.unqualify_unnest,
111                transforms.unnest_generate_date_array_using_recursive_cte,
112            ]
113        ),
114        exp.SortKeyProperty: lambda self, e: (
115            f"{'COMPOUND ' if e.args['compound'] else ''}SORTKEY({self.format_args(*e.this)})"
116        ),
117        exp.StartsWith: lambda self, e: f"{self.sql(e.this)} LIKE {self.sql(e.expression)} || '%'",
118        exp.StringToArray: rename_func("SPLIT_TO_ARRAY"),
119        exp.TableSample: no_tablesample_sql,
120        exp.TsOrDsAdd: lambda self, e: self._date_delta_sql(e, "DATEADD"),
121        exp.TsOrDsDiff: lambda self, e: self._date_delta_sql(e, "DATEDIFF"),
122        exp.UnixToTime: lambda self, e: self._unix_to_time_sql(e),
123        exp.SHA2Digest: lambda self, e: self.func(
124            "SHA2", e.this, e.args.get("length") or exp.Literal.number(256)
125        ),
126    }
127
128    RESERVED_KEYWORDS = {
129        "aes128",
130        "aes256",
131        "all",
132        "allowoverwrite",
133        "analyse",
134        "analyze",
135        "and",
136        "any",
137        "array",
138        "as",
139        "asc",
140        "authorization",
141        "az64",
142        "backup",
143        "between",
144        "binary",
145        "blanksasnull",
146        "both",
147        "bytedict",
148        "bzip2",
149        "case",
150        "cast",
151        "check",
152        "collate",
153        "column",
154        "constraint",
155        "create",
156        "credentials",
157        "cross",
158        "current_date",
159        "current_time",
160        "current_timestamp",
161        "current_user",
162        "current_user_id",
163        "default",
164        "deferrable",
165        "deflate",
166        "defrag",
167        "delta",
168        "delta32k",
169        "desc",
170        "disable",
171        "distinct",
172        "do",
173        "else",
174        "emptyasnull",
175        "enable",
176        "encode",
177        "encrypt     ",
178        "encryption",
179        "end",
180        "except",
181        "explicit",
182        "false",
183        "for",
184        "foreign",
185        "freeze",
186        "from",
187        "full",
188        "globaldict256",
189        "globaldict64k",
190        "grant",
191        "group",
192        "gzip",
193        "having",
194        "identity",
195        "ignore",
196        "ilike",
197        "in",
198        "initially",
199        "inner",
200        "intersect",
201        "interval",
202        "into",
203        "is",
204        "isnull",
205        "join",
206        "leading",
207        "left",
208        "like",
209        "limit",
210        "localtime",
211        "localtimestamp",
212        "lun",
213        "luns",
214        "lzo",
215        "lzop",
216        "minus",
217        "mostly16",
218        "mostly32",
219        "mostly8",
220        "natural",
221        "new",
222        "not",
223        "notnull",
224        "null",
225        "nulls",
226        "off",
227        "offline",
228        "offset",
229        "oid",
230        "old",
231        "on",
232        "only",
233        "open",
234        "or",
235        "order",
236        "outer",
237        "overlaps",
238        "parallel",
239        "partition",
240        "percent",
241        "permissions",
242        "pivot",
243        "placing",
244        "primary",
245        "raw",
246        "readratio",
247        "recover",
248        "references",
249        "rejectlog",
250        "resort",
251        "respect",
252        "restore",
253        "right",
254        "select",
255        "session_user",
256        "similar",
257        "snapshot",
258        "some",
259        "sysdate",
260        "system",
261        "table",
262        "tag",
263        "tdes",
264        "text255",
265        "text32k",
266        "then",
267        "timestamp",
268        "to",
269        "top",
270        "trailing",
271        "true",
272        "truncatecolumns",
273        "type",
274        "union",
275        "unique",
276        "unnest",
277        "unpivot",
278        "user",
279        "using",
280        "verbose",
281        "wallet",
282        "when",
283        "where",
284        "with",
285        "without",
286    }
287
288    def _date_delta_sql(self, expression: DATE_ADD_OR_DIFF, name: str) -> str:
289        unit = unit_to_var(expression)
290        if unit and not isinstance(unit, exp.Var):
291            # The underscored functions accept date-part expressions instead of keywords.
292            name = name.replace("DATE", "DATE_")
293        return self.func(name, unit, expression.expression, expression.this)
294
295    def bytestring_sql(self, expression: exp.ByteString) -> str:
296        if not expression.args.get("is_bytes"):
297            return self.sql(exp.Literal.string(expression.this))
298
299        return self.func("FROM_HEX", exp.Literal.string(expression.this.encode("latin-1").hex()))
300
301    def stpoint_sql(self, expression: exp.StPoint) -> str:
302        # ST_POINT only accepts 2 args in Redshift; use ST_MAKEPOINT for 3 or 4 args
303        if expression.args.get("z") or expression.args.get("m"):
304            return self.func(
305                "ST_MAKEPOINT",
306                expression.this,
307                expression.expression,
308                expression.args.get("z"),
309                expression.args.get("m"),
310            )
311        return self.func("ST_POINT", expression.this, expression.expression)
312
313    def arraycontains_sql(self, expression: exp.ArrayContains) -> str:
314        return self.func(
315            "ARRAY_CONTAINS",
316            expression.this,
317            expression.expression,
318            expression.args.get("check_null"),
319        )
320
321    def objecttransform_sql(self, expression: exp.ObjectTransform) -> str:
322        this = self.sql(expression, "this")
323        keep = self.expressions(expression, key="keep", flat=True)
324        set_ = self.expressions(expression, key="set_", flat=True)
325        keep_sql = " KEEP " + keep if keep else ""
326        set_sql = " SET " + set_ if set_ else ""
327        return f"OBJECT_TRANSFORM({this}{keep_sql}{set_sql})"
328
329    def approxquantile_sql(self, expression: exp.ApproxQuantile) -> str:
330        return "APPROXIMATE " + self.sql(
331            exp.WithinGroup(
332                this=exp.PercentileDisc(this=expression.args["quantile"]),
333                expression=exp.Order(expressions=[exp.Ordered(this=expression.this)]),
334            )
335        )
336
337    def unnest_sql(self, expression: exp.Unnest) -> str:
338        args = expression.expressions
339        num_args = len(args)
340
341        if num_args != 1:
342            self.unsupported(f"Unsupported number of arguments in UNNEST: {num_args}")
343            return ""
344
345        if isinstance(expression.find_ancestor(exp.From, exp.Join, exp.Select), exp.Select):
346            self.unsupported("Unsupported UNNEST when not used in FROM/JOIN clauses")
347            return ""
348
349        arg = self.sql(seq_get(args, 0))
350
351        alias = self.expressions(expression.args.get("alias"), key="columns", flat=True)
352        return f"{arg} AS {alias}" if alias else arg
353
354    def cast_sql(self, expression: exp.Cast, safe_prefix: str | None = None) -> str:
355        if expression.is_type(exp.DType.JSON):
356            # Redshift doesn't support a JSON type, so casting to it is treated as a noop
357            return self.sql(expression, "this")
358
359        return super().cast_sql(expression, safe_prefix=safe_prefix)
360
361    def datatype_sql(self, expression: exp.DataType) -> str:
362        """
363        Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
364        VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
365        without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
366        `TEXT` to `VARCHAR`.
367        """
368        if expression.is_type("text"):
369            expression.set("this", exp.DType.VARCHAR)
370            precision = expression.args.get("expressions")
371
372            if not precision:
373                expression.append("expressions", exp.var("MAX"))
374
375        return super().datatype_sql(expression)
376
377    def alterset_sql(self, expression: exp.AlterSet) -> str:
378        exprs = self.expressions(expression, flat=True)
379        exprs = f" TABLE PROPERTIES ({exprs})" if exprs else ""
380        location = self.sql(expression, "location")
381        location = f" LOCATION {location}" if location else ""
382        file_format = self.expressions(expression, key="file_format", flat=True, sep=" ")
383        file_format = f" FILE FORMAT {file_format}" if file_format else ""
384
385        return f"SET{exprs}{location}{file_format}"
386
387    def arraysize_sql(self, expression: exp.ArraySize) -> str:
388        if not expression.expression:
389            return self.func("GET_ARRAY_LENGTH", expression.this)
390
391        return Generator.arraysize_sql(self, expression)
392
393    def array_sql(self, expression: exp.Array) -> str:
394        if expression.args.get("bracket_notation"):
395            return super().array_sql(expression)
396
397        return rename_func("ARRAY")(self, expression)
398
399    def struct_sql(self, expression: exp.Struct) -> str:
400        self.unsupported("Redshift does not support row constructors")
401        return super().struct_sql(expression)
402
403    def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
404        return Generator.ignorenulls_sql(self, expression)
405
406    def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
407        return Generator.respectnulls_sql(self, expression)
408
409    def explode_sql(self, expression: exp.Explode) -> str:
410        self.unsupported("Unsupported EXPLODE() function")
411        return ""
412
413    def _unix_to_time_sql(self, expression: exp.UnixToTime) -> str:
414        scale = expression.args.get("scale")
415        this = self.sql(expression.this)
416
417        if scale is not None and scale != exp.UnixToTime.SECONDS and scale.is_int:
418            this = f"({this} / POWER(10, {scale.to_py()}))"
419
420        return f"(TIMESTAMP 'epoch' + {this} * INTERVAL '1 SECOND')"

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: Always quote except for specials cases. '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
DATE_PART_WITH_EXPRESSION = 'PGDATE_PART'
LOCKING_READS_SUPPORTED = False
QUERY_HINTS = False
CAST_TO_INT_ROUNDS = True
VALUES_AS_TABLE = False
TZ_TO_WITH_TIME_ZONE = True
NVL2_SUPPORTED = True
LAST_DAY_SUPPORTS_DATE_PART = False
CAN_IMPLEMENT_ARRAY_ANY = False
MULTI_ARG_DISTINCT = True
COPY_PARAMS_ARE_WRAPPED = False
HEX_FUNC = 'TO_HEX'
PARSE_JSON_NAME: str | None = 'JSON_PARSE'
ARRAY_CONCAT_IS_VAR_LEN = False
SUPPORTS_CONVERT_TIMEZONE = True
EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE = False
SUPPORTS_MEDIAN = True
ALTER_SET_TYPE = 'TYPE'
SUPPORTS_DECODE_CASE = True
SUPPORTS_BETWEEN_FLAGS = False
LIMIT_FETCH = 'LIMIT'
STAR_EXCEPT = 'EXCLUDE'
STAR_EXCLUDE_REQUIRES_DERIVED_TABLE = False
WITH_PROPERTIES_PREFIX = ' '
PROPERTIES_LOCATION = {<class 'sqlglot.expressions.properties.AggregateKeyProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.AllowedValuesProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.AlgorithmProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.ApiProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.ApplicationProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.AutoIncrementProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.AutoRefreshProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.BackupProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.BlockCompressionProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.CalledOnNullInputProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.CatalogProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.CharacterSetProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ChecksumProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.CollateProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ComputeProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.CopyGrantsProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.CopyTagsProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.query.Cluster'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ClusteredByProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ClusterProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.DistributedByProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.DuplicateKeyProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.DataBlocksizeProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.DatabaseProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.DataDeletionProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.DefinerProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.DictRange'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.DictProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.DynamicProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.DistKeyProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.DistStyleProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.EmptyProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.EncodeProperty'>: <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.properties.EngineProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.EnviromentProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.HandlerProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ParameterStyleProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ExecuteAsProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ExternalProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.FallbackProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.FileFormatProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.FreespaceProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.GlobalProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.HeapProperty'>: <PropertiesLocation.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.properties.HybridProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.InheritsProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.IcebergProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.IgnoreGrantsProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.IncludeProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.InputModelProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.InteractiveProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.IsolatedLoadingProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.JournalProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.LanguageProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.LikeProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.LocationProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.LockProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.LockingProperty'>: <PropertiesLocation.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.properties.LogProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.MaskingProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.MaterializedProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.MergeBlockRatioProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.ModuleProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.NetworkProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.NoPrimaryIndexProperty'>: <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.properties.OnProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.OnCommitProperty'>: <PropertiesLocation.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.properties.OptionsProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.query.Order'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.OutputModelProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.PartitionedByProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.PartitionedOfProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.PhysicalProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.constraints.PrimaryKey'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.Property'>: <PropertiesLocation.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.properties.RefreshTriggerProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.RemoteWithConnectionModelProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ReturnsProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.RollupProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RowAccessProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RowFormatProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.RowFormatDelimitedProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.RowFormatSerdeProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SampleProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SchemaCommentProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SecureProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.SecurityIntegrationProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.SerdeProperties'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ddl.Set'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SettingsProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SetProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.SetConfigProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SharingProperty'>: <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.ddl.SequenceProperties'>: <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.ddl.TriggerProperties'>: <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.properties.SortKeyProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SqlReadWriteProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.SqlSecurityProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.StabilityProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.StorageHandlerProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.StorageProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.StreamingTableProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.StrictProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.Tags'>: <PropertiesLocation.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.properties.TableSpaceProperty'>: <PropertiesLocation.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.properties.TemporaryProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.ToTableProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.TransientProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.TransformModelProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ddl.MergeTreeTTL'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.UnloggedProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.UsingProperty'>: <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.properties.UsingTemplateProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.ViewAttributeProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.VirtualProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.VolatileProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.WithDataProperty'>: <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.properties.WithJournalTableProperty'>: <PropertiesLocation.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.properties.WithProcedureOptions'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.WithSchemaBindingProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.WithSystemVersioningProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.WithoutRowidProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ForceProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>}
TYPE_MAPPING = {<DType.DATETIME2: 'DATETIME2'>: 'TIMESTAMP', <DType.NCHAR: 'NCHAR'>: 'CHAR', <DType.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <DType.MEDIUMTEXT: 'MEDIUMTEXT'>: 'TEXT', <DType.LONGTEXT: 'LONGTEXT'>: 'TEXT', <DType.TINYTEXT: 'TINYTEXT'>: 'TEXT', <DType.BLOB: 'BLOB'>: 'VARBYTE', <DType.MEDIUMBLOB: 'MEDIUMBLOB'>: 'BLOB', <DType.LONGBLOB: 'LONGBLOB'>: 'BLOB', <DType.TINYBLOB: 'TINYBLOB'>: 'BLOB', <DType.INET: 'INET'>: 'INET', <DType.ROWVERSION: 'ROWVERSION'>: 'VARBYTE', <DType.SMALLDATETIME: 'SMALLDATETIME'>: 'TIMESTAMP', <DType.TINYINT: 'TINYINT'>: 'SMALLINT', <DType.FLOAT: 'FLOAT'>: 'REAL', <DType.DOUBLE: 'DOUBLE'>: 'DOUBLE PRECISION', <DType.BINARY: 'BINARY'>: 'VARBYTE', <DType.VARBINARY: 'VARBINARY'>: 'VARBYTE', <DType.DATETIME: 'DATETIME'>: 'TIMESTAMP', <DType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>: 'TIMESTAMP', <DType.INT: 'INT'>: 'INTEGER', <DType.TIMETZ: 'TIMETZ'>: 'TIME', <DType.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'TIMESTAMP'}
TRANSFORMS = {<class 'sqlglot.expressions.query.JSONPathKey'>: <function json_path_key_only_name>, <class 'sqlglot.expressions.query.JSONPathRoot'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.query.JSONPathSubscript'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.core.Adjacent'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.AnalyzeColumns'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.AnalyzeWith'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.array.ArrayContainedBy'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.array.ArrayContainsAll'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.array.ArrayOverlaps'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.AssumeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.BinaryColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.CalledOnNullInputProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.math.Ceil'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.functions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.string.ConvertToCharset'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.properties.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.CopyTagsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.CredentialsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.functions.CurrentCatalog'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.functions.SessionUser'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ApiProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ApplicationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.CatalogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ComputeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.DatabaseProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.EndStatement'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.EnviromentProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.HandlerProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ParameterStyleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.Except'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.math.Floor'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.Get'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.HybridProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.IgnoreGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.Intersect'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.datatypes.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.functions.Int64'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONBContainsAnyTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONBContainsAllTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONBContainsTopKey'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONBDeleteAtPath'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONBPathExists'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONObject'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.MaskingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.functions.NetFunc'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.NetworkProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.core.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.core.ExtendsLeft'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.core.ExtendsRight'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.PartitionedByBucket'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.PartitionByTruncate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.core.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.array.PositionalColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.InvisibleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.ZeroFillColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.Put'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.RowAccessProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.core.SafeFunc'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SecurityIntegrationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ddl.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.TableColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.array.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.VirtualProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ddl.TriggerExecute'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.Union'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.UsingTemplateProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.UsingData'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.temporal.UtcDate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.temporal.UtcTime'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.temporal.UtcTimestamp'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.query.Variadic'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.array.VarMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.constraints.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.WithoutRowidProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.array.ArrayConcat'>: <function array_concat_sql.<locals>._array_concat_sql>, <class 'sqlglot.expressions.array.ArrayFilter'>: <function filter_array_using_unnest>, <class 'sqlglot.expressions.array.ArrayAppend'>: <function array_append_sql.<locals>._array_append_sql>, <class 'sqlglot.expressions.array.ArrayPrepend'>: <function array_append_sql.<locals>._array_append_sql>, <class 'sqlglot.expressions.math.BitwiseAndAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.math.BitwiseOrAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.core.BitwiseXor'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.math.BitwiseXorAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.query.ColumnDef'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.temporal.CurrentDate'>: <function no_paren_current_date_sql>, <class 'sqlglot.expressions.functions.CurrentUser'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.functions.CurrentVersion'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.temporal.DateAdd'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.DateDiff'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.DateFromParts'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.temporal.DateStrToDate'>: <function datestrtodate_sql>, <class 'sqlglot.expressions.temporal.DateSub'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.temporal.DatetimeAdd'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.temporal.DatetimeSub'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.temporal.Day'>: <function _day_month_year_sql>, <class 'sqlglot.expressions.array.Explode'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.array.ExplodingGenerateSeries'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.array.GenerateSeries'>: <function generate_series_sql.<locals>._generate_series_sql>, <class 'sqlglot.expressions.aggregate.GroupConcat'>: <function groupconcat_sql>, <class 'sqlglot.expressions.json.JSONArrayAgg'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.json.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.json.JSONExtractScalar'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.json.JSONBExtract'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.json.JSONBExtractScalar'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.string.Left'>: <function _left_right_sql>, <class 'sqlglot.expressions.aggregate.LogicalOr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.aggregate.LogicalAnd'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.aggregate.Max'>: <function max_or_greatest>, <class 'sqlglot.expressions.array.MapFromEntries'>: <function no_map_from_entries_sql>, <class 'sqlglot.expressions.aggregate.Min'>: <function min_or_least>, <class 'sqlglot.expressions.dml.Merge'>: <function merge_without_target_sql>, <class 'sqlglot.expressions.temporal.Month'>: <function _day_month_year_sql>, <class 'sqlglot.expressions.properties.PartitionedByProperty'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.aggregate.PercentileCont'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.aggregate.PercentileDisc'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.functions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.string.RegexpILike'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.string.RegexpReplace'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.string.Right'>: <function _left_right_sql>, <class 'sqlglot.expressions.query.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.string.SHA2Digest'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.string.StrPosition'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.StrToDate'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.StrToTime'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.array.StructExtract'>: <function struct_extract_sql>, <class 'sqlglot.expressions.string.Substring'>: <function _substring_sql>, <class 'sqlglot.expressions.temporal.TimeFromParts'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.temporal.TimestampFromParts'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.temporal.TimestampTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.temporal.TimestampAdd'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.temporal.TimestampSub'>: <function _date_add_sql.<locals>.func>, <class 'sqlglot.expressions.temporal.TimeStrToTime'>: <function timestrtotime_sql>, <class 'sqlglot.expressions.temporal.TimeToStr'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.string.ToChar'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.string.Trim'>: <function trim_sql>, <class 'sqlglot.expressions.temporal.TsOrDsAdd'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.TsOrDsDiff'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.UnixToTime'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.functions.Uuid'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.TimeToUnix'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.aggregate.VariancePop'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.core.Xor'>: <function bool_xor_sql>, <class 'sqlglot.expressions.temporal.Year'>: <function _day_month_year_sql>, <class 'sqlglot.expressions.string.Unicode'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.string.Levenshtein'>: <function _levenshtein_sql>, <class 'sqlglot.expressions.json.JSONBObjectAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.aggregate.CountIf'>: <function count_if_to_sum>, <class 'sqlglot.expressions.properties.FileFormatProperty'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.properties.TableSpaceProperty'>: <function PostgresGenerator.<lambda>>, <class 'sqlglot.expressions.string.Concat'>: <function concat_to_dpipe_sql>, <class 'sqlglot.expressions.string.ConcatWs'>: <function concat_ws_to_dpipe_sql>, <class 'sqlglot.expressions.core.ApproxDistinct'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.CurrentTimestamp'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.functions.CurrentUserId'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.properties.DistKeyProperty'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.properties.DistStyleProperty'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.string.FarmFingerprint'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.string.FromBase'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.constraints.GeneratedAsIdentityColumnConstraint'>: <function generatedasidentitycolumnconstraint_sql>, <class 'sqlglot.expressions.string.Hex'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.string.RegexpExtract'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.properties.SortKeyProperty'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.string.StartsWith'>: <function RedshiftGenerator.<lambda>>, <class 'sqlglot.expressions.array.StringToArray'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.query.TableSample'>: <function no_tablesample_sql>}
RESERVED_KEYWORDS = {'all', 'current_date', 'for', 'delta32k', 'tag', 'notnull', 'union', 'offline', 'user', 'disable', 'truncatecolumns', 'some', 'system', 'references', 'desc', 'where', 'bzip2', 'text255', 'unpivot', 'or', 'intersect', 'similar', 'raw', 'allowoverwrite', 'is', 'minus', 'outer', 'bytedict', 'both', 'any', 'binary', 'isnull', 'blanksasnull', 'analyze', 'as', 'distinct', 'backup', 'cross', 'nulls', 'current_timestamp', 'permissions', 'order', 'localtime', 'aes128', 'null', 'aes256', 'asc', 'encryption', 'respect', 'lun', 'column', 'sysdate', 'explicit', 'check', 'globaldict256', 'ignore', 'leading', 'deflate', 'open', 'oid', 'right', 'credentials', 'having', 'into', 'lzo', 'pivot', 'grant', 'readratio', 'mostly8', 'false', 'unique', 'left', 'partition', 'timestamp', 'mostly32', 'trailing', 'array', 'session_user', 'identity', 'overlaps', 'localtimestamp', 'then', 'do', 'limit', 'percent', 'lzop', 'full', 'to', 'using', 'deferrable', 'delta', 'off', 'wallet', 'from', 'recover', 'in', 'join', 'when', 'current_user', 'current_user_id', 'collate', 'freeze', 'default', 'end', 'inner', 'placing', 'verbose', 'defrag', 'ilike', 'natural', 'select', 'restore', 'type', 'authorization', 'cast', 'true', 'snapshot', 'gzip', 'on', 'like', 'primary', 'emptyasnull', 'unnest', 'encode', 'and', 'globaldict64k', 'old', 'rejectlog', 'else', 'case', 'initially', 'only', 'offset', 'between', 'not', 'tdes', 'constraint', 'group', 'except', 'analyse', 'foreign', 'resort', 'current_time', 'table', 'top', 'new', 'interval', 'create', 'luns', 'mostly16', 'az64', 'text32k', 'without', 'parallel', 'encrypt ', 'with', 'enable'}
def bytestring_sql(self, expression: sqlglot.expressions.query.ByteString) -> str:
295    def bytestring_sql(self, expression: exp.ByteString) -> str:
296        if not expression.args.get("is_bytes"):
297            return self.sql(exp.Literal.string(expression.this))
298
299        return self.func("FROM_HEX", exp.Literal.string(expression.this.encode("latin-1").hex()))
def stpoint_sql(self, expression: sqlglot.expressions.array.StPoint) -> str:
301    def stpoint_sql(self, expression: exp.StPoint) -> str:
302        # ST_POINT only accepts 2 args in Redshift; use ST_MAKEPOINT for 3 or 4 args
303        if expression.args.get("z") or expression.args.get("m"):
304            return self.func(
305                "ST_MAKEPOINT",
306                expression.this,
307                expression.expression,
308                expression.args.get("z"),
309                expression.args.get("m"),
310            )
311        return self.func("ST_POINT", expression.this, expression.expression)
def arraycontains_sql(self, expression: sqlglot.expressions.array.ArrayContains) -> str:
313    def arraycontains_sql(self, expression: exp.ArrayContains) -> str:
314        return self.func(
315            "ARRAY_CONTAINS",
316            expression.this,
317            expression.expression,
318            expression.args.get("check_null"),
319        )
def objecttransform_sql(self, expression: sqlglot.expressions.functions.ObjectTransform) -> str:
321    def objecttransform_sql(self, expression: exp.ObjectTransform) -> str:
322        this = self.sql(expression, "this")
323        keep = self.expressions(expression, key="keep", flat=True)
324        set_ = self.expressions(expression, key="set_", flat=True)
325        keep_sql = " KEEP " + keep if keep else ""
326        set_sql = " SET " + set_ if set_ else ""
327        return f"OBJECT_TRANSFORM({this}{keep_sql}{set_sql})"
def approxquantile_sql(self, expression: sqlglot.expressions.aggregate.ApproxQuantile) -> str:
329    def approxquantile_sql(self, expression: exp.ApproxQuantile) -> str:
330        return "APPROXIMATE " + self.sql(
331            exp.WithinGroup(
332                this=exp.PercentileDisc(this=expression.args["quantile"]),
333                expression=exp.Order(expressions=[exp.Ordered(this=expression.this)]),
334            )
335        )
def unnest_sql(self, expression: sqlglot.expressions.array.Unnest) -> str:
337    def unnest_sql(self, expression: exp.Unnest) -> str:
338        args = expression.expressions
339        num_args = len(args)
340
341        if num_args != 1:
342            self.unsupported(f"Unsupported number of arguments in UNNEST: {num_args}")
343            return ""
344
345        if isinstance(expression.find_ancestor(exp.From, exp.Join, exp.Select), exp.Select):
346            self.unsupported("Unsupported UNNEST when not used in FROM/JOIN clauses")
347            return ""
348
349        arg = self.sql(seq_get(args, 0))
350
351        alias = self.expressions(expression.args.get("alias"), key="columns", flat=True)
352        return f"{arg} AS {alias}" if alias else arg
def cast_sql( self, expression: sqlglot.expressions.functions.Cast, safe_prefix: str | None = None) -> str:
354    def cast_sql(self, expression: exp.Cast, safe_prefix: str | None = None) -> str:
355        if expression.is_type(exp.DType.JSON):
356            # Redshift doesn't support a JSON type, so casting to it is treated as a noop
357            return self.sql(expression, "this")
358
359        return super().cast_sql(expression, safe_prefix=safe_prefix)
def datatype_sql(self, expression: sqlglot.expressions.datatypes.DataType) -> str:
361    def datatype_sql(self, expression: exp.DataType) -> str:
362        """
363        Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean
364        VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type
365        without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert
366        `TEXT` to `VARCHAR`.
367        """
368        if expression.is_type("text"):
369            expression.set("this", exp.DType.VARCHAR)
370            precision = expression.args.get("expressions")
371
372            if not precision:
373                expression.append("expressions", exp.var("MAX"))
374
375        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.

def alterset_sql(self, expression: sqlglot.expressions.ddl.AlterSet) -> str:
377    def alterset_sql(self, expression: exp.AlterSet) -> str:
378        exprs = self.expressions(expression, flat=True)
379        exprs = f" TABLE PROPERTIES ({exprs})" if exprs else ""
380        location = self.sql(expression, "location")
381        location = f" LOCATION {location}" if location else ""
382        file_format = self.expressions(expression, key="file_format", flat=True, sep=" ")
383        file_format = f" FILE FORMAT {file_format}" if file_format else ""
384
385        return f"SET{exprs}{location}{file_format}"
def arraysize_sql(self, expression: sqlglot.expressions.array.ArraySize) -> str:
387    def arraysize_sql(self, expression: exp.ArraySize) -> str:
388        if not expression.expression:
389            return self.func("GET_ARRAY_LENGTH", expression.this)
390
391        return Generator.arraysize_sql(self, expression)
def array_sql(self, expression: sqlglot.expressions.array.Array) -> str:
393    def array_sql(self, expression: exp.Array) -> str:
394        if expression.args.get("bracket_notation"):
395            return super().array_sql(expression)
396
397        return rename_func("ARRAY")(self, expression)
def struct_sql(self, expression: sqlglot.expressions.array.Struct) -> str:
399    def struct_sql(self, expression: exp.Struct) -> str:
400        self.unsupported("Redshift does not support row constructors")
401        return super().struct_sql(expression)
def ignorenulls_sql(self, expression: sqlglot.expressions.core.IgnoreNulls) -> str:
403    def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
404        return Generator.ignorenulls_sql(self, expression)
def respectnulls_sql(self, expression: sqlglot.expressions.core.RespectNulls) -> str:
406    def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
407        return Generator.respectnulls_sql(self, expression)
def explode_sql(self, expression: sqlglot.expressions.array.Explode) -> str:
409    def explode_sql(self, expression: exp.Explode) -> str:
410        self.unsupported("Unsupported EXPLODE() function")
411        return ""
Inherited Members
sqlglot.generator.Generator
Generator
NULL_ORDERING_SUPPORTED
WINDOW_FUNCS_WITH_NULL_ORDERING
WINDOW_FUNCS_REQUIRING_ORDER
IGNORE_NULLS_IN_FUNC
IGNORE_NULLS_BEFORE_ORDER
WRAP_DERIVED_VALUES
CREATE_FUNCTION_RETURN_AS
MATCHED_BY_SOURCE
SUPPORTS_MERGE_WHERE
MERGE_SCHEMA_EVOLUTION_MIN_VERSION
MERGE_ALL_BY_NAME
INTERVAL_ALLOWS_PLURAL_FORM
AUTO_REFRESH_BARE_INTERVALS
LIMIT_ONLY_LITERALS
GROUPINGS_SEP
SUPPORTS_GROUPING_SETS_AS_SUFFIX
INDEX_ON
DIRECTED_JOINS
SUPPORTS_NEAREST_JOIN
SUPPORTS_MATCH_CONDITION
MATCH_CONDITION_IN_ON
QUERY_HINT_SEP
IS_BOOL_ALLOWED
SAFE_INT_DIVISION
INT_DIV_OPERATOR
DUPLICATE_KEY_UPDATE_WITH_SET
LIMIT_IS_TOP
RETURNING_END
EXTRACT_ALLOWS_QUOTES
ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
ALTER_TABLE_ADD_COLUMNS_WRAPPED
UNNEST_WITH_ORDINALITY
SEMI_ANTI_JOIN_WITH_SIDE
COMPUTED_COLUMN_WITH_TYPE
SUPPORTS_TABLE_COPY
TABLESAMPLE_REQUIRES_PARENS
TABLESAMPLE_KEYWORDS
TABLESAMPLE_WITH_METHOD
HISTORICAL_DATA_POST_ALIAS
COLLATE_IS_FUNC
DATA_TYPE_SPECIFIERS_ALLOWED
ENSURE_BOOLS
CTE_RECURSIVE_KEYWORD_REQUIRED
SUPPORTS_SINGLE_ARG_CONCAT
SUPPORTS_TABLE_ALIAS_COLUMNS
SUPPORTS_NAMED_CTE_COLUMNS
UNPIVOT_ALIASES_ARE_IDENTIFIERS
PIVOT_ALIAS_WITH_AS
JSON_KEY_VALUE_PAIR_SEP
INSERT_OVERWRITE
SUPPORTS_OPTIMIZE
SUPPORTS_EXECUTE_IMMEDIATE
SUPPORTS_CREATE_TABLE_LIKE
SUPPORTS_MODIFY_COLUMN
SUPPORTS_CHANGE_COLUMN
SUPPORTS_ALTER_COLUMN_NULLABILITY
SUPPORTS_ALTER_COLUMN_IF_EXISTS
SUPPORTS_NESTED_JSON_SELECT
JSON_PATH_BRACKETED_KEY_SUPPORTED
JSON_PATH_SINGLE_QUOTE_ESCAPE
JSON_PATH_KEY_QUOTED_FORCES_BRACKETS
SUPPORTS_TO_NUMBER
SET_OP_MODIFIERS
SET_OP_LIMITS
SET_OP_PARENTHESIZED_OPERANDS
COPY_PARAMS_EQ_REQUIRED
SUPPORTS_UESCAPE
UNICODE_SUBSTITUTE
BYTE_STRING_FUNCTION
QUOTE_JSON_PATH
PAD_FILL_PATTERN_IS_REQUIRED
SUPPORTS_EXPLODING_PROJECTIONS
SUPPORTS_UNIX_SECONDS
ALTER_SET_WRAPPED
NORMALIZE_EXTRACT_DATE_PARTS
ARRAY_SIZE_NAME
DAYOFWEEK_NAME
VARIANCE_RETURNS_ZERO_ON_SINGLE_VALUE
SUPPORTS_LIKE_QUANTIFIERS
MATCH_AGAINST_TABLE_PREFIX
SET_ASSIGNMENT_REQUIRES_VARIABLE_KEYWORD
DECLARE_DEFAULT_ASSIGNMENT
UPDATE_STATEMENT_SUPPORTS_FROM
SUPPORTS_DROP_ALTER_ICEBERG_PROPERTY
UNSUPPORTED_TYPES
TYPE_PARAM_SETTINGS
TIME_PART_SINGULARS
TOKEN_MAPPING
STRUCT_DELIMITER
EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
WITH_SEPARATED_COMMENTS
EXCLUDE_COMMENTS
UNWRAPPED_INTERVAL_VALUES
PARAMETERIZABLE_TEXT_TYPES
EXPRESSIONS_WITHOUT_NESTED_CTES
RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS
MOD_OPERATOR
MOD_PAREN_PARENT_TYPES
ALTER_PARTITION_OPTIONS
SAFE_JSON_PATH_KEY_RE
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
sanitize_comment
maybe_comment
wrap
no_identify
normalize_func
indent
sql
uncache_sql
cache_sql
characterset_sql
column_parts
column_sql
pseudocolumn_sql
columnposition_sql
columnconstraint_sql
autoincrementcolumnconstraint_sql
compresscolumnconstraint_sql
generatedasidentitycolumnconstraint_sql
generatedasrowcolumnconstraint_sql
periodforsystemtimeconstraint_sql
notnullcolumnconstraint_sql
primarykeycolumnconstraint_sql
uniquecolumnconstraint_sql
inoutcolumnconstraint_sql
createable_sql
create_sql
sequenceproperties_sql
triggerproperties_sql
triggerreferencing_sql
triggerevent_sql
clone_sql
describe_sql
heredoc_sql
prepend_ctes
with_sql
cte_sql
tablealias_sql
bitstring_sql
hexstring_sql
unicodestring_sql
rawstring_sql
datatypeparam_sql
datatype_param_bound_limiter
directory_sql
delete_sql
drop_sql
set_operation
set_operations
fetch_sql
limitoptions_sql
filter_sql
per_sql
hint_sql
indexparameters_sql
index_sql
dynamicidentifier_sql
identifier_sql
hex_sql
lowerhex_sql
inputoutputformat_sql
national_sql
partition_sql
properties_sql
root_properties
properties
locate_properties
property_name
property_sql
uuidproperty_sql
likeproperty_sql
fallbackproperty_sql
journalproperty_sql
freespaceproperty_sql
checksumproperty_sql
mergeblockratioproperty_sql
moduleproperty_sql
datablocksizeproperty_sql
blockcompressionproperty_sql
isolatedloadingproperty_sql
partitionboundspec_sql
partitionedofproperty_sql
lockingproperty_sql
lockingstatement_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
tableargument_sql
tablefromrows_sql
tablesample_sql
pivot_sql
version_sql
tuple_sql
update_sql
values_sql
var_sql
into_sql
from_sql
groupingsets_sql
rollup_sql
rollupindex_sql
rollupproperty_sql
cube_sql
group_sql
having_sql
connectto_sql
disconnect_sql
connect_sql
prior_sql
join_sql
nearest_sql
lambda_sql
lateral_op
limit_sql
offset_sql
setitem_sql
set_sql
queryband_sql
pragma_sql
lock_sql
literal_sql
escape_str
loaddata_sql
null_sql
boolean_sql
booland_sql
boolor_sql
order_sql
withfill_sql
cluster_sql
clusterproperty_sql
distribute_sql
sort_sql
ordered_sql
matchrecognizemeasure_sql
matchrecognize_sql
query_modifiers
options_modifier
forclause_sql
queryoption_sql
offset_limit_modifiers
after_limit_modifiers
select_sql
schema_sql
schema_columns_sql
parameter_sql
sessionparameter_sql
subquery_sql
qualify_sql
prewhere_sql
where_sql
window_sql
partition_by_sql
partitionbyexcluding_sql
windowspec_sql
withingroup_sql
between_sql
bracket_offset_expressions
all_sql
any_sql
exists_sql
case_sql
constraint_sql
nextvaluefor_sql
dayofweek_sql
extract_date_part
trim_sql
convert_concat_args
concat_sql
concatws_sql
check_sql
foreignkey_sql
primarykey_sql
timeserieskey_sql
if_sql
jsonkeyvalue_sql
jsonpath_sql
json_path_part
format_sql
formatjson_sql
formatphrase_sql
teradataconversion_sql
teradatatitle_sql
teradatanamed_sql
jsonarray_sql
jsonarrayagg_sql
jsoncolumndef_sql
jsonschema_sql
jsontable_sql
openjsoncolumndef_sql
openjson_sql
in_sql
in_unnest_op
return_sql
reference_sql
anonymous_sql
paren_sql
neg_sql
not_sql
alias_sql
pivotalias_sql
aliases_sql
atindex_sql
attimezone_sql
fromtimezone_sql
fromiso8601date_sql
fromiso8601timestamp_sql
fromiso8601timestampnanos_sql
add_sql
and_sql
or_sql
xor_sql
connector_sql
bitwiseand_sql
bitwiseleftshift_sql
bitwiseor_sql
bitwiserightshift_sql
bitwisexor_sql
strtotime_sql
strtodate_sql
parsedatetime_sql
currentdate_sql
collate_sql
command_sql
optimize_sql
comment_sql
mergetreettlaction_sql
mergetreettl_sql
transaction_sql
commit_sql
rollback_sql
altercolumn_sql
modifycolumn_sql
alterindex_sql
alterdiststyle_sql
altersortkey_sql
alterrename_sql
renamecolumn_sql
alter_sql
altersession_sql
add_column_sql
droppartition_sql
dropprimarykey_sql
addconstraint_sql
replacecolumns_sql
addpartition_sql
distinct_sql
havingmax_sql
intdiv_sql
dpipe_sql
nullif_zero_divisor
div_sql
safedivide_sql
overlaps_sql
distance_sql
distancend_sql
dot_sql
nestedjsonselect_sql
eq_sql
propertyeq_sql
escape_sql
glob_sql
gt_sql
gte_sql
is_sql
like_sql
ilike_sql
match_sql
similarto_sql
lt_sql
lte_sql
mod_sql
mul_sql
neq_sql
nullsafeeq_sql
nullsafeneq_sql
sub_sql
trycast_sql
jsoncast_sql
try_sql
log_sql
use_sql
binary
ceil_floor
function_fallback_sql
function_name
func
format_args
too_wide
format_time
expressions
op_expressions
naked_property
tag_sql
token_sql
userdefinedfunction_sql
macrooverloads_sql
macrooverload_sql
joinhint_sql
kwarg_sql
when_sql
whens_sql
merge_sql
tochar_sql
tonumber_sql
dictproperty_sql
dictrange_sql
dictsubproperty_sql
aggregatekeyproperty_sql
duplicatekeyproperty_sql
uniquekeyproperty_sql
distributedbyproperty_sql
oncluster_sql
clusteredbyproperty_sql
anyvalue_sql
querytransform_sql
indexconstraintoption_sql
checkcolumnconstraint_sql
indexcolumnconstraint_sql
nvl2_sql
nthvalue_sql
comprehension_sql
columnprefix_sql
opclass_sql
predict_sql
generateembedding_sql
generatetext_sql
generatetable_sql
generatebool_sql
generateint_sql
generatedouble_sql
mltranslate_sql
mlforecast_sql
aiforecast_sql
featuresattime_sql
vectorsearch_sql
forin_sql
refresh_sql
toarray_sql
tsordstotime_sql
tsordstotimestamp_sql
tsordstodatetime_sql
tsordstodate_sql
unixdate_sql
lastday_sql
dateadd_sql
arrayinsert_sql
arrayany_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
converttimezone_sql
json_sql
jsonvalue_sql
skipjsoncolumn_sql
conditionalinsert_sql
multitableinserts_sql
oncondition_sql
jsonextractquote_sql
jsonexists_sql
min_sql
max_sql
arrayagg_sql
timeslice_sql
slice_sql
apply_sql
grant_sql
revoke_sql
grantprivilege_sql
grantprincipal_sql
columns_sql
overlay_sql
todouble_sql
string_sql
median_sql
overflowtruncatebehavior_sql
unixseconds_sql
arraysort_sql
variance_sql
attach_sql
detach_sql
attachoption_sql
watermarkcolumnconstraint_sql
encodeproperty_sql
includeproperty_sql
xmlelement_sql
xmlkeyvalueoption_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
export_sql
declare_sql
declareitem_sql
recursivewithsearch_sql
parameterizedagg_sql
anonymousaggfunc_sql
combinedaggfunc_sql
combinedparameterizedagg_sql
show_sql
install_sql
liststage_sql
get_put_sql
translatecharacters_sql
decodecase_sql
semanticview_sql
getextract_sql
datefromunixdate_sql
space_sql
buildproperty_sql
refreshtriggerproperty_sql
modelattribute_sql
directorystage_sql
uuid_sql
initcap_sql
localtime_sql
localtimestamp_sql
weekstart_name
weekstart_sql
datetrunc_sql
chr_sql
weightstring_sql
block_sql
functionspecification_sql
storedprocedure_sql
ifblock_sql
casestatement_sql
whileblock_sql
loopblock_sql
repeatblock_sql
leave_sql
iterate_sql
execute_sql
executesql_sql
executeimmediate_sql
altermodifysqlsecurity_sql
usingproperty_sql
renameindex_sql
sqlglot.generators.postgres.PostgresGenerator
BARE_OPERATORS
DAYOFWEEK_ZERO_BASED
SELECT_KINDS
VARIANCE_NAME
TRY_SUPPORTED
SUPPORTS_MULTI_ARG_CHR
AFTER_HAVING_MODIFIER_TRANSFORMS
SINGLE_STRING_INTERVAL
RENAME_TABLE_WITH_DB
JOIN_HINTS
TABLE_HINTS
PARAMETER_TOKEN
NAMED_PLACEHOLDER_TOKEN
TABLESAMPLE_SIZE_IS_ROWS
TABLESAMPLE_SEED_KEYWORD
SUPPORTS_SELECT_INTO
JSON_TYPE_REQUIRED_FOR_EXTRACTION
SUPPORTS_UNLOGGED_TABLES
LIKE_PROPERTY_INSIDE_SCHEMA
SUPPORTS_WINDOW_EXCLUDE
COPY_HAS_INTO_KEYWORD
ARRAY_SIZE_DIM_REQUIRED
INOUT_SEPARATOR
SUPPORTED_JSON_PATH_PARTS
lateral_sql
star_sql
with_properties
extract_sql
jsonobjectagg_sql
schemacommentproperty_sql
commentcolumnconstraint_sql
columndef_sql
bracket_sql
matchagainst_sql
computedcolumnconstraint_sql
isascii_sql
regexpfullmatch_sql
pos_sql
bitwisenot_sql
regexplike_sql
currentschema_sql
currenttime_sql
currenttimestamp_sql
interval_sql
placeholder_sql