Edit on GitHub

sqlglot expressions properties.

  1"""sqlglot expressions properties."""
  2
  3from __future__ import annotations
  4
  5import typing as t
  6from enum import auto
  7
  8from sqlglot.helper import AutoName
  9from sqlglot.expressions.core import Expression, ColumnConstraintKind, Literal, convert
 10
 11
 12class Property(Expression):
 13    arg_types = {"this": True, "value": True}
 14
 15
 16class GrantPrivilege(Expression):
 17    arg_types = {"this": True, "expressions": False}
 18
 19
 20class GrantPrincipal(Expression):
 21    arg_types = {"this": True, "kind": False}
 22
 23
 24class AllowedValuesProperty(Expression):
 25    arg_types = {"expressions": True}
 26
 27
 28class AlgorithmProperty(Property):
 29    arg_types = {"this": True}
 30
 31
 32class ApiProperty(Property):
 33    arg_types = {}
 34
 35
 36class ApplicationProperty(Property):
 37    arg_types = {}
 38
 39
 40class AutoIncrementProperty(Property):
 41    arg_types = {"this": True}
 42
 43
 44class AutoRefreshProperty(Property):
 45    arg_types = {"this": True}
 46
 47
 48class BackupProperty(Property):
 49    arg_types = {"this": True}
 50
 51
 52class BuildProperty(Property):
 53    arg_types = {"this": True}
 54
 55
 56class BlockCompressionProperty(Property):
 57    arg_types = {
 58        "autotemp": False,
 59        "always": False,
 60        "default": False,
 61        "manual": False,
 62        "never": False,
 63    }
 64
 65
 66class CatalogProperty(Property):
 67    arg_types = {}
 68
 69
 70class CharacterSetProperty(Property):
 71    arg_types = {"this": True, "default": True}
 72
 73
 74class ChecksumProperty(Property):
 75    arg_types = {"on": False, "default": False}
 76
 77
 78class CollateProperty(Property):
 79    arg_types = {"this": True, "default": False}
 80
 81
 82class ComputeProperty(Property):
 83    arg_types = {}
 84
 85
 86class CopyGrantsProperty(Property):
 87    arg_types = {}
 88
 89
 90class DataBlocksizeProperty(Property):
 91    arg_types = {
 92        "size": False,
 93        "units": False,
 94        "minimum": False,
 95        "maximum": False,
 96        "default": False,
 97    }
 98
 99
100class DataDeletionProperty(Property):
101    arg_types = {"on": True, "filter_column": False, "retention_period": False}
102
103
104class DatabaseProperty(Property):
105    arg_types = {}
106
107
108class DefinerProperty(Property):
109    arg_types = {"this": True}
110
111
112class DistKeyProperty(Property):
113    arg_types = {"this": True}
114
115
116class DistributedByProperty(Property):
117    arg_types = {"expressions": False, "kind": True, "buckets": False, "order": False}
118
119
120class DistStyleProperty(Property):
121    arg_types = {"this": True}
122
123
124class DuplicateKeyProperty(Property):
125    arg_types = {"expressions": True}
126
127
128class EngineProperty(Property):
129    arg_types = {"this": True}
130
131
132class UuidProperty(Property):
133    arg_types = {"this": True}
134
135
136class HeapProperty(Property):
137    arg_types = {}
138
139
140class HybridProperty(Property):
141    arg_types = {}
142
143
144class HandlerProperty(Property):
145    arg_types = {"this": True}
146
147
148class ParameterStyleProperty(Property):
149    arg_types = {"this": True}
150
151
152class ToTableProperty(Property):
153    arg_types = {"this": True}
154
155
156class ExecuteAsProperty(Property):
157    arg_types = {"this": True}
158
159
160class ExternalProperty(Property):
161    arg_types = {"this": False}
162
163
164class FallbackProperty(Property):
165    arg_types = {"no": True, "protection": False}
166
167
168class FileFormatProperty(Property):
169    arg_types = {"this": False, "expressions": False, "hive_format": False}
170
171
172class CredentialsProperty(Property):
173    arg_types = {"expressions": True}
174
175
176class FreespaceProperty(Property):
177    arg_types = {"this": True, "percent": False}
178
179
180class GlobalProperty(Property):
181    arg_types = {}
182
183
184class IcebergProperty(Property):
185    arg_types = {}
186
187
188class InheritsProperty(Property):
189    arg_types = {"expressions": True}
190
191
192class InputModelProperty(Property):
193    arg_types = {"this": True}
194
195
196class OutputModelProperty(Property):
197    arg_types = {"this": True}
198
199
200class IsolatedLoadingProperty(Property):
201    arg_types = {"no": False, "concurrent": False, "target": False}
202
203
204class JournalProperty(Property):
205    arg_types = {
206        "no": False,
207        "dual": False,
208        "before": False,
209        "local": False,
210        "after": False,
211    }
212
213
214class LanguageProperty(Property):
215    arg_types = {"this": True}
216
217
218class EnviromentProperty(Property):
219    arg_types = {"expressions": True}
220
221
222class ClusteredByProperty(Property):
223    arg_types = {"expressions": True, "sorted_by": False, "buckets": True}
224
225
226class DictProperty(Property):
227    arg_types = {"this": True, "kind": True, "settings": False}
228
229
230class DictSubProperty(Property):
231    pass
232
233
234class DictRange(Property):
235    arg_types = {"this": True, "min": True, "max": True}
236
237
238class DynamicProperty(Property):
239    arg_types = {}
240
241
242class OnCluster(Property):
243    arg_types = {"this": True}
244
245
246class EmptyProperty(Property):
247    arg_types = {}
248
249
250class LikeProperty(Property):
251    arg_types = {"this": True, "expressions": False}
252
253
254class LocationProperty(Property):
255    arg_types = {"this": True}
256
257
258class LockProperty(Property):
259    arg_types = {"this": True}
260
261
262class LockingProperty(Property):
263    arg_types = {
264        "this": False,
265        "kind": True,
266        "for_or_in": False,
267        "lock_type": True,
268        "override": False,
269    }
270
271
272class LogProperty(Property):
273    arg_types = {"no": True}
274
275
276class MaskingProperty(Property):
277    arg_types = {}
278
279
280class MaterializedProperty(Property):
281    arg_types = {"this": False}
282
283
284class MergeBlockRatioProperty(Property):
285    arg_types = {"this": False, "no": False, "default": False, "percent": False}
286
287
288class ModuleProperty(Property):
289    arg_types = {"this": True, "expressions": False}
290
291
292class NetworkProperty(Property):
293    arg_types = {}
294
295
296class NoPrimaryIndexProperty(Property):
297    arg_types = {}
298
299
300class OnProperty(Property):
301    arg_types = {"this": True}
302
303
304class OnCommitProperty(Property):
305    arg_types = {"delete": False}
306
307
308class PartitionedByProperty(Property):
309    arg_types = {"this": True}
310
311
312class PartitionedByBucket(Property):
313    arg_types = {"this": True, "expression": True}
314
315
316class PartitionByTruncate(Property):
317    arg_types = {"this": True, "expression": True}
318
319
320class PartitionByRangeProperty(Property):
321    arg_types = {"partition_expressions": True, "create_expressions": True}
322
323
324class PartitionByRangePropertyDynamic(Expression):
325    arg_types = {"this": False, "start": True, "end": True, "every": True}
326
327
328class RollupProperty(Property):
329    arg_types = {"expressions": True}
330
331
332class RollupIndex(Expression):
333    arg_types = {"this": True, "expressions": True, "from_index": False, "properties": False}
334
335
336class RowAccessProperty(Property):
337    arg_types = {"this": False, "expressions": False}
338
339
340class PartitionByListProperty(Property):
341    arg_types = {"partition_expressions": True, "create_expressions": True}
342
343
344class PartitionList(Expression):
345    arg_types = {"this": True, "expressions": True}
346
347
348class RefreshTriggerProperty(Property):
349    arg_types = {
350        "method": False,
351        "kind": False,
352        "every": False,
353        "unit": False,
354        "starts": False,
355    }
356
357
358class UniqueKeyProperty(Property):
359    arg_types = {"expressions": True}
360
361
362class PartitionBoundSpec(Expression):
363    # this -> IN / MODULUS, expression -> REMAINDER, from_expressions -> FROM (...), to_expressions -> TO (...)
364    arg_types = {
365        "this": False,
366        "expression": False,
367        "from_expressions": False,
368        "to_expressions": False,
369    }
370
371
372class PartitionedOfProperty(Property):
373    # this -> parent_table (schema), expression -> FOR VALUES ... / DEFAULT
374    arg_types = {"this": True, "expression": True}
375
376
377class StreamingTableProperty(Property):
378    arg_types = {}
379
380
381class RemoteWithConnectionModelProperty(Property):
382    arg_types = {"this": True}
383
384
385class ReturnsProperty(Property):
386    arg_types = {"this": False, "is_table": False, "table": False, "null": False}
387
388
389class StrictProperty(Property):
390    arg_types = {}
391
392
393class RowFormatProperty(Property):
394    arg_types = {"this": True}
395
396
397class RowFormatDelimitedProperty(Property):
398    # https://cwiki.apache.org/confluence/display/hive/languagemanual+dml
399    arg_types = {
400        "fields": False,
401        "escaped": False,
402        "collection_items": False,
403        "map_keys": False,
404        "lines": False,
405        "null": False,
406        "serde": False,
407    }
408
409
410class RowFormatSerdeProperty(Property):
411    arg_types = {"this": True, "serde_properties": False}
412
413
414class QueryTransform(Expression):
415    arg_types = {
416        "expressions": True,
417        "command_script": True,
418        "schema": False,
419        "row_format_before": False,
420        "record_writer": False,
421        "row_format_after": False,
422        "record_reader": False,
423    }
424
425
426class SampleProperty(Property):
427    arg_types = {"this": True}
428
429
430class SchemaCommentProperty(Property):
431    arg_types = {"this": True}
432
433
434class SemanticView(Expression):
435    arg_types = {
436        "this": True,
437        "metrics": False,
438        "dimensions": False,
439        "facts": False,
440        "where": False,
441    }
442
443
444class SerdeProperties(Property):
445    arg_types = {"expressions": True, "with_": False}
446
447
448class SetProperty(Property):
449    arg_types = {"multi": True}
450
451
452class SharingProperty(Property):
453    arg_types = {"this": False}
454
455
456class SetConfigProperty(Property):
457    arg_types = {"this": True}
458
459
460class SettingsProperty(Property):
461    arg_types = {"expressions": True}
462
463
464class SortKeyProperty(Property):
465    arg_types = {"this": True, "compound": False}
466
467
468class SqlReadWriteProperty(Property):
469    arg_types = {"this": True}
470
471
472class SqlSecurityProperty(Property):
473    arg_types = {"this": True}
474
475
476class StabilityProperty(Property):
477    arg_types = {"this": True}
478
479
480class StorageHandlerProperty(Property):
481    arg_types = {"this": True}
482
483
484class UsingProperty(Property):
485    # kind: JAR, FILE, or ARCHIVE; this: the resource path (string literal)
486    arg_types = {"this": True, "kind": True}
487
488
489class TemporaryProperty(Property):
490    arg_types = {"this": False}
491
492
493class VirtualProperty(Property):
494    arg_types = {}
495
496
497class SecureProperty(Property):
498    arg_types = {}
499
500
501class SecurityIntegrationProperty(Property):
502    arg_types = {}
503
504
505class Tags(Property, ColumnConstraintKind):
506    arg_types = {"expressions": True}
507
508
509class PropertiesLocation(AutoName):
510    POST_CREATE = auto()
511    POST_NAME = auto()
512    POST_SCHEMA = auto()
513    POST_WITH = auto()
514    POST_ALIAS = auto()
515    POST_EXPRESSION = auto()
516    POST_INDEX = auto()
517    UNSUPPORTED = auto()
518
519
520class TransformModelProperty(Property):
521    arg_types = {"expressions": True}
522
523
524class TransientProperty(Property):
525    arg_types = {"this": False}
526
527
528class UnloggedProperty(Property):
529    arg_types = {}
530
531
532class UsingTemplateProperty(Property):
533    arg_types = {"this": True}
534
535
536class ViewAttributeProperty(Property):
537    arg_types = {"this": True}
538
539
540class VolatileProperty(Property):
541    arg_types = {"this": False}
542
543
544class WithDataProperty(Property):
545    arg_types = {"no": True, "statistics": False}
546
547
548class WithJournalTableProperty(Property):
549    arg_types = {"this": True}
550
551
552class WithSchemaBindingProperty(Property):
553    arg_types = {"this": True}
554
555
556class WithSystemVersioningProperty(Property):
557    arg_types = {
558        "on": False,
559        "this": False,
560        "data_consistency": False,
561        "retention_period": False,
562        "with_": True,
563    }
564
565
566class WithProcedureOptions(Property):
567    arg_types = {"expressions": True}
568
569
570class EncodeProperty(Property):
571    arg_types = {"this": True, "properties": False, "key": False}
572
573
574class IncludeProperty(Property):
575    arg_types = {"this": True, "alias": False, "column_def": False}
576
577
578class ForceProperty(Property):
579    arg_types = {}
580
581
582class Properties(Expression):
583    arg_types = {"expressions": True}
584
585    NAME_TO_PROPERTY: t.ClassVar[dict[str, type[Property]]] = {
586        "ALGORITHM": AlgorithmProperty,
587        "AUTO_INCREMENT": AutoIncrementProperty,
588        "CHARACTER SET": CharacterSetProperty,
589        "CLUSTERED_BY": ClusteredByProperty,
590        "COLLATE": CollateProperty,
591        "COMMENT": SchemaCommentProperty,
592        "CREDENTIALS": CredentialsProperty,
593        "DEFINER": DefinerProperty,
594        "DISTKEY": DistKeyProperty,
595        "DISTRIBUTED_BY": DistributedByProperty,
596        "DISTSTYLE": DistStyleProperty,
597        "ENGINE": EngineProperty,
598        "EXECUTE AS": ExecuteAsProperty,
599        "FORMAT": FileFormatProperty,
600        "LANGUAGE": LanguageProperty,
601        "LOCATION": LocationProperty,
602        "LOCK": LockProperty,
603        "PARTITIONED_BY": PartitionedByProperty,
604        "RETURNS": ReturnsProperty,
605        "ROW_FORMAT": RowFormatProperty,
606        "SORTKEY": SortKeyProperty,
607        "ENCODE": EncodeProperty,
608        "INCLUDE": IncludeProperty,
609    }
610
611    PROPERTY_TO_NAME: t.ClassVar[dict[type[Property], str]] = {}
612
613    # CREATE property locations
614    # Form: schema specified
615    #   create [POST_CREATE]
616    #     table a [POST_NAME]
617    #     (b int) [POST_SCHEMA]
618    #     with ([POST_WITH])
619    #     index (b) [POST_INDEX]
620    #
621    # Form: alias selection
622    #   create [POST_CREATE]
623    #     table a [POST_NAME]
624    #     as [POST_ALIAS] (select * from b) [POST_EXPRESSION]
625    #     index (c) [POST_INDEX]
626    Location: t.ClassVar[type[PropertiesLocation]] = PropertiesLocation
627
628    @classmethod
629    def from_dict(cls, properties_dict: dict) -> Properties:
630        expressions = []
631        for key, value in properties_dict.items():
632            property_cls = cls.NAME_TO_PROPERTY.get(key.upper())
633            if property_cls:
634                expressions.append(property_cls(this=convert(value)))
635            else:
636                expressions.append(Property(this=Literal.string(key), value=convert(value)))
637
638        return cls(expressions=expressions)
639
640
641# TODO (mypyc)
642Properties.PROPERTY_TO_NAME = {v: k for k, v in Properties.NAME_TO_PROPERTY.items()}
class Property(sqlglot.expressions.core.Expression):
13class Property(Expression):
14    arg_types = {"this": True, "value": True}
arg_types = {'this': True, 'value': True}
key: ClassVar[str] = 'property'
required_args: 't.ClassVar[set[str]]' = {'value', 'this'}
class GrantPrivilege(sqlglot.expressions.core.Expression):
17class GrantPrivilege(Expression):
18    arg_types = {"this": True, "expressions": False}
arg_types = {'this': True, 'expressions': False}
key: ClassVar[str] = 'grantprivilege'
required_args: 't.ClassVar[set[str]]' = {'this'}
class GrantPrincipal(sqlglot.expressions.core.Expression):
21class GrantPrincipal(Expression):
22    arg_types = {"this": True, "kind": False}
arg_types = {'this': True, 'kind': False}
key: ClassVar[str] = 'grantprincipal'
required_args: 't.ClassVar[set[str]]' = {'this'}
class AllowedValuesProperty(sqlglot.expressions.core.Expression):
25class AllowedValuesProperty(Expression):
26    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'allowedvaluesproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class AlgorithmProperty(Property):
29class AlgorithmProperty(Property):
30    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'algorithmproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ApiProperty(Property):
33class ApiProperty(Property):
34    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'apiproperty'
required_args: 't.ClassVar[set[str]]' = set()
class ApplicationProperty(Property):
37class ApplicationProperty(Property):
38    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'applicationproperty'
required_args: 't.ClassVar[set[str]]' = set()
class AutoIncrementProperty(Property):
41class AutoIncrementProperty(Property):
42    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'autoincrementproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class AutoRefreshProperty(Property):
45class AutoRefreshProperty(Property):
46    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'autorefreshproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class BackupProperty(Property):
49class BackupProperty(Property):
50    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'backupproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class BuildProperty(Property):
53class BuildProperty(Property):
54    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'buildproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class BlockCompressionProperty(Property):
57class BlockCompressionProperty(Property):
58    arg_types = {
59        "autotemp": False,
60        "always": False,
61        "default": False,
62        "manual": False,
63        "never": False,
64    }
arg_types = {'autotemp': False, 'always': False, 'default': False, 'manual': False, 'never': False}
key: ClassVar[str] = 'blockcompressionproperty'
required_args: 't.ClassVar[set[str]]' = set()
class CatalogProperty(Property):
67class CatalogProperty(Property):
68    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'catalogproperty'
required_args: 't.ClassVar[set[str]]' = set()
class CharacterSetProperty(Property):
71class CharacterSetProperty(Property):
72    arg_types = {"this": True, "default": True}
arg_types = {'this': True, 'default': True}
key: ClassVar[str] = 'charactersetproperty'
required_args: 't.ClassVar[set[str]]' = {'default', 'this'}
class ChecksumProperty(Property):
75class ChecksumProperty(Property):
76    arg_types = {"on": False, "default": False}
arg_types = {'on': False, 'default': False}
key: ClassVar[str] = 'checksumproperty'
required_args: 't.ClassVar[set[str]]' = set()
class CollateProperty(Property):
79class CollateProperty(Property):
80    arg_types = {"this": True, "default": False}
arg_types = {'this': True, 'default': False}
key: ClassVar[str] = 'collateproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ComputeProperty(Property):
83class ComputeProperty(Property):
84    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'computeproperty'
required_args: 't.ClassVar[set[str]]' = set()
class CopyGrantsProperty(Property):
87class CopyGrantsProperty(Property):
88    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'copygrantsproperty'
required_args: 't.ClassVar[set[str]]' = set()
class DataBlocksizeProperty(Property):
91class DataBlocksizeProperty(Property):
92    arg_types = {
93        "size": False,
94        "units": False,
95        "minimum": False,
96        "maximum": False,
97        "default": False,
98    }
arg_types = {'size': False, 'units': False, 'minimum': False, 'maximum': False, 'default': False}
key: ClassVar[str] = 'datablocksizeproperty'
required_args: 't.ClassVar[set[str]]' = set()
class DataDeletionProperty(Property):
101class DataDeletionProperty(Property):
102    arg_types = {"on": True, "filter_column": False, "retention_period": False}
arg_types = {'on': True, 'filter_column': False, 'retention_period': False}
key: ClassVar[str] = 'datadeletionproperty'
required_args: 't.ClassVar[set[str]]' = {'on'}
class DatabaseProperty(Property):
105class DatabaseProperty(Property):
106    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'databaseproperty'
required_args: 't.ClassVar[set[str]]' = set()
class DefinerProperty(Property):
109class DefinerProperty(Property):
110    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'definerproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class DistKeyProperty(Property):
113class DistKeyProperty(Property):
114    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'distkeyproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class DistributedByProperty(Property):
117class DistributedByProperty(Property):
118    arg_types = {"expressions": False, "kind": True, "buckets": False, "order": False}
arg_types = {'expressions': False, 'kind': True, 'buckets': False, 'order': False}
key: ClassVar[str] = 'distributedbyproperty'
required_args: 't.ClassVar[set[str]]' = {'kind'}
class DistStyleProperty(Property):
121class DistStyleProperty(Property):
122    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'diststyleproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class DuplicateKeyProperty(Property):
125class DuplicateKeyProperty(Property):
126    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'duplicatekeyproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class EngineProperty(Property):
129class EngineProperty(Property):
130    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'engineproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class UuidProperty(Property):
133class UuidProperty(Property):
134    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'uuidproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class HeapProperty(Property):
137class HeapProperty(Property):
138    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'heapproperty'
required_args: 't.ClassVar[set[str]]' = set()
class HybridProperty(Property):
141class HybridProperty(Property):
142    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'hybridproperty'
required_args: 't.ClassVar[set[str]]' = set()
class HandlerProperty(Property):
145class HandlerProperty(Property):
146    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'handlerproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ParameterStyleProperty(Property):
149class ParameterStyleProperty(Property):
150    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'parameterstyleproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ToTableProperty(Property):
153class ToTableProperty(Property):
154    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'totableproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ExecuteAsProperty(Property):
157class ExecuteAsProperty(Property):
158    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'executeasproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ExternalProperty(Property):
161class ExternalProperty(Property):
162    arg_types = {"this": False}
arg_types = {'this': False}
key: ClassVar[str] = 'externalproperty'
required_args: 't.ClassVar[set[str]]' = set()
class FallbackProperty(Property):
165class FallbackProperty(Property):
166    arg_types = {"no": True, "protection": False}
arg_types = {'no': True, 'protection': False}
key: ClassVar[str] = 'fallbackproperty'
required_args: 't.ClassVar[set[str]]' = {'no'}
class FileFormatProperty(Property):
169class FileFormatProperty(Property):
170    arg_types = {"this": False, "expressions": False, "hive_format": False}
arg_types = {'this': False, 'expressions': False, 'hive_format': False}
key: ClassVar[str] = 'fileformatproperty'
required_args: 't.ClassVar[set[str]]' = set()
class CredentialsProperty(Property):
173class CredentialsProperty(Property):
174    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'credentialsproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class FreespaceProperty(Property):
177class FreespaceProperty(Property):
178    arg_types = {"this": True, "percent": False}
arg_types = {'this': True, 'percent': False}
key: ClassVar[str] = 'freespaceproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class GlobalProperty(Property):
181class GlobalProperty(Property):
182    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'globalproperty'
required_args: 't.ClassVar[set[str]]' = set()
class IcebergProperty(Property):
185class IcebergProperty(Property):
186    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'icebergproperty'
required_args: 't.ClassVar[set[str]]' = set()
class InheritsProperty(Property):
189class InheritsProperty(Property):
190    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'inheritsproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class InputModelProperty(Property):
193class InputModelProperty(Property):
194    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'inputmodelproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class OutputModelProperty(Property):
197class OutputModelProperty(Property):
198    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'outputmodelproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class IsolatedLoadingProperty(Property):
201class IsolatedLoadingProperty(Property):
202    arg_types = {"no": False, "concurrent": False, "target": False}
arg_types = {'no': False, 'concurrent': False, 'target': False}
key: ClassVar[str] = 'isolatedloadingproperty'
required_args: 't.ClassVar[set[str]]' = set()
class JournalProperty(Property):
205class JournalProperty(Property):
206    arg_types = {
207        "no": False,
208        "dual": False,
209        "before": False,
210        "local": False,
211        "after": False,
212    }
arg_types = {'no': False, 'dual': False, 'before': False, 'local': False, 'after': False}
key: ClassVar[str] = 'journalproperty'
required_args: 't.ClassVar[set[str]]' = set()
class LanguageProperty(Property):
215class LanguageProperty(Property):
216    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'languageproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class EnviromentProperty(Property):
219class EnviromentProperty(Property):
220    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'enviromentproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class ClusteredByProperty(Property):
223class ClusteredByProperty(Property):
224    arg_types = {"expressions": True, "sorted_by": False, "buckets": True}
arg_types = {'expressions': True, 'sorted_by': False, 'buckets': True}
key: ClassVar[str] = 'clusteredbyproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions', 'buckets'}
class DictProperty(Property):
227class DictProperty(Property):
228    arg_types = {"this": True, "kind": True, "settings": False}
arg_types = {'this': True, 'kind': True, 'settings': False}
key: ClassVar[str] = 'dictproperty'
required_args: 't.ClassVar[set[str]]' = {'kind', 'this'}
class DictSubProperty(Property):
231class DictSubProperty(Property):
232    pass
key: ClassVar[str] = 'dictsubproperty'
required_args: 't.ClassVar[set[str]]' = {'value', 'this'}
class DictRange(Property):
235class DictRange(Property):
236    arg_types = {"this": True, "min": True, "max": True}
arg_types = {'this': True, 'min': True, 'max': True}
key: ClassVar[str] = 'dictrange'
required_args: 't.ClassVar[set[str]]' = {'min', 'max', 'this'}
class DynamicProperty(Property):
239class DynamicProperty(Property):
240    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'dynamicproperty'
required_args: 't.ClassVar[set[str]]' = set()
class OnCluster(Property):
243class OnCluster(Property):
244    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'oncluster'
required_args: 't.ClassVar[set[str]]' = {'this'}
class EmptyProperty(Property):
247class EmptyProperty(Property):
248    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'emptyproperty'
required_args: 't.ClassVar[set[str]]' = set()
class LikeProperty(Property):
251class LikeProperty(Property):
252    arg_types = {"this": True, "expressions": False}
arg_types = {'this': True, 'expressions': False}
key: ClassVar[str] = 'likeproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class LocationProperty(Property):
255class LocationProperty(Property):
256    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'locationproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class LockProperty(Property):
259class LockProperty(Property):
260    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'lockproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class LockingProperty(Property):
263class LockingProperty(Property):
264    arg_types = {
265        "this": False,
266        "kind": True,
267        "for_or_in": False,
268        "lock_type": True,
269        "override": False,
270    }
arg_types = {'this': False, 'kind': True, 'for_or_in': False, 'lock_type': True, 'override': False}
key: ClassVar[str] = 'lockingproperty'
required_args: 't.ClassVar[set[str]]' = {'lock_type', 'kind'}
class LogProperty(Property):
273class LogProperty(Property):
274    arg_types = {"no": True}
arg_types = {'no': True}
key: ClassVar[str] = 'logproperty'
required_args: 't.ClassVar[set[str]]' = {'no'}
class MaskingProperty(Property):
277class MaskingProperty(Property):
278    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'maskingproperty'
required_args: 't.ClassVar[set[str]]' = set()
class MaterializedProperty(Property):
281class MaterializedProperty(Property):
282    arg_types = {"this": False}
arg_types = {'this': False}
key: ClassVar[str] = 'materializedproperty'
required_args: 't.ClassVar[set[str]]' = set()
class MergeBlockRatioProperty(Property):
285class MergeBlockRatioProperty(Property):
286    arg_types = {"this": False, "no": False, "default": False, "percent": False}
arg_types = {'this': False, 'no': False, 'default': False, 'percent': False}
key: ClassVar[str] = 'mergeblockratioproperty'
required_args: 't.ClassVar[set[str]]' = set()
class ModuleProperty(Property):
289class ModuleProperty(Property):
290    arg_types = {"this": True, "expressions": False}
arg_types = {'this': True, 'expressions': False}
key: ClassVar[str] = 'moduleproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class NetworkProperty(Property):
293class NetworkProperty(Property):
294    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'networkproperty'
required_args: 't.ClassVar[set[str]]' = set()
class NoPrimaryIndexProperty(Property):
297class NoPrimaryIndexProperty(Property):
298    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'noprimaryindexproperty'
required_args: 't.ClassVar[set[str]]' = set()
class OnProperty(Property):
301class OnProperty(Property):
302    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'onproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class OnCommitProperty(Property):
305class OnCommitProperty(Property):
306    arg_types = {"delete": False}
arg_types = {'delete': False}
key: ClassVar[str] = 'oncommitproperty'
required_args: 't.ClassVar[set[str]]' = set()
class PartitionedByProperty(Property):
309class PartitionedByProperty(Property):
310    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'partitionedbyproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class PartitionedByBucket(Property):
313class PartitionedByBucket(Property):
314    arg_types = {"this": True, "expression": True}
arg_types = {'this': True, 'expression': True}
key: ClassVar[str] = 'partitionedbybucket'
required_args: 't.ClassVar[set[str]]' = {'expression', 'this'}
class PartitionByTruncate(Property):
317class PartitionByTruncate(Property):
318    arg_types = {"this": True, "expression": True}
arg_types = {'this': True, 'expression': True}
key: ClassVar[str] = 'partitionbytruncate'
required_args: 't.ClassVar[set[str]]' = {'expression', 'this'}
class PartitionByRangeProperty(Property):
321class PartitionByRangeProperty(Property):
322    arg_types = {"partition_expressions": True, "create_expressions": True}
arg_types = {'partition_expressions': True, 'create_expressions': True}
key: ClassVar[str] = 'partitionbyrangeproperty'
required_args: 't.ClassVar[set[str]]' = {'create_expressions', 'partition_expressions'}
class PartitionByRangePropertyDynamic(sqlglot.expressions.core.Expression):
325class PartitionByRangePropertyDynamic(Expression):
326    arg_types = {"this": False, "start": True, "end": True, "every": True}
arg_types = {'this': False, 'start': True, 'end': True, 'every': True}
key: ClassVar[str] = 'partitionbyrangepropertydynamic'
required_args: 't.ClassVar[set[str]]' = {'every', 'start', 'end'}
class RollupProperty(Property):
329class RollupProperty(Property):
330    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'rollupproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class RollupIndex(sqlglot.expressions.core.Expression):
333class RollupIndex(Expression):
334    arg_types = {"this": True, "expressions": True, "from_index": False, "properties": False}
arg_types = {'this': True, 'expressions': True, 'from_index': False, 'properties': False}
key: ClassVar[str] = 'rollupindex'
required_args: 't.ClassVar[set[str]]' = {'expressions', 'this'}
class RowAccessProperty(Property):
337class RowAccessProperty(Property):
338    arg_types = {"this": False, "expressions": False}
arg_types = {'this': False, 'expressions': False}
key: ClassVar[str] = 'rowaccessproperty'
required_args: 't.ClassVar[set[str]]' = set()
class PartitionByListProperty(Property):
341class PartitionByListProperty(Property):
342    arg_types = {"partition_expressions": True, "create_expressions": True}
arg_types = {'partition_expressions': True, 'create_expressions': True}
key: ClassVar[str] = 'partitionbylistproperty'
required_args: 't.ClassVar[set[str]]' = {'create_expressions', 'partition_expressions'}
class PartitionList(sqlglot.expressions.core.Expression):
345class PartitionList(Expression):
346    arg_types = {"this": True, "expressions": True}
arg_types = {'this': True, 'expressions': True}
key: ClassVar[str] = 'partitionlist'
required_args: 't.ClassVar[set[str]]' = {'expressions', 'this'}
class RefreshTriggerProperty(Property):
349class RefreshTriggerProperty(Property):
350    arg_types = {
351        "method": False,
352        "kind": False,
353        "every": False,
354        "unit": False,
355        "starts": False,
356    }
arg_types = {'method': False, 'kind': False, 'every': False, 'unit': False, 'starts': False}
key: ClassVar[str] = 'refreshtriggerproperty'
required_args: 't.ClassVar[set[str]]' = set()
class UniqueKeyProperty(Property):
359class UniqueKeyProperty(Property):
360    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'uniquekeyproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class PartitionBoundSpec(sqlglot.expressions.core.Expression):
363class PartitionBoundSpec(Expression):
364    # this -> IN / MODULUS, expression -> REMAINDER, from_expressions -> FROM (...), to_expressions -> TO (...)
365    arg_types = {
366        "this": False,
367        "expression": False,
368        "from_expressions": False,
369        "to_expressions": False,
370    }
arg_types = {'this': False, 'expression': False, 'from_expressions': False, 'to_expressions': False}
key: ClassVar[str] = 'partitionboundspec'
required_args: 't.ClassVar[set[str]]' = set()
class PartitionedOfProperty(Property):
373class PartitionedOfProperty(Property):
374    # this -> parent_table (schema), expression -> FOR VALUES ... / DEFAULT
375    arg_types = {"this": True, "expression": True}
arg_types = {'this': True, 'expression': True}
key: ClassVar[str] = 'partitionedofproperty'
required_args: 't.ClassVar[set[str]]' = {'expression', 'this'}
class StreamingTableProperty(Property):
378class StreamingTableProperty(Property):
379    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'streamingtableproperty'
required_args: 't.ClassVar[set[str]]' = set()
class RemoteWithConnectionModelProperty(Property):
382class RemoteWithConnectionModelProperty(Property):
383    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'remotewithconnectionmodelproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ReturnsProperty(Property):
386class ReturnsProperty(Property):
387    arg_types = {"this": False, "is_table": False, "table": False, "null": False}
arg_types = {'this': False, 'is_table': False, 'table': False, 'null': False}
key: ClassVar[str] = 'returnsproperty'
required_args: 't.ClassVar[set[str]]' = set()
class StrictProperty(Property):
390class StrictProperty(Property):
391    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'strictproperty'
required_args: 't.ClassVar[set[str]]' = set()
class RowFormatProperty(Property):
394class RowFormatProperty(Property):
395    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'rowformatproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class RowFormatDelimitedProperty(Property):
398class RowFormatDelimitedProperty(Property):
399    # https://cwiki.apache.org/confluence/display/hive/languagemanual+dml
400    arg_types = {
401        "fields": False,
402        "escaped": False,
403        "collection_items": False,
404        "map_keys": False,
405        "lines": False,
406        "null": False,
407        "serde": False,
408    }
arg_types = {'fields': False, 'escaped': False, 'collection_items': False, 'map_keys': False, 'lines': False, 'null': False, 'serde': False}
key: ClassVar[str] = 'rowformatdelimitedproperty'
required_args: 't.ClassVar[set[str]]' = set()
class RowFormatSerdeProperty(Property):
411class RowFormatSerdeProperty(Property):
412    arg_types = {"this": True, "serde_properties": False}
arg_types = {'this': True, 'serde_properties': False}
key: ClassVar[str] = 'rowformatserdeproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class QueryTransform(sqlglot.expressions.core.Expression):
415class QueryTransform(Expression):
416    arg_types = {
417        "expressions": True,
418        "command_script": True,
419        "schema": False,
420        "row_format_before": False,
421        "record_writer": False,
422        "row_format_after": False,
423        "record_reader": False,
424    }
arg_types = {'expressions': True, 'command_script': True, 'schema': False, 'row_format_before': False, 'record_writer': False, 'row_format_after': False, 'record_reader': False}
key: ClassVar[str] = 'querytransform'
required_args: 't.ClassVar[set[str]]' = {'command_script', 'expressions'}
class SampleProperty(Property):
427class SampleProperty(Property):
428    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'sampleproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class SchemaCommentProperty(Property):
431class SchemaCommentProperty(Property):
432    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'schemacommentproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class SemanticView(sqlglot.expressions.core.Expression):
435class SemanticView(Expression):
436    arg_types = {
437        "this": True,
438        "metrics": False,
439        "dimensions": False,
440        "facts": False,
441        "where": False,
442    }
arg_types = {'this': True, 'metrics': False, 'dimensions': False, 'facts': False, 'where': False}
key: ClassVar[str] = 'semanticview'
required_args: 't.ClassVar[set[str]]' = {'this'}
class SerdeProperties(Property):
445class SerdeProperties(Property):
446    arg_types = {"expressions": True, "with_": False}
arg_types = {'expressions': True, 'with_': False}
key: ClassVar[str] = 'serdeproperties'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class SetProperty(Property):
449class SetProperty(Property):
450    arg_types = {"multi": True}
arg_types = {'multi': True}
key: ClassVar[str] = 'setproperty'
required_args: 't.ClassVar[set[str]]' = {'multi'}
class SharingProperty(Property):
453class SharingProperty(Property):
454    arg_types = {"this": False}
arg_types = {'this': False}
key: ClassVar[str] = 'sharingproperty'
required_args: 't.ClassVar[set[str]]' = set()
class SetConfigProperty(Property):
457class SetConfigProperty(Property):
458    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'setconfigproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class SettingsProperty(Property):
461class SettingsProperty(Property):
462    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'settingsproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class SortKeyProperty(Property):
465class SortKeyProperty(Property):
466    arg_types = {"this": True, "compound": False}
arg_types = {'this': True, 'compound': False}
key: ClassVar[str] = 'sortkeyproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class SqlReadWriteProperty(Property):
469class SqlReadWriteProperty(Property):
470    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'sqlreadwriteproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class SqlSecurityProperty(Property):
473class SqlSecurityProperty(Property):
474    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'sqlsecurityproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class StabilityProperty(Property):
477class StabilityProperty(Property):
478    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'stabilityproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class StorageHandlerProperty(Property):
481class StorageHandlerProperty(Property):
482    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'storagehandlerproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class UsingProperty(Property):
485class UsingProperty(Property):
486    # kind: JAR, FILE, or ARCHIVE; this: the resource path (string literal)
487    arg_types = {"this": True, "kind": True}
arg_types = {'this': True, 'kind': True}
key: ClassVar[str] = 'usingproperty'
required_args: 't.ClassVar[set[str]]' = {'kind', 'this'}
class TemporaryProperty(Property):
490class TemporaryProperty(Property):
491    arg_types = {"this": False}
arg_types = {'this': False}
key: ClassVar[str] = 'temporaryproperty'
required_args: 't.ClassVar[set[str]]' = set()
class VirtualProperty(Property):
494class VirtualProperty(Property):
495    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'virtualproperty'
required_args: 't.ClassVar[set[str]]' = set()
class SecureProperty(Property):
498class SecureProperty(Property):
499    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'secureproperty'
required_args: 't.ClassVar[set[str]]' = set()
class SecurityIntegrationProperty(Property):
502class SecurityIntegrationProperty(Property):
503    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'securityintegrationproperty'
required_args: 't.ClassVar[set[str]]' = set()
506class Tags(Property, ColumnConstraintKind):
507    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'tags'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class PropertiesLocation(sqlglot.helper.AutoName):
510class PropertiesLocation(AutoName):
511    POST_CREATE = auto()
512    POST_NAME = auto()
513    POST_SCHEMA = auto()
514    POST_WITH = auto()
515    POST_ALIAS = auto()
516    POST_EXPRESSION = auto()
517    POST_INDEX = auto()
518    UNSUPPORTED = auto()

An enumeration.

POST_CREATE = <PropertiesLocation.POST_CREATE: 'POST_CREATE'>
POST_NAME = <PropertiesLocation.POST_NAME: 'POST_NAME'>
POST_SCHEMA = <PropertiesLocation.POST_SCHEMA: 'POST_SCHEMA'>
POST_WITH = <PropertiesLocation.POST_WITH: 'POST_WITH'>
POST_ALIAS = <PropertiesLocation.POST_ALIAS: 'POST_ALIAS'>
POST_EXPRESSION = <PropertiesLocation.POST_EXPRESSION: 'POST_EXPRESSION'>
POST_INDEX = <PropertiesLocation.POST_INDEX: 'POST_INDEX'>
UNSUPPORTED = <PropertiesLocation.UNSUPPORTED: 'UNSUPPORTED'>
class TransformModelProperty(Property):
521class TransformModelProperty(Property):
522    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'transformmodelproperty'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class TransientProperty(Property):
525class TransientProperty(Property):
526    arg_types = {"this": False}
arg_types = {'this': False}
key: ClassVar[str] = 'transientproperty'
required_args: 't.ClassVar[set[str]]' = set()
class UnloggedProperty(Property):
529class UnloggedProperty(Property):
530    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'unloggedproperty'
required_args: 't.ClassVar[set[str]]' = set()
class UsingTemplateProperty(Property):
533class UsingTemplateProperty(Property):
534    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'usingtemplateproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ViewAttributeProperty(Property):
537class ViewAttributeProperty(Property):
538    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'viewattributeproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class VolatileProperty(Property):
541class VolatileProperty(Property):
542    arg_types = {"this": False}
arg_types = {'this': False}
key: ClassVar[str] = 'volatileproperty'
required_args: 't.ClassVar[set[str]]' = set()
class WithDataProperty(Property):
545class WithDataProperty(Property):
546    arg_types = {"no": True, "statistics": False}
arg_types = {'no': True, 'statistics': False}
key: ClassVar[str] = 'withdataproperty'
required_args: 't.ClassVar[set[str]]' = {'no'}
class WithJournalTableProperty(Property):
549class WithJournalTableProperty(Property):
550    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'withjournaltableproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class WithSchemaBindingProperty(Property):
553class WithSchemaBindingProperty(Property):
554    arg_types = {"this": True}
arg_types = {'this': True}
key: ClassVar[str] = 'withschemabindingproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class WithSystemVersioningProperty(Property):
557class WithSystemVersioningProperty(Property):
558    arg_types = {
559        "on": False,
560        "this": False,
561        "data_consistency": False,
562        "retention_period": False,
563        "with_": True,
564    }
arg_types = {'on': False, 'this': False, 'data_consistency': False, 'retention_period': False, 'with_': True}
key: ClassVar[str] = 'withsystemversioningproperty'
required_args: 't.ClassVar[set[str]]' = {'with_'}
class WithProcedureOptions(Property):
567class WithProcedureOptions(Property):
568    arg_types = {"expressions": True}
arg_types = {'expressions': True}
key: ClassVar[str] = 'withprocedureoptions'
required_args: 't.ClassVar[set[str]]' = {'expressions'}
class EncodeProperty(Property):
571class EncodeProperty(Property):
572    arg_types = {"this": True, "properties": False, "key": False}
arg_types = {'this': True, 'properties': False, 'key': False}
key: ClassVar[str] = 'encodeproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class IncludeProperty(Property):
575class IncludeProperty(Property):
576    arg_types = {"this": True, "alias": False, "column_def": False}
arg_types = {'this': True, 'alias': False, 'column_def': False}
key: ClassVar[str] = 'includeproperty'
required_args: 't.ClassVar[set[str]]' = {'this'}
class ForceProperty(Property):
579class ForceProperty(Property):
580    arg_types = {}
arg_types = {}
key: ClassVar[str] = 'forceproperty'
required_args: 't.ClassVar[set[str]]' = set()
class Properties(sqlglot.expressions.core.Expression):
583class Properties(Expression):
584    arg_types = {"expressions": True}
585
586    NAME_TO_PROPERTY: t.ClassVar[dict[str, type[Property]]] = {
587        "ALGORITHM": AlgorithmProperty,
588        "AUTO_INCREMENT": AutoIncrementProperty,
589        "CHARACTER SET": CharacterSetProperty,
590        "CLUSTERED_BY": ClusteredByProperty,
591        "COLLATE": CollateProperty,
592        "COMMENT": SchemaCommentProperty,
593        "CREDENTIALS": CredentialsProperty,
594        "DEFINER": DefinerProperty,
595        "DISTKEY": DistKeyProperty,
596        "DISTRIBUTED_BY": DistributedByProperty,
597        "DISTSTYLE": DistStyleProperty,
598        "ENGINE": EngineProperty,
599        "EXECUTE AS": ExecuteAsProperty,
600        "FORMAT": FileFormatProperty,
601        "LANGUAGE": LanguageProperty,
602        "LOCATION": LocationProperty,
603        "LOCK": LockProperty,
604        "PARTITIONED_BY": PartitionedByProperty,
605        "RETURNS": ReturnsProperty,
606        "ROW_FORMAT": RowFormatProperty,
607        "SORTKEY": SortKeyProperty,
608        "ENCODE": EncodeProperty,
609        "INCLUDE": IncludeProperty,
610    }
611
612    PROPERTY_TO_NAME: t.ClassVar[dict[type[Property], str]] = {}
613
614    # CREATE property locations
615    # Form: schema specified
616    #   create [POST_CREATE]
617    #     table a [POST_NAME]
618    #     (b int) [POST_SCHEMA]
619    #     with ([POST_WITH])
620    #     index (b) [POST_INDEX]
621    #
622    # Form: alias selection
623    #   create [POST_CREATE]
624    #     table a [POST_NAME]
625    #     as [POST_ALIAS] (select * from b) [POST_EXPRESSION]
626    #     index (c) [POST_INDEX]
627    Location: t.ClassVar[type[PropertiesLocation]] = PropertiesLocation
628
629    @classmethod
630    def from_dict(cls, properties_dict: dict) -> Properties:
631        expressions = []
632        for key, value in properties_dict.items():
633            property_cls = cls.NAME_TO_PROPERTY.get(key.upper())
634            if property_cls:
635                expressions.append(property_cls(this=convert(value)))
636            else:
637                expressions.append(Property(this=Literal.string(key), value=convert(value)))
638
639        return cls(expressions=expressions)
arg_types = {'expressions': True}
NAME_TO_PROPERTY: ClassVar[dict[str, type[Property]]] = {'ALGORITHM': <class 'AlgorithmProperty'>, 'AUTO_INCREMENT': <class 'AutoIncrementProperty'>, 'CHARACTER SET': <class 'CharacterSetProperty'>, 'CLUSTERED_BY': <class 'ClusteredByProperty'>, 'COLLATE': <class 'CollateProperty'>, 'COMMENT': <class 'SchemaCommentProperty'>, 'CREDENTIALS': <class 'CredentialsProperty'>, 'DEFINER': <class 'DefinerProperty'>, 'DISTKEY': <class 'DistKeyProperty'>, 'DISTRIBUTED_BY': <class 'DistributedByProperty'>, 'DISTSTYLE': <class 'DistStyleProperty'>, 'ENGINE': <class 'EngineProperty'>, 'EXECUTE AS': <class 'ExecuteAsProperty'>, 'FORMAT': <class 'FileFormatProperty'>, 'LANGUAGE': <class 'LanguageProperty'>, 'LOCATION': <class 'LocationProperty'>, 'LOCK': <class 'LockProperty'>, 'PARTITIONED_BY': <class 'PartitionedByProperty'>, 'RETURNS': <class 'ReturnsProperty'>, 'ROW_FORMAT': <class 'RowFormatProperty'>, 'SORTKEY': <class 'SortKeyProperty'>, 'ENCODE': <class 'EncodeProperty'>, 'INCLUDE': <class 'IncludeProperty'>}
PROPERTY_TO_NAME: ClassVar[dict[type[Property], str]] = {<class 'AlgorithmProperty'>: 'ALGORITHM', <class 'AutoIncrementProperty'>: 'AUTO_INCREMENT', <class 'CharacterSetProperty'>: 'CHARACTER SET', <class 'ClusteredByProperty'>: 'CLUSTERED_BY', <class 'CollateProperty'>: 'COLLATE', <class 'SchemaCommentProperty'>: 'COMMENT', <class 'CredentialsProperty'>: 'CREDENTIALS', <class 'DefinerProperty'>: 'DEFINER', <class 'DistKeyProperty'>: 'DISTKEY', <class 'DistributedByProperty'>: 'DISTRIBUTED_BY', <class 'DistStyleProperty'>: 'DISTSTYLE', <class 'EngineProperty'>: 'ENGINE', <class 'ExecuteAsProperty'>: 'EXECUTE AS', <class 'FileFormatProperty'>: 'FORMAT', <class 'LanguageProperty'>: 'LANGUAGE', <class 'LocationProperty'>: 'LOCATION', <class 'LockProperty'>: 'LOCK', <class 'PartitionedByProperty'>: 'PARTITIONED_BY', <class 'ReturnsProperty'>: 'RETURNS', <class 'RowFormatProperty'>: 'ROW_FORMAT', <class 'SortKeyProperty'>: 'SORTKEY', <class 'EncodeProperty'>: 'ENCODE', <class 'IncludeProperty'>: 'INCLUDE'}
Location: ClassVar[type[PropertiesLocation]] = <enum 'PropertiesLocation'>
@classmethod
def from_dict(cls, properties_dict: dict) -> Properties:
629    @classmethod
630    def from_dict(cls, properties_dict: dict) -> Properties:
631        expressions = []
632        for key, value in properties_dict.items():
633            property_cls = cls.NAME_TO_PROPERTY.get(key.upper())
634            if property_cls:
635                expressions.append(property_cls(this=convert(value)))
636            else:
637                expressions.append(Property(this=Literal.string(key), value=convert(value)))
638
639        return cls(expressions=expressions)
key: ClassVar[str] = 'properties'
required_args: 't.ClassVar[set[str]]' = {'expressions'}