Edit on GitHub

sqlglot.generators.sqlite

  1from __future__ import annotations
  2
  3import typing as t
  4
  5from sqlglot import exp, generator, transforms
  6from sqlglot.dialects.dialect import (
  7    any_value_to_max_sql,
  8    arrow_json_extract_sql,
  9    concat_to_dpipe_sql,
 10    count_if_to_sum,
 11    no_ilike_sql,
 12    no_pivot_sql,
 13    no_tablesample_sql,
 14    no_trycast_sql,
 15    rename_func,
 16    strposition_sql,
 17)
 18from sqlglot.generator import unsupported_args
 19from sqlglot.tokens import TokenType
 20
 21
 22def _transform_create(expression: exp.Expr) -> exp.Expr:
 23    """Move primary key to a column and enforce auto_increment on primary keys."""
 24    schema = expression.this
 25
 26    if isinstance(expression, exp.Create) and isinstance(schema, exp.Schema):
 27        defs = {}
 28        primary_key = None
 29
 30        for e in schema.expressions:
 31            if isinstance(e, exp.ColumnDef):
 32                defs[e.name] = e
 33            elif isinstance(e, exp.PrimaryKey):
 34                primary_key = e
 35
 36        if primary_key and len(primary_key.expressions) == 1:
 37            column = defs[primary_key.expressions[0].name]
 38            column.append(
 39                "constraints", exp.ColumnConstraint(kind=exp.PrimaryKeyColumnConstraint())
 40            )
 41            schema.expressions.remove(primary_key)
 42        else:
 43            for column in defs.values():
 44                auto_increment = None
 45                for constraint in column.constraints:
 46                    if isinstance(constraint.kind, exp.PrimaryKeyColumnConstraint):
 47                        break
 48                    if isinstance(constraint.kind, exp.AutoIncrementColumnConstraint):
 49                        auto_increment = constraint
 50                if auto_increment:
 51                    column.constraints.remove(auto_increment)
 52
 53    return expression
 54
 55
 56def _generated_to_auto_increment(expression: exp.Expr) -> exp.Expr:
 57    if not isinstance(expression, exp.ColumnDef):
 58        return expression
 59
 60    generated = expression.find(exp.GeneratedAsIdentityColumnConstraint)
 61
 62    if generated:
 63        t.cast(exp.ColumnConstraint, generated.parent).pop()
 64
 65        not_null = expression.find(exp.NotNullColumnConstraint)
 66        if not_null:
 67            t.cast(exp.ColumnConstraint, not_null.parent).pop()
 68
 69        expression.append(
 70            "constraints", exp.ColumnConstraint(kind=exp.AutoIncrementColumnConstraint())
 71        )
 72
 73    return expression
 74
 75
 76class SQLiteGenerator(generator.Generator):
 77    SELECT_KINDS: tuple[str, ...] = ()
 78    TRY_SUPPORTED = False
 79    SUPPORTS_UESCAPE = False
 80    SUPPORTS_DECODE_CASE = False
 81
 82    AFTER_HAVING_MODIFIER_TRANSFORMS = generator.AFTER_HAVING_MODIFIER_TRANSFORMS
 83
 84    JOIN_HINTS = False
 85    TABLE_HINTS = False
 86    QUERY_HINTS = False
 87    NVL2_SUPPORTED = False
 88    JSON_PATH_BRACKETED_KEY_SUPPORTED = False
 89    SUPPORTS_CREATE_TABLE_LIKE = False
 90    SUPPORTS_TABLE_ALIAS_COLUMNS = False
 91    SUPPORTS_TO_NUMBER = False
 92    SUPPORTS_WINDOW_EXCLUDE = True
 93    EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE = False
 94    SUPPORTS_MEDIAN = False
 95    JSON_KEY_VALUE_PAIR_SEP = ","
 96    PARSE_JSON_NAME: str | None = None
 97
 98    SUPPORTED_JSON_PATH_PARTS = {
 99        exp.JSONPathKey,
100        exp.JSONPathRoot,
101        exp.JSONPathSubscript,
102    }
103
104    TYPE_MAPPING = {
105        **{k: v for k, v in generator.Generator.TYPE_MAPPING.items() if k != exp.DType.BLOB},
106        exp.DType.BOOLEAN: "INTEGER",
107        exp.DType.TINYINT: "INTEGER",
108        exp.DType.SMALLINT: "INTEGER",
109        exp.DType.INT: "INTEGER",
110        exp.DType.BIGINT: "INTEGER",
111        exp.DType.FLOAT: "REAL",
112        exp.DType.DOUBLE: "REAL",
113        exp.DType.DECIMAL: "REAL",
114        exp.DType.CHAR: "TEXT",
115        exp.DType.NCHAR: "TEXT",
116        exp.DType.VARCHAR: "TEXT",
117        exp.DType.NVARCHAR: "TEXT",
118        exp.DType.BINARY: "BLOB",
119        exp.DType.VARBINARY: "BLOB",
120    }
121
122    TOKEN_MAPPING = {
123        TokenType.AUTO_INCREMENT: "AUTOINCREMENT",
124    }
125
126    TRANSFORMS = {
127        **generator.Generator.TRANSFORMS,
128        exp.AnyValue: any_value_to_max_sql,
129        exp.Chr: rename_func("CHAR"),
130        exp.Concat: concat_to_dpipe_sql,
131        exp.CountIf: count_if_to_sum,
132        exp.Create: transforms.preprocess([_transform_create]),
133        exp.CurrentDate: lambda *_: "CURRENT_DATE",
134        exp.CurrentTime: lambda *_: "CURRENT_TIME",
135        exp.CurrentTimestamp: lambda *_: "CURRENT_TIMESTAMP",
136        exp.CurrentVersion: lambda *_: "SQLITE_VERSION()",
137        exp.ColumnDef: transforms.preprocess([_generated_to_auto_increment]),
138        exp.DateStrToDate: lambda self, e: self.sql(e, "this"),
139        exp.If: rename_func("IIF"),
140        exp.ILike: no_ilike_sql,
141        exp.JSONArrayAgg: unsupported_args("order", "null_handling", "return_type", "strict")(
142            rename_func("JSON_GROUP_ARRAY")
143        ),
144        exp.JSONExtractScalar: arrow_json_extract_sql,
145        exp.JSONObjectAgg: lambda self, e: self._jsonobject_sql(e, name="JSON_GROUP_OBJECT"),
146        exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")(
147            rename_func("EDITDIST3")
148        ),
149        exp.LogicalOr: rename_func("MAX"),
150        exp.LogicalAnd: rename_func("MIN"),
151        exp.Pivot: no_pivot_sql,
152        exp.Rand: rename_func("RANDOM"),
153        exp.Select: transforms.preprocess(
154            [
155                transforms.eliminate_distinct_on,
156                transforms.eliminate_qualify,
157                transforms.eliminate_semi_and_anti_joins,
158            ]
159        ),
160        exp.StrPosition: lambda self, e: strposition_sql(self, e, func_name="INSTR"),
161        exp.TableSample: no_tablesample_sql,
162        exp.TimeStrToTime: lambda self, e: self.sql(e, "this"),
163        exp.TimeToStr: lambda self, e: self.func("STRFTIME", e.args.get("format"), e.this),
164        exp.TryCast: no_trycast_sql,
165        exp.TsOrDsToTimestamp: lambda self, e: self.sql(e, "this"),
166    }
167
168    # SQLite doesn't generally support CREATE TABLE .. properties
169    # https://www.sqlite.org/lang_createtable.html
170    PROPERTIES_LOCATION = {
171        **{
172            prop: exp.Properties.Location.UNSUPPORTED
173            for prop in generator.Generator.PROPERTIES_LOCATION
174        },
175        # There are a few exceptions (e.g. temporary tables) which are supported or
176        # can be transpiled to SQLite, so we explicitly override them accordingly
177        exp.LikeProperty: exp.Properties.Location.POST_SCHEMA,
178        exp.ModuleProperty: exp.Properties.Location.POST_SCHEMA,
179        exp.TemporaryProperty: exp.Properties.Location.POST_CREATE,
180        exp.VirtualProperty: exp.Properties.Location.POST_CREATE,
181    }
182
183    LIMIT_FETCH = "LIMIT"
184
185    def bitwiseandagg_sql(self, expression: exp.BitwiseAndAgg) -> str:
186        self.unsupported("BITWISE_AND aggregation is not supported in SQLite")
187        return self.function_fallback_sql(expression)
188
189    def bitwiseoragg_sql(self, expression: exp.BitwiseOrAgg) -> str:
190        self.unsupported("BITWISE_OR aggregation is not supported in SQLite")
191        return self.function_fallback_sql(expression)
192
193    def bitwisexoragg_sql(self, expression: exp.BitwiseXorAgg) -> str:
194        self.unsupported("BITWISE_XOR aggregation is not supported in SQLite")
195        return self.function_fallback_sql(expression)
196
197    def jsonextract_sql(self, expression: exp.JSONExtract) -> str:
198        if expression.expressions:
199            return self.function_fallback_sql(expression)
200        return arrow_json_extract_sql(self, expression)
201
202    def dateadd_sql(self, expression: exp.DateAdd) -> str:
203        modifier = expression.expression
204        modifier = modifier.name if modifier.is_string else self.sql(modifier)
205        unit = expression.args.get("unit")
206        modifier = f"'{modifier} {unit.name}'" if unit else f"'{modifier}'"
207        return self.func("DATE", expression.this, modifier)
208
209    def cast_sql(self, expression: exp.Cast, safe_prefix: str | None = None) -> str:
210        if expression.is_type("date"):
211            return self.func("DATE", expression.this)
212
213        return super().cast_sql(expression)
214
215    # Note: SQLite's TRUNC always returns REAL (e.g., trunc(10.99) -> 10.0), not INTEGER.
216    # This creates a transpilation gap affecting division semantics, similar to Presto.
217    # Unlike Presto where this only affects decimals=0, SQLite has no decimals parameter
218    # so every use of TRUNC is affected. Modeling precisely would require exp.FloatTrunc.
219    @unsupported_args("decimals")
220    def trunc_sql(self, expression: exp.Trunc) -> str:
221        return self.func("TRUNC", expression.this)
222
223    def generateseries_sql(self, expression: exp.GenerateSeries) -> str:
224        parent = expression.parent
225        alias = parent and parent.args.get("alias")
226
227        if isinstance(alias, exp.TableAlias) and alias.columns:
228            column_alias = alias.columns[0]
229            alias.set("columns", None)
230            sql = self.sql(
231                exp.select(exp.alias_("value", column_alias)).from_(expression).subquery()
232            )
233        else:
234            sql = self.function_fallback_sql(expression)
235
236        return sql
237
238    def datediff_sql(self, expression: exp.DateDiff) -> str:
239        unit = expression.args.get("unit")
240        unit = unit.name.upper() if unit else "DAY"
241
242        sql = f"(JULIANDAY({self.sql(expression, 'this')}) - JULIANDAY({self.sql(expression, 'expression')}))"
243
244        if unit == "MONTH":
245            sql = f"{sql} / 30.0"
246        elif unit == "YEAR":
247            sql = f"{sql} / 365.0"
248        elif unit == "HOUR":
249            sql = f"{sql} * 24.0"
250        elif unit == "MINUTE":
251            sql = f"{sql} * 1440.0"
252        elif unit == "SECOND":
253            sql = f"{sql} * 86400.0"
254        elif unit == "MILLISECOND":
255            sql = f"{sql} * 86400000.0"
256        elif unit == "MICROSECOND":
257            sql = f"{sql} * 86400000000.0"
258        elif unit == "NANOSECOND":
259            sql = f"{sql} * 8640000000000.0"
260        else:
261            self.unsupported(f"DATEDIFF unsupported for '{unit}'.")
262
263        return f"CAST({sql} AS INTEGER)"
264
265    # https://www.sqlite.org/lang_aggfunc.html#group_concat
266    def groupconcat_sql(self, expression: exp.GroupConcat) -> str:
267        this = expression.this
268        distinct = expression.find(exp.Distinct)
269
270        if distinct:
271            this = distinct.expressions[0]
272            distinct_sql = "DISTINCT "
273        else:
274            distinct_sql = ""
275
276        if isinstance(expression.this, exp.Order):
277            self.unsupported("SQLite GROUP_CONCAT doesn't support ORDER BY.")
278            if expression.this.this and not distinct:
279                this = expression.this.this
280
281        separator = expression.args.get("separator")
282        return f"GROUP_CONCAT({distinct_sql}{self.format_args(this, separator)})"
283
284    def least_sql(self, expression: exp.Least) -> str:
285        if expression.expressions:
286            return rename_func("MIN")(self, expression)
287
288        return self.sql(expression, "this")
289
290    def greatest_sql(self, expression: exp.Greatest) -> str:
291        if expression.expressions:
292            return rename_func("MAX")(self, expression)
293
294        return self.sql(expression, "this")
295
296    def transaction_sql(self, expression: exp.Transaction) -> str:
297        this = expression.this
298        this = f" {this}" if this else ""
299        return f"BEGIN{this} TRANSACTION"
300
301    def isascii_sql(self, expression: exp.IsAscii) -> str:
302        return f"(NOT {self.sql(expression.this)} GLOB CAST(x'2a5b5e012d7f5d2a' AS TEXT))"
303
304    @unsupported_args("this")
305    def currentschema_sql(self, expression: exp.CurrentSchema) -> str:
306        return "'main'"
307
308    def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
309        self.unsupported("SQLite does not support IGNORE NULLS.")
310        return self.sql(expression.this)
311
312    def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
313        return self.sql(expression.this)
314
315    def windowspec_sql(self, expression: exp.WindowSpec) -> str:
316        if (
317            expression.text("kind").upper() == "RANGE"
318            and expression.text("start").upper() == "CURRENT ROW"
319        ):
320            return "RANGE CURRENT ROW"
321
322        return super().windowspec_sql(expression)
class SQLiteGenerator(sqlglot.generator.Generator):
 77class SQLiteGenerator(generator.Generator):
 78    SELECT_KINDS: tuple[str, ...] = ()
 79    TRY_SUPPORTED = False
 80    SUPPORTS_UESCAPE = False
 81    SUPPORTS_DECODE_CASE = False
 82
 83    AFTER_HAVING_MODIFIER_TRANSFORMS = generator.AFTER_HAVING_MODIFIER_TRANSFORMS
 84
 85    JOIN_HINTS = False
 86    TABLE_HINTS = False
 87    QUERY_HINTS = False
 88    NVL2_SUPPORTED = False
 89    JSON_PATH_BRACKETED_KEY_SUPPORTED = False
 90    SUPPORTS_CREATE_TABLE_LIKE = False
 91    SUPPORTS_TABLE_ALIAS_COLUMNS = False
 92    SUPPORTS_TO_NUMBER = False
 93    SUPPORTS_WINDOW_EXCLUDE = True
 94    EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE = False
 95    SUPPORTS_MEDIAN = False
 96    JSON_KEY_VALUE_PAIR_SEP = ","
 97    PARSE_JSON_NAME: str | None = None
 98
 99    SUPPORTED_JSON_PATH_PARTS = {
100        exp.JSONPathKey,
101        exp.JSONPathRoot,
102        exp.JSONPathSubscript,
103    }
104
105    TYPE_MAPPING = {
106        **{k: v for k, v in generator.Generator.TYPE_MAPPING.items() if k != exp.DType.BLOB},
107        exp.DType.BOOLEAN: "INTEGER",
108        exp.DType.TINYINT: "INTEGER",
109        exp.DType.SMALLINT: "INTEGER",
110        exp.DType.INT: "INTEGER",
111        exp.DType.BIGINT: "INTEGER",
112        exp.DType.FLOAT: "REAL",
113        exp.DType.DOUBLE: "REAL",
114        exp.DType.DECIMAL: "REAL",
115        exp.DType.CHAR: "TEXT",
116        exp.DType.NCHAR: "TEXT",
117        exp.DType.VARCHAR: "TEXT",
118        exp.DType.NVARCHAR: "TEXT",
119        exp.DType.BINARY: "BLOB",
120        exp.DType.VARBINARY: "BLOB",
121    }
122
123    TOKEN_MAPPING = {
124        TokenType.AUTO_INCREMENT: "AUTOINCREMENT",
125    }
126
127    TRANSFORMS = {
128        **generator.Generator.TRANSFORMS,
129        exp.AnyValue: any_value_to_max_sql,
130        exp.Chr: rename_func("CHAR"),
131        exp.Concat: concat_to_dpipe_sql,
132        exp.CountIf: count_if_to_sum,
133        exp.Create: transforms.preprocess([_transform_create]),
134        exp.CurrentDate: lambda *_: "CURRENT_DATE",
135        exp.CurrentTime: lambda *_: "CURRENT_TIME",
136        exp.CurrentTimestamp: lambda *_: "CURRENT_TIMESTAMP",
137        exp.CurrentVersion: lambda *_: "SQLITE_VERSION()",
138        exp.ColumnDef: transforms.preprocess([_generated_to_auto_increment]),
139        exp.DateStrToDate: lambda self, e: self.sql(e, "this"),
140        exp.If: rename_func("IIF"),
141        exp.ILike: no_ilike_sql,
142        exp.JSONArrayAgg: unsupported_args("order", "null_handling", "return_type", "strict")(
143            rename_func("JSON_GROUP_ARRAY")
144        ),
145        exp.JSONExtractScalar: arrow_json_extract_sql,
146        exp.JSONObjectAgg: lambda self, e: self._jsonobject_sql(e, name="JSON_GROUP_OBJECT"),
147        exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")(
148            rename_func("EDITDIST3")
149        ),
150        exp.LogicalOr: rename_func("MAX"),
151        exp.LogicalAnd: rename_func("MIN"),
152        exp.Pivot: no_pivot_sql,
153        exp.Rand: rename_func("RANDOM"),
154        exp.Select: transforms.preprocess(
155            [
156                transforms.eliminate_distinct_on,
157                transforms.eliminate_qualify,
158                transforms.eliminate_semi_and_anti_joins,
159            ]
160        ),
161        exp.StrPosition: lambda self, e: strposition_sql(self, e, func_name="INSTR"),
162        exp.TableSample: no_tablesample_sql,
163        exp.TimeStrToTime: lambda self, e: self.sql(e, "this"),
164        exp.TimeToStr: lambda self, e: self.func("STRFTIME", e.args.get("format"), e.this),
165        exp.TryCast: no_trycast_sql,
166        exp.TsOrDsToTimestamp: lambda self, e: self.sql(e, "this"),
167    }
168
169    # SQLite doesn't generally support CREATE TABLE .. properties
170    # https://www.sqlite.org/lang_createtable.html
171    PROPERTIES_LOCATION = {
172        **{
173            prop: exp.Properties.Location.UNSUPPORTED
174            for prop in generator.Generator.PROPERTIES_LOCATION
175        },
176        # There are a few exceptions (e.g. temporary tables) which are supported or
177        # can be transpiled to SQLite, so we explicitly override them accordingly
178        exp.LikeProperty: exp.Properties.Location.POST_SCHEMA,
179        exp.ModuleProperty: exp.Properties.Location.POST_SCHEMA,
180        exp.TemporaryProperty: exp.Properties.Location.POST_CREATE,
181        exp.VirtualProperty: exp.Properties.Location.POST_CREATE,
182    }
183
184    LIMIT_FETCH = "LIMIT"
185
186    def bitwiseandagg_sql(self, expression: exp.BitwiseAndAgg) -> str:
187        self.unsupported("BITWISE_AND aggregation is not supported in SQLite")
188        return self.function_fallback_sql(expression)
189
190    def bitwiseoragg_sql(self, expression: exp.BitwiseOrAgg) -> str:
191        self.unsupported("BITWISE_OR aggregation is not supported in SQLite")
192        return self.function_fallback_sql(expression)
193
194    def bitwisexoragg_sql(self, expression: exp.BitwiseXorAgg) -> str:
195        self.unsupported("BITWISE_XOR aggregation is not supported in SQLite")
196        return self.function_fallback_sql(expression)
197
198    def jsonextract_sql(self, expression: exp.JSONExtract) -> str:
199        if expression.expressions:
200            return self.function_fallback_sql(expression)
201        return arrow_json_extract_sql(self, expression)
202
203    def dateadd_sql(self, expression: exp.DateAdd) -> str:
204        modifier = expression.expression
205        modifier = modifier.name if modifier.is_string else self.sql(modifier)
206        unit = expression.args.get("unit")
207        modifier = f"'{modifier} {unit.name}'" if unit else f"'{modifier}'"
208        return self.func("DATE", expression.this, modifier)
209
210    def cast_sql(self, expression: exp.Cast, safe_prefix: str | None = None) -> str:
211        if expression.is_type("date"):
212            return self.func("DATE", expression.this)
213
214        return super().cast_sql(expression)
215
216    # Note: SQLite's TRUNC always returns REAL (e.g., trunc(10.99) -> 10.0), not INTEGER.
217    # This creates a transpilation gap affecting division semantics, similar to Presto.
218    # Unlike Presto where this only affects decimals=0, SQLite has no decimals parameter
219    # so every use of TRUNC is affected. Modeling precisely would require exp.FloatTrunc.
220    @unsupported_args("decimals")
221    def trunc_sql(self, expression: exp.Trunc) -> str:
222        return self.func("TRUNC", expression.this)
223
224    def generateseries_sql(self, expression: exp.GenerateSeries) -> str:
225        parent = expression.parent
226        alias = parent and parent.args.get("alias")
227
228        if isinstance(alias, exp.TableAlias) and alias.columns:
229            column_alias = alias.columns[0]
230            alias.set("columns", None)
231            sql = self.sql(
232                exp.select(exp.alias_("value", column_alias)).from_(expression).subquery()
233            )
234        else:
235            sql = self.function_fallback_sql(expression)
236
237        return sql
238
239    def datediff_sql(self, expression: exp.DateDiff) -> str:
240        unit = expression.args.get("unit")
241        unit = unit.name.upper() if unit else "DAY"
242
243        sql = f"(JULIANDAY({self.sql(expression, 'this')}) - JULIANDAY({self.sql(expression, 'expression')}))"
244
245        if unit == "MONTH":
246            sql = f"{sql} / 30.0"
247        elif unit == "YEAR":
248            sql = f"{sql} / 365.0"
249        elif unit == "HOUR":
250            sql = f"{sql} * 24.0"
251        elif unit == "MINUTE":
252            sql = f"{sql} * 1440.0"
253        elif unit == "SECOND":
254            sql = f"{sql} * 86400.0"
255        elif unit == "MILLISECOND":
256            sql = f"{sql} * 86400000.0"
257        elif unit == "MICROSECOND":
258            sql = f"{sql} * 86400000000.0"
259        elif unit == "NANOSECOND":
260            sql = f"{sql} * 8640000000000.0"
261        else:
262            self.unsupported(f"DATEDIFF unsupported for '{unit}'.")
263
264        return f"CAST({sql} AS INTEGER)"
265
266    # https://www.sqlite.org/lang_aggfunc.html#group_concat
267    def groupconcat_sql(self, expression: exp.GroupConcat) -> str:
268        this = expression.this
269        distinct = expression.find(exp.Distinct)
270
271        if distinct:
272            this = distinct.expressions[0]
273            distinct_sql = "DISTINCT "
274        else:
275            distinct_sql = ""
276
277        if isinstance(expression.this, exp.Order):
278            self.unsupported("SQLite GROUP_CONCAT doesn't support ORDER BY.")
279            if expression.this.this and not distinct:
280                this = expression.this.this
281
282        separator = expression.args.get("separator")
283        return f"GROUP_CONCAT({distinct_sql}{self.format_args(this, separator)})"
284
285    def least_sql(self, expression: exp.Least) -> str:
286        if expression.expressions:
287            return rename_func("MIN")(self, expression)
288
289        return self.sql(expression, "this")
290
291    def greatest_sql(self, expression: exp.Greatest) -> str:
292        if expression.expressions:
293            return rename_func("MAX")(self, expression)
294
295        return self.sql(expression, "this")
296
297    def transaction_sql(self, expression: exp.Transaction) -> str:
298        this = expression.this
299        this = f" {this}" if this else ""
300        return f"BEGIN{this} TRANSACTION"
301
302    def isascii_sql(self, expression: exp.IsAscii) -> str:
303        return f"(NOT {self.sql(expression.this)} GLOB CAST(x'2a5b5e012d7f5d2a' AS TEXT))"
304
305    @unsupported_args("this")
306    def currentschema_sql(self, expression: exp.CurrentSchema) -> str:
307        return "'main'"
308
309    def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
310        self.unsupported("SQLite does not support IGNORE NULLS.")
311        return self.sql(expression.this)
312
313    def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
314        return self.sql(expression.this)
315
316    def windowspec_sql(self, expression: exp.WindowSpec) -> str:
317        if (
318            expression.text("kind").upper() == "RANGE"
319            and expression.text("start").upper() == "CURRENT ROW"
320        ):
321            return "RANGE CURRENT ROW"
322
323        return super().windowspec_sql(expression)

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
SELECT_KINDS: tuple[str, ...] = ()
TRY_SUPPORTED = False
SUPPORTS_UESCAPE = False
SUPPORTS_DECODE_CASE = False
AFTER_HAVING_MODIFIER_TRANSFORMS = {'windows': <function <lambda>>, 'qualify': <function <lambda>>}
JOIN_HINTS = False
TABLE_HINTS = False
QUERY_HINTS = False
NVL2_SUPPORTED = False
JSON_PATH_BRACKETED_KEY_SUPPORTED = False
SUPPORTS_CREATE_TABLE_LIKE = False
SUPPORTS_TABLE_ALIAS_COLUMNS = False
SUPPORTS_TO_NUMBER = False
SUPPORTS_WINDOW_EXCLUDE = True
EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE = False
SUPPORTS_MEDIAN = False
JSON_KEY_VALUE_PAIR_SEP = ','
PARSE_JSON_NAME: str | None = None
TYPE_MAPPING = {<DType.DATETIME2: 'DATETIME2'>: 'TIMESTAMP', <DType.NCHAR: 'NCHAR'>: 'TEXT', <DType.NVARCHAR: 'NVARCHAR'>: 'TEXT', <DType.MEDIUMTEXT: 'MEDIUMTEXT'>: 'TEXT', <DType.LONGTEXT: 'LONGTEXT'>: 'TEXT', <DType.TINYTEXT: 'TINYTEXT'>: 'TEXT', <DType.MEDIUMBLOB: 'MEDIUMBLOB'>: 'BLOB', <DType.LONGBLOB: 'LONGBLOB'>: 'BLOB', <DType.TINYBLOB: 'TINYBLOB'>: 'BLOB', <DType.INET: 'INET'>: 'INET', <DType.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <DType.SMALLDATETIME: 'SMALLDATETIME'>: 'TIMESTAMP', <DType.BOOLEAN: 'BOOLEAN'>: 'INTEGER', <DType.TINYINT: 'TINYINT'>: 'INTEGER', <DType.SMALLINT: 'SMALLINT'>: 'INTEGER', <DType.INT: 'INT'>: 'INTEGER', <DType.BIGINT: 'BIGINT'>: 'INTEGER', <DType.FLOAT: 'FLOAT'>: 'REAL', <DType.DOUBLE: 'DOUBLE'>: 'REAL', <DType.DECIMAL: 'DECIMAL'>: 'REAL', <DType.CHAR: 'CHAR'>: 'TEXT', <DType.VARCHAR: 'VARCHAR'>: 'TEXT', <DType.BINARY: 'BINARY'>: 'BLOB', <DType.VARBINARY: 'VARBINARY'>: 'BLOB'}
TOKEN_MAPPING = {<TokenType.AUTO_INCREMENT: 226>: 'AUTOINCREMENT'}
TRANSFORMS = {<class 'sqlglot.expressions.query.JSONPathKey'>: <function <lambda>>, <class 'sqlglot.expressions.query.JSONPathRoot'>: <function <lambda>>, <class 'sqlglot.expressions.query.JSONPathSubscript'>: <function <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.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.CaseSpecificColumnConstraint'>: <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.constraints.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.functions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.string.ConvertToCharset'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.properties.CopyGrantsProperty'>: <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.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.JSONBDeleteAtPath'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONObject'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.json.JSONObjectAgg'>: <function SQLiteGenerator.<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.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.aggregate.AnyValue'>: <function any_value_to_max_sql>, <class 'sqlglot.expressions.string.Chr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.string.Concat'>: <function concat_to_dpipe_sql>, <class 'sqlglot.expressions.aggregate.CountIf'>: <function count_if_to_sum>, <class 'sqlglot.expressions.ddl.Create'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.temporal.CurrentDate'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.CurrentTime'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.CurrentTimestamp'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.functions.CurrentVersion'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.query.ColumnDef'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.temporal.DateStrToDate'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.functions.If'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.core.ILike'>: <function no_ilike_sql>, <class 'sqlglot.expressions.json.JSONArrayAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.json.JSONExtractScalar'>: <function arrow_json_extract_sql>, <class 'sqlglot.expressions.string.Levenshtein'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.aggregate.LogicalOr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.aggregate.LogicalAnd'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.query.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.functions.Rand'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.query.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.string.StrPosition'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.query.TableSample'>: <function no_tablesample_sql>, <class 'sqlglot.expressions.temporal.TimeStrToTime'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.temporal.TimeToStr'>: <function SQLiteGenerator.<lambda>>, <class 'sqlglot.expressions.functions.TryCast'>: <function no_trycast_sql>, <class 'sqlglot.expressions.temporal.TsOrDsToTimestamp'>: <function SQLiteGenerator.<lambda>>}
PROPERTIES_LOCATION = {<class 'sqlglot.expressions.properties.AllowedValuesProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.AlgorithmProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ApiProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ApplicationProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.AutoIncrementProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.AutoRefreshProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.BackupProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.BlockCompressionProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.CatalogProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.CharacterSetProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ChecksumProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.CollateProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ComputeProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.CopyGrantsProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.query.Cluster'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ClusteredByProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DistributedByProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DuplicateKeyProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DataBlocksizeProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DatabaseProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DataDeletionProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DefinerProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DictRange'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DictProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DynamicProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DistKeyProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.DistStyleProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.EmptyProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.EncodeProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.EngineProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.EnviromentProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.HandlerProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ParameterStyleProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ExecuteAsProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ExternalProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.FallbackProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.FileFormatProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.FreespaceProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.GlobalProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.HeapProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.HybridProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.InheritsProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.IcebergProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.IncludeProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.InputModelProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.IsolatedLoadingProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.JournalProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.LanguageProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.LikeProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.LocationProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.LockProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.LockingProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.LogProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.MaskingProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.MaterializedProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.MergeBlockRatioProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ModuleProperty'>: <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.properties.NetworkProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.NoPrimaryIndexProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.OnProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.OnCommitProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.query.Order'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.OutputModelProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.PartitionedByProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.PartitionedOfProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.constraints.PrimaryKey'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.Property'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RefreshTriggerProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RemoteWithConnectionModelProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ReturnsProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RollupProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RowAccessProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RowFormatProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RowFormatDelimitedProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.RowFormatSerdeProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SampleProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SchemaCommentProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SecureProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SecurityIntegrationProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SerdeProperties'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.ddl.Set'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SettingsProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SetProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SetConfigProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SharingProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.ddl.SequenceProperties'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.ddl.TriggerProperties'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SortKeyProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SqlReadWriteProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.SqlSecurityProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.StabilityProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.StorageHandlerProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.StreamingTableProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.StrictProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.Tags'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.TemporaryProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.ToTableProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.TransientProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.TransformModelProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.ddl.MergeTreeTTL'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.UnloggedProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.UsingProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.UsingTemplateProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ViewAttributeProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.VirtualProperty'>: <PropertiesLocation.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.properties.VolatileProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.WithDataProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.WithJournalTableProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.WithProcedureOptions'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.WithSchemaBindingProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.WithSystemVersioningProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.properties.ForceProperty'>: <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>}
LIMIT_FETCH = 'LIMIT'
def bitwiseandagg_sql(self, expression: sqlglot.expressions.math.BitwiseAndAgg) -> str:
186    def bitwiseandagg_sql(self, expression: exp.BitwiseAndAgg) -> str:
187        self.unsupported("BITWISE_AND aggregation is not supported in SQLite")
188        return self.function_fallback_sql(expression)
def bitwiseoragg_sql(self, expression: sqlglot.expressions.math.BitwiseOrAgg) -> str:
190    def bitwiseoragg_sql(self, expression: exp.BitwiseOrAgg) -> str:
191        self.unsupported("BITWISE_OR aggregation is not supported in SQLite")
192        return self.function_fallback_sql(expression)
def bitwisexoragg_sql(self, expression: sqlglot.expressions.math.BitwiseXorAgg) -> str:
194    def bitwisexoragg_sql(self, expression: exp.BitwiseXorAgg) -> str:
195        self.unsupported("BITWISE_XOR aggregation is not supported in SQLite")
196        return self.function_fallback_sql(expression)
def jsonextract_sql(self, expression: sqlglot.expressions.json.JSONExtract) -> str:
198    def jsonextract_sql(self, expression: exp.JSONExtract) -> str:
199        if expression.expressions:
200            return self.function_fallback_sql(expression)
201        return arrow_json_extract_sql(self, expression)
def dateadd_sql(self, expression: sqlglot.expressions.temporal.DateAdd) -> str:
203    def dateadd_sql(self, expression: exp.DateAdd) -> str:
204        modifier = expression.expression
205        modifier = modifier.name if modifier.is_string else self.sql(modifier)
206        unit = expression.args.get("unit")
207        modifier = f"'{modifier} {unit.name}'" if unit else f"'{modifier}'"
208        return self.func("DATE", expression.this, modifier)
def cast_sql( self, expression: sqlglot.expressions.functions.Cast, safe_prefix: str | None = None) -> str:
210    def cast_sql(self, expression: exp.Cast, safe_prefix: str | None = None) -> str:
211        if expression.is_type("date"):
212            return self.func("DATE", expression.this)
213
214        return super().cast_sql(expression)
@unsupported_args('decimals')
def trunc_sql(self, expression: sqlglot.expressions.math.Trunc) -> str:
220    @unsupported_args("decimals")
221    def trunc_sql(self, expression: exp.Trunc) -> str:
222        return self.func("TRUNC", expression.this)
def generateseries_sql(self, expression: sqlglot.expressions.array.GenerateSeries) -> str:
224    def generateseries_sql(self, expression: exp.GenerateSeries) -> str:
225        parent = expression.parent
226        alias = parent and parent.args.get("alias")
227
228        if isinstance(alias, exp.TableAlias) and alias.columns:
229            column_alias = alias.columns[0]
230            alias.set("columns", None)
231            sql = self.sql(
232                exp.select(exp.alias_("value", column_alias)).from_(expression).subquery()
233            )
234        else:
235            sql = self.function_fallback_sql(expression)
236
237        return sql
def datediff_sql(self, expression: sqlglot.expressions.temporal.DateDiff) -> str:
239    def datediff_sql(self, expression: exp.DateDiff) -> str:
240        unit = expression.args.get("unit")
241        unit = unit.name.upper() if unit else "DAY"
242
243        sql = f"(JULIANDAY({self.sql(expression, 'this')}) - JULIANDAY({self.sql(expression, 'expression')}))"
244
245        if unit == "MONTH":
246            sql = f"{sql} / 30.0"
247        elif unit == "YEAR":
248            sql = f"{sql} / 365.0"
249        elif unit == "HOUR":
250            sql = f"{sql} * 24.0"
251        elif unit == "MINUTE":
252            sql = f"{sql} * 1440.0"
253        elif unit == "SECOND":
254            sql = f"{sql} * 86400.0"
255        elif unit == "MILLISECOND":
256            sql = f"{sql} * 86400000.0"
257        elif unit == "MICROSECOND":
258            sql = f"{sql} * 86400000000.0"
259        elif unit == "NANOSECOND":
260            sql = f"{sql} * 8640000000000.0"
261        else:
262            self.unsupported(f"DATEDIFF unsupported for '{unit}'.")
263
264        return f"CAST({sql} AS INTEGER)"
def groupconcat_sql(self, expression: sqlglot.expressions.aggregate.GroupConcat) -> str:
267    def groupconcat_sql(self, expression: exp.GroupConcat) -> str:
268        this = expression.this
269        distinct = expression.find(exp.Distinct)
270
271        if distinct:
272            this = distinct.expressions[0]
273            distinct_sql = "DISTINCT "
274        else:
275            distinct_sql = ""
276
277        if isinstance(expression.this, exp.Order):
278            self.unsupported("SQLite GROUP_CONCAT doesn't support ORDER BY.")
279            if expression.this.this and not distinct:
280                this = expression.this.this
281
282        separator = expression.args.get("separator")
283        return f"GROUP_CONCAT({distinct_sql}{self.format_args(this, separator)})"
def least_sql(self, expression: sqlglot.expressions.functions.Least) -> str:
285    def least_sql(self, expression: exp.Least) -> str:
286        if expression.expressions:
287            return rename_func("MIN")(self, expression)
288
289        return self.sql(expression, "this")
def greatest_sql(self, expression: sqlglot.expressions.functions.Greatest) -> str:
291    def greatest_sql(self, expression: exp.Greatest) -> str:
292        if expression.expressions:
293            return rename_func("MAX")(self, expression)
294
295        return self.sql(expression, "this")
def transaction_sql(self, expression: sqlglot.expressions.ddl.Transaction) -> str:
297    def transaction_sql(self, expression: exp.Transaction) -> str:
298        this = expression.this
299        this = f" {this}" if this else ""
300        return f"BEGIN{this} TRANSACTION"
def isascii_sql(self, expression: sqlglot.expressions.string.IsAscii) -> str:
302    def isascii_sql(self, expression: exp.IsAscii) -> str:
303        return f"(NOT {self.sql(expression.this)} GLOB CAST(x'2a5b5e012d7f5d2a' AS TEXT))"
@unsupported_args('this')
def currentschema_sql(self, expression: sqlglot.expressions.functions.CurrentSchema) -> str:
305    @unsupported_args("this")
306    def currentschema_sql(self, expression: exp.CurrentSchema) -> str:
307        return "'main'"
def ignorenulls_sql(self, expression: sqlglot.expressions.core.IgnoreNulls) -> str:
309    def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
310        self.unsupported("SQLite does not support IGNORE NULLS.")
311        return self.sql(expression.this)
def respectnulls_sql(self, expression: sqlglot.expressions.core.RespectNulls) -> str:
313    def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
314        return self.sql(expression.this)
def windowspec_sql(self, expression: sqlglot.expressions.query.WindowSpec) -> str:
316    def windowspec_sql(self, expression: exp.WindowSpec) -> str:
317        if (
318            expression.text("kind").upper() == "RANGE"
319            and expression.text("start").upper() == "CURRENT ROW"
320        ):
321            return "RANGE CURRENT ROW"
322
323        return super().windowspec_sql(expression)
Inherited Members
sqlglot.generator.Generator
Generator
NULL_ORDERING_SUPPORTED
WINDOW_FUNCS_WITH_NULL_ORDERING
IGNORE_NULLS_IN_FUNC
IGNORE_NULLS_BEFORE_ORDER
LOCKING_READS_SUPPORTED
WRAP_DERIVED_VALUES
CREATE_FUNCTION_RETURN_AS
MATCHED_BY_SOURCE
SUPPORTS_MERGE_WHERE
SINGLE_STRING_INTERVAL
INTERVAL_ALLOWS_PLURAL_FORM
LIMIT_ONLY_LITERALS
RENAME_TABLE_WITH_DB
GROUPINGS_SEP
INDEX_ON
INOUT_SEPARATOR
DIRECTED_JOINS
QUERY_HINT_SEP
IS_BOOL_ALLOWED
DUPLICATE_KEY_UPDATE_WITH_SET
LIMIT_IS_TOP
RETURNING_END
EXTRACT_ALLOWS_QUOTES
TZ_TO_WITH_TIME_ZONE
VALUES_AS_TABLE
ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
UNNEST_WITH_ORDINALITY
AGGREGATE_FILTER_SUPPORTED
SEMI_ANTI_JOIN_WITH_SIDE
COMPUTED_COLUMN_WITH_TYPE
SUPPORTS_TABLE_COPY
TABLESAMPLE_REQUIRES_PARENS
TABLESAMPLE_SIZE_IS_ROWS
TABLESAMPLE_KEYWORDS
TABLESAMPLE_WITH_METHOD
TABLESAMPLE_SEED_KEYWORD
COLLATE_IS_FUNC
DATA_TYPE_SPECIFIERS_ALLOWED
ENSURE_BOOLS
CTE_RECURSIVE_KEYWORD_REQUIRED
SUPPORTS_SINGLE_ARG_CONCAT
LAST_DAY_SUPPORTS_DATE_PART
UNPIVOT_ALIASES_ARE_IDENTIFIERS
INSERT_OVERWRITE
SUPPORTS_SELECT_INTO
SUPPORTS_UNLOGGED_TABLES
LIKE_PROPERTY_INSIDE_SCHEMA
MULTI_ARG_DISTINCT
JSON_TYPE_REQUIRED_FOR_EXTRACTION
JSON_PATH_SINGLE_QUOTE_ESCAPE
CAN_IMPLEMENT_ARRAY_ANY
SET_OP_MODIFIERS
COPY_PARAMS_ARE_WRAPPED
COPY_PARAMS_EQ_REQUIRED
COPY_HAS_INTO_KEYWORD
UNICODE_SUBSTITUTE
STAR_EXCEPT
HEX_FUNC
WITH_PROPERTIES_PREFIX
QUOTE_JSON_PATH
PAD_FILL_PATTERN_IS_REQUIRED
SUPPORTS_EXPLODING_PROJECTIONS
ARRAY_CONCAT_IS_VAR_LEN
SUPPORTS_CONVERT_TIMEZONE
SUPPORTS_UNIX_SECONDS
ALTER_SET_WRAPPED
NORMALIZE_EXTRACT_DATE_PARTS
ARRAY_SIZE_NAME
ALTER_SET_TYPE
ARRAY_SIZE_DIM_REQUIRED
SUPPORTS_BETWEEN_FLAGS
SUPPORTS_LIKE_QUANTIFIERS
MATCH_AGAINST_TABLE_PREFIX
SET_ASSIGNMENT_REQUIRES_VARIABLE_KEYWORD
DECLARE_DEFAULT_ASSIGNMENT
UPDATE_STATEMENT_SUPPORTS_FROM
STAR_EXCLUDE_REQUIRES_DERIVED_TABLE
SUPPORTS_DROP_ALTER_ICEBERG_PROPERTY
UNSUPPORTED_TYPES
TIME_PART_SINGULARS
STRUCT_DELIMITER
PARAMETER_TOKEN
NAMED_PLACEHOLDER_TOKEN
EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
RESERVED_KEYWORDS
WITH_SEPARATED_COMMENTS
EXCLUDE_COMMENTS
UNWRAPPED_INTERVAL_VALUES
PARAMETERIZABLE_TEXT_TYPES
EXPRESSIONS_WITHOUT_NESTED_CTES
RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS
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
columndef_sql
columnconstraint_sql
computedcolumnconstraint_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
bytestring_sql
unicodestring_sql
rawstring_sql
datatypeparam_sql
datatype_sql
directory_sql
delete_sql
drop_sql
set_operation
set_operations
fetch_sql
limitoptions_sql
filter_sql
hint_sql
indexparameters_sql
index_sql
identifier_sql
hex_sql
lowerhex_sql
inputoutputformat_sql
national_sql
partition_sql
properties_sql
root_properties
properties
with_properties
locate_properties
property_name
property_sql
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
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
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
connect_sql
prior_sql
join_sql
lambda_sql
lateral_op
lateral_sql
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
distribute_sql
sort_sql
ordered_sql
matchrecognizemeasure_sql
matchrecognize_sql
query_modifiers
options_modifier
for_modifiers
queryoption_sql
offset_limit_modifiers
after_limit_modifiers
select_sql
schema_sql
schema_columns_sql
star_sql
parameter_sql
sessionparameter_sql
placeholder_sql
subquery_sql
qualify_sql
unnest_sql
prewhere_sql
where_sql
window_sql
partition_by_sql
withingroup_sql
between_sql
bracket_offset_expressions
bracket_sql
all_sql
any_sql
exists_sql
case_sql
constraint_sql
nextvaluefor_sql
extract_sql
trim_sql
convert_concat_args
concat_sql
concatws_sql
check_sql
foreignkey_sql
primarykey_sql
if_sql
matchagainst_sql
jsonkeyvalue_sql
jsonpath_sql
json_path_part
formatjson_sql
formatphrase_sql
jsonarray_sql
jsonarrayagg_sql
jsoncolumndef_sql
jsonschema_sql
jsontable_sql
openjsoncolumndef_sql
openjson_sql
in_sql
in_unnest_op
interval_sql
return_sql
reference_sql
anonymous_sql
paren_sql
neg_sql
not_sql
alias_sql
pivotalias_sql
aliases_sql
atindex_sql
attimezone_sql
fromtimezone_sql
add_sql
and_sql
or_sql
xor_sql
connector_sql
bitwiseand_sql
bitwiseleftshift_sql
bitwisenot_sql
bitwiseor_sql
bitwiserightshift_sql
bitwisexor_sql
strtotime_sql
currentdate_sql
collate_sql
command_sql
comment_sql
mergetreettlaction_sql
mergetreettl_sql
commit_sql
rollback_sql
altercolumn_sql
alterindex_sql
alterdiststyle_sql
altersortkey_sql
alterrename_sql
renamecolumn_sql
alterset_sql
alter_sql
altersession_sql
add_column_sql
droppartition_sql
addconstraint_sql
addpartition_sql
distinct_sql
havingmax_sql
intdiv_sql
dpipe_sql
div_sql
safedivide_sql
overlaps_sql
distance_sql
dot_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
func
format_args
too_wide
format_time
expressions
op_expressions
naked_property
tag_sql
token_sql
userdefinedfunction_sql
joinhint_sql
kwarg_sql
when_sql
whens_sql
merge_sql
tochar_sql
tonumber_sql
dictproperty_sql
dictrange_sql
dictsubproperty_sql
duplicatekeyproperty_sql
uniquekeyproperty_sql
distributedbyproperty_sql
oncluster_sql
clusteredbyproperty_sql
anyvalue_sql
querytransform_sql
indexconstraintoption_sql
checkcolumnconstraint_sql
indexcolumnconstraint_sql
nvl2_sql
comprehension_sql
columnprefix_sql
opclass_sql
predict_sql
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
arrayany_sql
struct_sql
partitionrange_sql
truncatetable_sql
convert_sql
copyparameter_sql
credentials_sql
copy_sql
semicolon_sql
datadeletionproperty_sql
maskingpolicycolumnconstraint_sql
gapfill_sql
scope_resolution
scoperesolution_sql
parsejson_sql
rand_sql
changes_sql
pad_sql
summarize_sql
explodinggenerateseries_sql
converttimezone_sql
json_sql
jsonvalue_sql
skipjsoncolumn_sql
conditionalinsert_sql
multitableinserts_sql
oncondition_sql
jsonextractquote_sql
jsonexists_sql
arrayagg_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
arraysize_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
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_sql
chr_sql
block_sql
storedprocedure_sql
ifblock_sql
whileblock_sql
execute_sql
executesql_sql
altermodifysqlsecurity_sql
usingproperty_sql
renameindex_sql