Edit on GitHub

sqlglot expressions DDL.

  1"""sqlglot expressions DDL."""
  2
  3from __future__ import annotations
  4
  5import typing as t
  6
  7from sqlglot.helper import trait
  8from sqlglot.expressions.core import Expression, Expr, Func
  9from sqlglot.expressions.query import Query, Selectable
 10
 11if t.TYPE_CHECKING:
 12    from sqlglot.expressions.query import CTE
 13
 14
 15@trait
 16class DDL(Selectable):
 17    @property
 18    def ctes(self) -> list[CTE]:
 19        """Returns a list of all the CTEs attached to this statement."""
 20        with_ = self.args.get("with_")
 21        return with_.expressions if with_ else []
 22
 23    @property
 24    def selects(self) -> list[Expr]:
 25        """If this statement contains a query (e.g. a CTAS), this returns the query's projections."""
 26        expression = self.expression
 27        return expression.selects if isinstance(expression, Query) else []
 28
 29    @property
 30    def named_selects(self) -> list[str]:
 31        """
 32        If this statement contains a query (e.g. a CTAS), this returns the output
 33        names of the query's projections.
 34        """
 35        expression = self.expression
 36        return expression.named_selects if isinstance(expression, Query) else []
 37
 38
 39class Create(Expression, DDL):
 40    arg_types = {
 41        "with_": False,
 42        "this": True,
 43        "kind": True,
 44        "expression": False,
 45        "exists": False,
 46        "properties": False,
 47        "replace": False,
 48        "refresh": False,
 49        "unique": False,
 50        "indexes": False,
 51        "no_schema_binding": False,
 52        "begin": False,
 53        "clone": False,
 54        "concurrently": False,
 55        "clustered": False,
 56    }
 57
 58    @property
 59    def kind(self) -> str | None:
 60        kind = self.args.get("kind")
 61        return kind and kind.upper()
 62
 63
 64class SequenceProperties(Expression):
 65    arg_types = {
 66        "increment": False,
 67        "minvalue": False,
 68        "maxvalue": False,
 69        "cache": False,
 70        "start": False,
 71        "owned": False,
 72        "options": False,
 73    }
 74
 75
 76class TriggerProperties(Expression):
 77    arg_types = {
 78        "table": True,
 79        "timing": True,
 80        "events": True,
 81        "execute": True,
 82        "constraint": False,
 83        "referenced_table": False,
 84        "deferrable": False,
 85        "initially": False,
 86        "referencing": False,
 87        "for_each": False,
 88        "when": False,
 89    }
 90
 91
 92class TriggerExecute(Expression):
 93    pass
 94
 95
 96class TriggerEvent(Expression):
 97    arg_types = {"this": True, "columns": False}
 98
 99
100class TriggerReferencing(Expression):
101    arg_types = {"old": False, "new": False}
102
103
104class TruncateTable(Expression):
105    arg_types = {
106        "expressions": True,
107        "is_database": False,
108        "exists": False,
109        "only": False,
110        "cluster": False,
111        "identity": False,
112        "option": False,
113        "partition": False,
114    }
115
116
117class Clone(Expression):
118    arg_types = {"this": True, "shallow": False, "copy": False}
119
120
121class Describe(Expression):
122    arg_types = {
123        "this": True,
124        "style": False,
125        "kind": False,
126        "properties": False,
127        "expressions": False,
128        "partition": False,
129        "format": False,
130        "as_json": False,
131    }
132
133
134class Attach(Expression):
135    arg_types = {"this": True, "exists": False, "expressions": False}
136
137
138class Detach(Expression):
139    arg_types = {
140        "this": True,
141        "kind": False,
142        "exists": False,
143        "cluster": False,
144        "permanent": False,
145        "sync": False,
146    }
147
148
149class Install(Expression):
150    arg_types = {"this": True, "from_": False, "force": False}
151
152
153class Summarize(Expression):
154    arg_types = {"this": True, "table": False}
155
156
157class Kill(Expression):
158    arg_types = {"this": True, "kind": False}
159
160
161class Pragma(Expression):
162    pass
163
164
165class Declare(Expression):
166    arg_types = {"expressions": True, "replace": False}
167
168
169class DeclareItem(Expression):
170    arg_types = {"this": True, "kind": False, "default": False}
171
172
173class Set(Expression):
174    arg_types = {"expressions": False, "unset": False, "tag": False}
175
176
177class Heredoc(Expression):
178    arg_types = {"this": True, "tag": False}
179    _hash_raw_args = True
180
181
182class SetItem(Expression):
183    arg_types = {
184        "this": False,
185        "expressions": False,
186        "kind": False,
187        "collate": False,  # MySQL SET NAMES statement
188        "global_": False,
189    }
190
191
192class Show(Expression):
193    arg_types = {
194        "this": True,
195        "history": False,
196        "terse": False,
197        "target": False,
198        "offset": False,
199        "starts_with": False,
200        "limit": False,
201        "from_": False,
202        "like": False,
203        "where": False,
204        "db": False,
205        "scope": False,
206        "scope_kind": False,
207        "full": False,
208        "mutex": False,
209        "query": False,
210        "channel": False,
211        "global_": False,
212        "log": False,
213        "position": False,
214        "types": False,
215        "privileges": False,
216        "for_table": False,
217        "for_group": False,
218        "for_user": False,
219        "for_role": False,
220        "into_outfile": False,
221        "json": False,
222        "iceberg": False,
223    }
224
225
226class UserDefinedFunction(Expression):
227    arg_types = {"this": True, "expressions": False, "wrapped": False}
228
229
230class MacroOverloads(Expression):
231    arg_types = {"expressions": True}
232
233
234class MacroOverload(Expression):
235    arg_types = {"this": True, "expressions": False, "is_table": False}
236
237
238class CharacterSet(Expression):
239    arg_types = {"this": True, "default": False}
240
241
242class AlterColumn(Expression):
243    arg_types = {
244        "this": True,
245        "dtype": False,
246        "collate": False,
247        "using": False,
248        "default": False,
249        "drop": False,
250        "comment": False,
251        "allow_null": False,
252        "visible": False,
253        "rename_to": False,
254        "exists": False,
255    }
256
257
258class ModifyColumn(Expression):
259    arg_types = {"this": True, "rename_from": False}
260
261
262class AlterIndex(Expression):
263    arg_types = {"this": True, "visible": True}
264
265
266class AlterDistStyle(Expression):
267    pass
268
269
270class AlterSortKey(Expression):
271    arg_types = {"this": False, "expressions": False, "compound": False}
272
273
274class AlterSet(Expression):
275    arg_types = {
276        "expressions": False,
277        "option": False,
278        "tablespace": False,
279        "access_method": False,
280        "file_format": False,
281        "copy_options": False,
282        "tag": False,
283        "location": False,
284        "serde": False,
285    }
286
287
288class RenameColumn(Expression):
289    arg_types = {"this": True, "to": True, "exists": False}
290
291
292class AlterRename(Expression):
293    pass
294
295
296class RenameIndex(Expression):
297    arg_types = {"this": True, "to": True}
298
299
300class AlterModifySqlSecurity(Expression):
301    arg_types = {"expressions": True}
302
303
304class SwapTable(Expression):
305    pass
306
307
308class Comment(Expression):
309    arg_types = {
310        "this": True,
311        "kind": True,
312        "expression": True,
313        "exists": False,
314        "materialized": False,
315    }
316
317
318class Comprehension(Expression):
319    arg_types = {
320        "this": True,
321        "expression": True,
322        "position": False,
323        "iterator": True,
324        "condition": False,
325    }
326
327
328class MergeTreeTTLAction(Expression):
329    arg_types = {
330        "this": True,
331        "delete": False,
332        "recompress": False,
333        "to_disk": False,
334        "to_volume": False,
335    }
336
337
338class MergeTreeTTL(Expression):
339    arg_types = {
340        "expressions": True,
341        "where": False,
342        "group": False,
343        "aggregates": False,
344    }
345
346
347class Drop(Expression):
348    arg_types = {
349        "kind": False,
350        "tables": False,
351        "expressions": False,
352        "exists": False,
353        "temporary": False,
354        "materialized": False,
355        "cascade": False,
356        "restrict": False,
357        "constraints": False,
358        "purge": False,
359        "cluster": False,
360        "concurrently": False,
361        "sync": False,
362        "iceberg": False,
363        "force": False,
364    }
365
366    @property
367    def kind(self) -> str | None:
368        kind = self.args.get("kind")
369        return kind and kind.upper()
370
371
372class DropPrimaryKey(Expression):
373    arg_types = {}
374
375
376class Undrop(Expression):
377    arg_types = {"this": True, "kind": True, "rename": False}
378
379    @property
380    def kind(self) -> str:
381        return self.args["kind"].upper()
382
383
384class Command(Expression):
385    arg_types = {"this": True, "expression": False}
386    _hash_raw_args = True
387
388
389class Transaction(Expression):
390    arg_types = {"this": False, "modes": False, "mark": False}
391
392
393class Commit(Expression):
394    arg_types = {"chain": False, "this": False, "durability": False}
395
396
397class Rollback(Expression):
398    arg_types = {"savepoint": False, "this": False}
399
400
401class Alter(Expression):
402    arg_types = {
403        "this": False,
404        "kind": True,
405        "actions": False,
406        "exists": False,
407        "only": False,
408        "options": False,
409        "cluster": False,
410        "not_valid": False,
411        "check": False,
412        "cascade": False,
413        "iceberg": False,
414    }
415
416    @property
417    def kind(self) -> str | None:
418        kind = self.args.get("kind")
419        return kind and kind.upper()
420
421    @property
422    def actions(self) -> list[Expr]:
423        return self.args.get("actions") or []
424
425
426class AlterSession(Expression):
427    arg_types = {"expressions": True, "unset": False}
428
429
430class Use(Expression):
431    arg_types = {"this": False, "expressions": False, "kind": False}
432
433
434class NextValueFor(Expression, Func):
435    arg_types = {"this": True, "order": False}
436
437
438class Execute(Expression):
439    arg_types = {"this": True, "expressions": False, "return_status": False}
440
441    @property
442    def name(self) -> str:
443        return self.this.name
444
445
446class ExecuteSql(Execute):
447    pass
@trait
class DDL(sqlglot.expressions.query.Selectable):
16@trait
17class DDL(Selectable):
18    @property
19    def ctes(self) -> list[CTE]:
20        """Returns a list of all the CTEs attached to this statement."""
21        with_ = self.args.get("with_")
22        return with_.expressions if with_ else []
23
24    @property
25    def selects(self) -> list[Expr]:
26        """If this statement contains a query (e.g. a CTAS), this returns the query's projections."""
27        expression = self.expression
28        return expression.selects if isinstance(expression, Query) else []
29
30    @property
31    def named_selects(self) -> list[str]:
32        """
33        If this statement contains a query (e.g. a CTAS), this returns the output
34        names of the query's projections.
35        """
36        expression = self.expression
37        return expression.named_selects if isinstance(expression, Query) else []
ctes: list[sqlglot.expressions.query.CTE]
18    @property
19    def ctes(self) -> list[CTE]:
20        """Returns a list of all the CTEs attached to this statement."""
21        with_ = self.args.get("with_")
22        return with_.expressions if with_ else []

Returns a list of all the CTEs attached to this statement.

selects: list[sqlglot.expressions.core.Expr]
24    @property
25    def selects(self) -> list[Expr]:
26        """If this statement contains a query (e.g. a CTAS), this returns the query's projections."""
27        expression = self.expression
28        return expression.selects if isinstance(expression, Query) else []

If this statement contains a query (e.g. a CTAS), this returns the query's projections.

named_selects: list[str]
30    @property
31    def named_selects(self) -> list[str]:
32        """
33        If this statement contains a query (e.g. a CTAS), this returns the output
34        names of the query's projections.
35        """
36        expression = self.expression
37        return expression.named_selects if isinstance(expression, Query) else []

If this statement contains a query (e.g. a CTAS), this returns the output names of the query's projections.

key: ClassVar[str] = 'ddl'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Create(sqlglot.expressions.core.Expression, DDL):
40class Create(Expression, DDL):
41    arg_types = {
42        "with_": False,
43        "this": True,
44        "kind": True,
45        "expression": False,
46        "exists": False,
47        "properties": False,
48        "replace": False,
49        "refresh": False,
50        "unique": False,
51        "indexes": False,
52        "no_schema_binding": False,
53        "begin": False,
54        "clone": False,
55        "concurrently": False,
56        "clustered": False,
57    }
58
59    @property
60    def kind(self) -> str | None:
61        kind = self.args.get("kind")
62        return kind and kind.upper()
arg_types = {'with_': False, 'this': True, 'kind': True, 'expression': False, 'exists': False, 'properties': False, 'replace': False, 'refresh': False, 'unique': False, 'indexes': False, 'no_schema_binding': False, 'begin': False, 'clone': False, 'concurrently': False, 'clustered': False}
kind: str | None
59    @property
60    def kind(self) -> str | None:
61        kind = self.args.get("kind")
62        return kind and kind.upper()
key: ClassVar[str] = 'create'
required_args: 't.ClassVar[set[str]]' = {'kind', 'this'}
class SequenceProperties(sqlglot.expressions.core.Expression):
65class SequenceProperties(Expression):
66    arg_types = {
67        "increment": False,
68        "minvalue": False,
69        "maxvalue": False,
70        "cache": False,
71        "start": False,
72        "owned": False,
73        "options": False,
74    }
arg_types = {'increment': False, 'minvalue': False, 'maxvalue': False, 'cache': False, 'start': False, 'owned': False, 'options': False}
key: ClassVar[str] = 'sequenceproperties'
required_args: 't.ClassVar[set[str]]' = set()
class TriggerProperties(sqlglot.expressions.core.Expression):
77class TriggerProperties(Expression):
78    arg_types = {
79        "table": True,
80        "timing": True,
81        "events": True,
82        "execute": True,
83        "constraint": False,
84        "referenced_table": False,
85        "deferrable": False,
86        "initially": False,
87        "referencing": False,
88        "for_each": False,
89        "when": False,
90    }
arg_types = {'table': True, 'timing': True, 'events': True, 'execute': True, 'constraint': False, 'referenced_table': False, 'deferrable': False, 'initially': False, 'referencing': False, 'for_each': False, 'when': False}
key: ClassVar[str] = 'triggerproperties'
required_args: 't.ClassVar[set[str]]' = {'table', 'events', 'timing', 'execute'}
class TriggerExecute(sqlglot.expressions.core.Expression):
93class TriggerExecute(Expression):
94    pass
key: ClassVar[str] = 'triggerexecute'
required_args: 't.ClassVar[set[str]]' = {'this'}
class TriggerEvent(sqlglot.expressions.core.Expression):
97class TriggerEvent(Expression):
98    arg_types = {"this": True, "columns": False}
arg_types = {'this': True, 'columns': False}
key: ClassVar[str] = 'triggerevent'
required_args: 't.ClassVar[set[str]]' = {'this'}
class TriggerReferencing(sqlglot.expressions.core.Expression):
101class TriggerReferencing(Expression):
102    arg_types = {"old": False, "new": False}
arg_types = {'old': False, 'new': False}
key: ClassVar[str] = 'triggerreferencing'
required_args: 't.ClassVar[set[str]]' = set()
class TruncateTable(sqlglot.expressions.core.Expression):
105class TruncateTable(Expression):
106    arg_types = {
107        "expressions": True,
108        "is_database": False,
109        "exists": False,
110        "only": False,
111        "cluster": False,
112        "identity": False,
113        "option": False,
114        "partition": False,
115    }
arg_types = {'expressions': True, 'is_database': False, 'exists': False, 'only': False, 'cluster': False, 'identity': False, 'option': False, 'partition': False}
key: ClassVar[str] = 'truncatetable'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class Clone(sqlglot.expressions.core.Expression):
118class Clone(Expression):
119    arg_types = {"this": True, "shallow": False, "copy": False}
arg_types = {'this': True, 'shallow': False, 'copy': False}
key: ClassVar[str] = 'clone'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Describe(sqlglot.expressions.core.Expression):
122class Describe(Expression):
123    arg_types = {
124        "this": True,
125        "style": False,
126        "kind": False,
127        "properties": False,
128        "expressions": False,
129        "partition": False,
130        "format": False,
131        "as_json": False,
132    }
arg_types = {'this': True, 'style': False, 'kind': False, 'properties': False, 'expressions': False, 'partition': False, 'format': False, 'as_json': False}
key: ClassVar[str] = 'describe'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Attach(sqlglot.expressions.core.Expression):
135class Attach(Expression):
136    arg_types = {"this": True, "exists": False, "expressions": False}
arg_types = {'this': True, 'exists': False, 'expressions': False}
key: ClassVar[str] = 'attach'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Detach(sqlglot.expressions.core.Expression):
139class Detach(Expression):
140    arg_types = {
141        "this": True,
142        "kind": False,
143        "exists": False,
144        "cluster": False,
145        "permanent": False,
146        "sync": False,
147    }
arg_types = {'this': True, 'kind': False, 'exists': False, 'cluster': False, 'permanent': False, 'sync': False}
key: ClassVar[str] = 'detach'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Install(sqlglot.expressions.core.Expression):
150class Install(Expression):
151    arg_types = {"this": True, "from_": False, "force": False}
arg_types = {'this': True, 'from_': False, 'force': False}
key: ClassVar[str] = 'install'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Summarize(sqlglot.expressions.core.Expression):
154class Summarize(Expression):
155    arg_types = {"this": True, "table": False}
arg_types = {'this': True, 'table': False}
key: ClassVar[str] = 'summarize'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Kill(sqlglot.expressions.core.Expression):
158class Kill(Expression):
159    arg_types = {"this": True, "kind": False}
arg_types = {'this': True, 'kind': False}
key: ClassVar[str] = 'kill'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Pragma(sqlglot.expressions.core.Expression):
162class Pragma(Expression):
163    pass
key: ClassVar[str] = 'pragma'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Declare(sqlglot.expressions.core.Expression):
166class Declare(Expression):
167    arg_types = {"expressions": True, "replace": False}
arg_types = {'expressions': True, 'replace': False}
key: ClassVar[str] = 'declare'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class DeclareItem(sqlglot.expressions.core.Expression):
170class DeclareItem(Expression):
171    arg_types = {"this": True, "kind": False, "default": False}
arg_types = {'this': True, 'kind': False, 'default': False}
key: ClassVar[str] = 'declareitem'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Set(sqlglot.expressions.core.Expression):
174class Set(Expression):
175    arg_types = {"expressions": False, "unset": False, "tag": False}
arg_types = {'expressions': False, 'unset': False, 'tag': False}
key: ClassVar[str] = 'set'
required_args: 't.ClassVar[set[str]]' = set()
class Heredoc(sqlglot.expressions.core.Expression):
178class Heredoc(Expression):
179    arg_types = {"this": True, "tag": False}
180    _hash_raw_args = True
arg_types = {'this': True, 'tag': False}
key: ClassVar[str] = 'heredoc'
required_args: 't.ClassVar[set[str]]' = {'this'}
class SetItem(sqlglot.expressions.core.Expression):
183class SetItem(Expression):
184    arg_types = {
185        "this": False,
186        "expressions": False,
187        "kind": False,
188        "collate": False,  # MySQL SET NAMES statement
189        "global_": False,
190    }
arg_types = {'this': False, 'expressions': False, 'kind': False, 'collate': False, 'global_': False}
key: ClassVar[str] = 'setitem'
required_args: 't.ClassVar[set[str]]' = set()
class Show(sqlglot.expressions.core.Expression):
193class Show(Expression):
194    arg_types = {
195        "this": True,
196        "history": False,
197        "terse": False,
198        "target": False,
199        "offset": False,
200        "starts_with": False,
201        "limit": False,
202        "from_": False,
203        "like": False,
204        "where": False,
205        "db": False,
206        "scope": False,
207        "scope_kind": False,
208        "full": False,
209        "mutex": False,
210        "query": False,
211        "channel": False,
212        "global_": False,
213        "log": False,
214        "position": False,
215        "types": False,
216        "privileges": False,
217        "for_table": False,
218        "for_group": False,
219        "for_user": False,
220        "for_role": False,
221        "into_outfile": False,
222        "json": False,
223        "iceberg": False,
224    }
arg_types = {'this': True, 'history': False, 'terse': False, 'target': False, 'offset': False, 'starts_with': False, 'limit': False, 'from_': False, 'like': False, 'where': False, 'db': False, 'scope': False, 'scope_kind': False, 'full': False, 'mutex': False, 'query': False, 'channel': False, 'global_': False, 'log': False, 'position': False, 'types': False, 'privileges': False, 'for_table': False, 'for_group': False, 'for_user': False, 'for_role': False, 'into_outfile': False, 'json': False, 'iceberg': False}
key: ClassVar[str] = 'show'
required_args: 't.ClassVar[set[str]]' = {'this'}
class UserDefinedFunction(sqlglot.expressions.core.Expression):
227class UserDefinedFunction(Expression):
228    arg_types = {"this": True, "expressions": False, "wrapped": False}
arg_types = {'this': True, 'expressions': False, 'wrapped': False}
key: ClassVar[str] = 'userdefinedfunction'
required_args: 't.ClassVar[set[str]]' = {'this'}
class MacroOverloads(sqlglot.expressions.core.Expression):
231class MacroOverloads(Expression):
232    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'macrooverloads'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class MacroOverload(sqlglot.expressions.core.Expression):
235class MacroOverload(Expression):
236    arg_types = {"this": True, "expressions": False, "is_table": False}
arg_types = {'this': True, 'expressions': False, 'is_table': False}
key: ClassVar[str] = 'macrooverload'
required_args: 't.ClassVar[set[str]]' = {'this'}
class CharacterSet(sqlglot.expressions.core.Expression):
239class CharacterSet(Expression):
240    arg_types = {"this": True, "default": False}
arg_types = {'this': True, 'default': False}
key: ClassVar[str] = 'characterset'
required_args: 't.ClassVar[set[str]]' = {'this'}
class AlterColumn(sqlglot.expressions.core.Expression):
243class AlterColumn(Expression):
244    arg_types = {
245        "this": True,
246        "dtype": False,
247        "collate": False,
248        "using": False,
249        "default": False,
250        "drop": False,
251        "comment": False,
252        "allow_null": False,
253        "visible": False,
254        "rename_to": False,
255        "exists": False,
256    }
arg_types = {'this': True, 'dtype': False, 'collate': False, 'using': False, 'default': False, 'drop': False, 'comment': False, 'allow_null': False, 'visible': False, 'rename_to': False, 'exists': False}
key: ClassVar[str] = 'altercolumn'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ModifyColumn(sqlglot.expressions.core.Expression):
259class ModifyColumn(Expression):
260    arg_types = {"this": True, "rename_from": False}
arg_types = {'this': True, 'rename_from': False}
key: ClassVar[str] = 'modifycolumn'
required_args: 't.ClassVar[set[str]]' = {'this'}
class AlterIndex(sqlglot.expressions.core.Expression):
263class AlterIndex(Expression):
264    arg_types = {"this": True, "visible": True}
arg_types = {'this': True, 'visible': True}
key: ClassVar[str] = 'alterindex'
required_args: 't.ClassVar[set[str]]' = {'visible', 'this'}
class AlterDistStyle(sqlglot.expressions.core.Expression):
267class AlterDistStyle(Expression):
268    pass
key: ClassVar[str] = 'alterdiststyle'
required_args: 't.ClassVar[set[str]]' = {'this'}
class AlterSortKey(sqlglot.expressions.core.Expression):
271class AlterSortKey(Expression):
272    arg_types = {"this": False, "expressions": False, "compound": False}
arg_types = {'this': False, 'expressions': False, 'compound': False}
key: ClassVar[str] = 'altersortkey'
required_args: 't.ClassVar[set[str]]' = set()
class AlterSet(sqlglot.expressions.core.Expression):
275class AlterSet(Expression):
276    arg_types = {
277        "expressions": False,
278        "option": False,
279        "tablespace": False,
280        "access_method": False,
281        "file_format": False,
282        "copy_options": False,
283        "tag": False,
284        "location": False,
285        "serde": False,
286    }
arg_types = {'expressions': False, 'option': False, 'tablespace': False, 'access_method': False, 'file_format': False, 'copy_options': False, 'tag': False, 'location': False, 'serde': False}
key: ClassVar[str] = 'alterset'
required_args: 't.ClassVar[set[str]]' = set()
class RenameColumn(sqlglot.expressions.core.Expression):
289class RenameColumn(Expression):
290    arg_types = {"this": True, "to": True, "exists": False}
arg_types = {'this': True, 'to': True, 'exists': False}
key: ClassVar[str] = 'renamecolumn'
required_args: 't.ClassVar[set[str]]' = {'to', 'this'}
class AlterRename(sqlglot.expressions.core.Expression):
293class AlterRename(Expression):
294    pass
key: ClassVar[str] = 'alterrename'
required_args: 't.ClassVar[set[str]]' = {'this'}
class RenameIndex(sqlglot.expressions.core.Expression):
297class RenameIndex(Expression):
298    arg_types = {"this": True, "to": True}
arg_types = {'this': True, 'to': True}
key: ClassVar[str] = 'renameindex'
required_args: 't.ClassVar[set[str]]' = {'to', 'this'}
class AlterModifySqlSecurity(sqlglot.expressions.core.Expression):
301class AlterModifySqlSecurity(Expression):
302    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'altermodifysqlsecurity'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class SwapTable(sqlglot.expressions.core.Expression):
305class SwapTable(Expression):
306    pass
key: ClassVar[str] = 'swaptable'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Comment(sqlglot.expressions.core.Expression):
309class Comment(Expression):
310    arg_types = {
311        "this": True,
312        "kind": True,
313        "expression": True,
314        "exists": False,
315        "materialized": False,
316    }
arg_types = {'this': True, 'kind': True, 'expression': True, 'exists': False, 'materialized': False}
key: ClassVar[str] = 'comment'
required_args: 't.ClassVar[set[str]]' = {'kind', 'this', 'expression'}
class Comprehension(sqlglot.expressions.core.Expression):
319class Comprehension(Expression):
320    arg_types = {
321        "this": True,
322        "expression": True,
323        "position": False,
324        "iterator": True,
325        "condition": False,
326    }
arg_types = {'this': True, 'expression': True, 'position': False, 'iterator': True, 'condition': False}
key: ClassVar[str] = 'comprehension'
required_args: 't.ClassVar[set[str]]' = {'expression', 'this', 'iterator'}
class MergeTreeTTLAction(sqlglot.expressions.core.Expression):
329class MergeTreeTTLAction(Expression):
330    arg_types = {
331        "this": True,
332        "delete": False,
333        "recompress": False,
334        "to_disk": False,
335        "to_volume": False,
336    }
arg_types = {'this': True, 'delete': False, 'recompress': False, 'to_disk': False, 'to_volume': False}
key: ClassVar[str] = 'mergetreettlaction'
required_args: 't.ClassVar[set[str]]' = {'this'}
class MergeTreeTTL(sqlglot.expressions.core.Expression):
339class MergeTreeTTL(Expression):
340    arg_types = {
341        "expressions": True,
342        "where": False,
343        "group": False,
344        "aggregates": False,
345    }
arg_types = {'expressions': True, 'where': False, 'group': False, 'aggregates': False}
key: ClassVar[str] = 'mergetreettl'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class Drop(sqlglot.expressions.core.Expression):
348class Drop(Expression):
349    arg_types = {
350        "kind": False,
351        "tables": False,
352        "expressions": False,
353        "exists": False,
354        "temporary": False,
355        "materialized": False,
356        "cascade": False,
357        "restrict": False,
358        "constraints": False,
359        "purge": False,
360        "cluster": False,
361        "concurrently": False,
362        "sync": False,
363        "iceberg": False,
364        "force": False,
365    }
366
367    @property
368    def kind(self) -> str | None:
369        kind = self.args.get("kind")
370        return kind and kind.upper()
arg_types = {'kind': False, 'tables': False, 'expressions': False, 'exists': False, 'temporary': False, 'materialized': False, 'cascade': False, 'restrict': False, 'constraints': False, 'purge': False, 'cluster': False, 'concurrently': False, 'sync': False, 'iceberg': False, 'force': False}
kind: str | None
367    @property
368    def kind(self) -> str | None:
369        kind = self.args.get("kind")
370        return kind and kind.upper()
key: ClassVar[str] = 'drop'
required_args: 't.ClassVar[set[str]]' = set()
class DropPrimaryKey(sqlglot.expressions.core.Expression):
373class DropPrimaryKey(Expression):
374    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'dropprimarykey'
required_args: 't.ClassVar[set[str]]' = set()
class Undrop(sqlglot.expressions.core.Expression):
377class Undrop(Expression):
378    arg_types = {"this": True, "kind": True, "rename": False}
379
380    @property
381    def kind(self) -> str:
382        return self.args["kind"].upper()
arg_types = {'this': True, 'kind': True, 'rename': False}
kind: str
380    @property
381    def kind(self) -> str:
382        return self.args["kind"].upper()
key: ClassVar[str] = 'undrop'
required_args: 't.ClassVar[set[str]]' = {'kind', 'this'}
class Command(sqlglot.expressions.core.Expression):
385class Command(Expression):
386    arg_types = {"this": True, "expression": False}
387    _hash_raw_args = True
arg_types = {'this': True, 'expression': False}
key: ClassVar[str] = 'command'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Transaction(sqlglot.expressions.core.Expression):
390class Transaction(Expression):
391    arg_types = {"this": False, "modes": False, "mark": False}
arg_types = {'this': False, 'modes': False, 'mark': False}
key: ClassVar[str] = 'transaction'
required_args: 't.ClassVar[set[str]]' = set()
class Commit(sqlglot.expressions.core.Expression):
394class Commit(Expression):
395    arg_types = {"chain": False, "this": False, "durability": False}
arg_types = {'chain': False, 'this': False, 'durability': False}
key: ClassVar[str] = 'commit'
required_args: 't.ClassVar[set[str]]' = set()
class Rollback(sqlglot.expressions.core.Expression):
398class Rollback(Expression):
399    arg_types = {"savepoint": False, "this": False}
arg_types = {'savepoint': False, 'this': False}
key: ClassVar[str] = 'rollback'
required_args: 't.ClassVar[set[str]]' = set()
class Alter(sqlglot.expressions.core.Expression):
402class Alter(Expression):
403    arg_types = {
404        "this": False,
405        "kind": True,
406        "actions": False,
407        "exists": False,
408        "only": False,
409        "options": False,
410        "cluster": False,
411        "not_valid": False,
412        "check": False,
413        "cascade": False,
414        "iceberg": False,
415    }
416
417    @property
418    def kind(self) -> str | None:
419        kind = self.args.get("kind")
420        return kind and kind.upper()
421
422    @property
423    def actions(self) -> list[Expr]:
424        return self.args.get("actions") or []
arg_types = {'this': False, 'kind': True, 'actions': False, 'exists': False, 'only': False, 'options': False, 'cluster': False, 'not_valid': False, 'check': False, 'cascade': False, 'iceberg': False}
kind: str | None
417    @property
418    def kind(self) -> str | None:
419        kind = self.args.get("kind")
420        return kind and kind.upper()
actions: list[sqlglot.expressions.core.Expr]
422    @property
423    def actions(self) -> list[Expr]:
424        return self.args.get("actions") or []
key: ClassVar[str] = 'alter'
required_args: 't.ClassVar[set[str]]' = {'kind'}
class AlterSession(sqlglot.expressions.core.Expression):
427class AlterSession(Expression):
428    arg_types = {"expressions": True, "unset": False}
arg_types = {'expressions': True, 'unset': False}
key: ClassVar[str] = 'altersession'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class Use(sqlglot.expressions.core.Expression):
431class Use(Expression):
432    arg_types = {"this": False, "expressions": False, "kind": False}
arg_types = {'this': False, 'expressions': False, 'kind': False}
key: ClassVar[str] = 'use'
required_args: 't.ClassVar[set[str]]' = set()
435class NextValueFor(Expression, Func):
436    arg_types = {"this": True, "order": False}
arg_types = {'this': True, 'order': False}
key: ClassVar[str] = 'nextvaluefor'
required_args: 't.ClassVar[set[str]]' = {'this'}
class Execute(sqlglot.expressions.core.Expression):
439class Execute(Expression):
440    arg_types = {"this": True, "expressions": False, "return_status": False}
441
442    @property
443    def name(self) -> str:
444        return self.this.name
arg_types = {'this': True, 'expressions': False, 'return_status': False}
name: str
442    @property
443    def name(self) -> str:
444        return self.this.name
key: ClassVar[str] = 'execute'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ExecuteSql(Execute):
447class ExecuteSql(Execute):
448    pass
key: ClassVar[str] = 'executesql'
required_args: 't.ClassVar[set[str]]' = {'this'}