polyglot-sql 0.13.4__cp315-cp315-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2042 @@
1
+ from typing import Any as TypingAny, TypedDict, overload
2
+ from .analysis_types import (
3
+ AnalyzeQueryOptions as AnalyzeQueryOptions,
4
+ ValidationSchema as ValidationSchema,
5
+ SchemaTable as SchemaTable,
6
+ SchemaColumn as SchemaColumn,
7
+ SchemaColumnReference as SchemaColumnReference,
8
+ SchemaTableReference as SchemaTableReference,
9
+ SchemaForeignKey as SchemaForeignKey,
10
+ QueryAnalysis as QueryAnalysis,
11
+ QuerySourceSpan as QuerySourceSpan,
12
+ ProjectionFact as ProjectionFact,
13
+ TransformFunctionFact as TransformFunctionFact,
14
+ CteFact as CteFact,
15
+ RelationFact as RelationFact,
16
+ StarProjectionFact as StarProjectionFact,
17
+ SetOperationFact as SetOperationFact,
18
+ SetOperationBranchFact as SetOperationBranchFact,
19
+ ColumnUseFact as ColumnUseFact,
20
+ ColumnUseReferenceFact as ColumnUseReferenceFact,
21
+ ColumnReferenceFact as ColumnReferenceFact,
22
+ ReferenceConfidence as ReferenceConfidence,
23
+ ProjectionNullability as ProjectionNullability,
24
+ TransformKind as TransformKind,
25
+ ColumnUseContext as ColumnUseContext,
26
+ FunctionNameCase as FunctionNameCase,
27
+ FunctionSignature as FunctionSignature,
28
+ FunctionCatalogEntry as FunctionCatalogEntry,
29
+ FunctionCatalogSpec as FunctionCatalogSpec,
30
+ )
31
+
32
+
33
+ class ComplexityGuardOptions(TypedDict, total=False):
34
+ maxParserDepth: int | None
35
+ maxInputBytes: int | None
36
+ maxTokens: int | None
37
+ maxAstNodes: int | None
38
+ maxAstDepth: int | None
39
+ maxParenthesisDepth: int | None
40
+ maxFunctionCallDepth: int | None
41
+
42
+
43
+ class PolyglotError(Exception):
44
+ """Base exception for all polyglot-sql errors."""
45
+ ...
46
+
47
+ class ParseError(PolyglotError):
48
+ """Raised when SQL parsing fails."""
49
+ ...
50
+
51
+ class GenerateError(PolyglotError):
52
+ """Raised when SQL generation from an AST fails."""
53
+ ...
54
+
55
+ class TranspileError(PolyglotError):
56
+ """Raised when SQL transpilation fails."""
57
+ ...
58
+
59
+ class ValidationError(PolyglotError):
60
+ """Raised when SQL validation encounters a fatal error."""
61
+ ...
62
+
63
+ class ColumnResolutionError(TranspileError):
64
+ """Raised when a requested output name or zero-based ordinal cannot be resolved."""
65
+
66
+ reason: str
67
+ column: str | None
68
+ ordinal: int | None
69
+
70
+
71
+ class ValidationErrorInfo:
72
+ """Details about a single validation finding."""
73
+
74
+ @property
75
+ def message(self) -> str:
76
+ """Human-readable description of the issue."""
77
+ ...
78
+
79
+ @property
80
+ def line(self) -> int:
81
+ """1-based line number where the issue was found."""
82
+ ...
83
+
84
+ @property
85
+ def col(self) -> int:
86
+ """1-based column number where the issue was found."""
87
+ ...
88
+
89
+ @property
90
+ def start(self) -> int | None:
91
+ """Zero-based Unicode character offset, or None when unavailable."""
92
+ ...
93
+
94
+ @property
95
+ def end(self) -> int | None:
96
+ """Exclusive Unicode character offset, or None when unavailable."""
97
+ ...
98
+
99
+ @property
100
+ def code(self) -> str:
101
+ """Machine-readable error code (e.g. ``"E001"``)."""
102
+ ...
103
+
104
+ @property
105
+ def severity(self) -> str:
106
+ """Severity level: ``"error"`` or ``"warning"``."""
107
+ ...
108
+
109
+
110
+ class ValidationResult:
111
+ """Result returned by validate and validate_with_schema."""
112
+
113
+ @property
114
+ def valid(self) -> bool:
115
+ """True when no errors were found; warnings do not invalidate SQL."""
116
+ ...
117
+
118
+ @property
119
+ def errors(self) -> list[ValidationErrorInfo]:
120
+ """List of validation findings (may be empty when valid)."""
121
+ ...
122
+
123
+ def __bool__(self) -> bool:
124
+ """Allows ``if validate(...):`` usage."""
125
+ ...
126
+
127
+
128
+ class Expression:
129
+ """Base class for all AST nodes.
130
+
131
+ Every parsed SQL expression is represented as an ``Expression`` subclass
132
+ (e.g. ``Select``, ``Column``, ``Literal``). All subclasses share the
133
+ properties and methods defined here.
134
+
135
+ The API mirrors `sqlglot <https://github.com/tobymao/sqlglot>`_ so that
136
+ porting code between the two libraries is straightforward.
137
+
138
+ Example::
139
+
140
+ import polyglot_sql
141
+
142
+ ast = polyglot_sql.parse_one("SELECT a AS x, b FROM t WHERE c > 1")
143
+
144
+ # Property access
145
+ ast.expressions # [Column(a), Column(b)] (AS x is an Alias wrapping Column)
146
+ ast.find(polyglot_sql.Column).name # "a"
147
+
148
+ # Type dispatch
149
+ isinstance(ast, polyglot_sql.Select) # True
150
+
151
+ # Traversal
152
+ for node in ast.walk():
153
+ print(node.kind, node.name)
154
+ """
155
+
156
+ # ── Core identifiers ─────────────────────────────────────────────
157
+
158
+ @property
159
+ def kind(self) -> str:
160
+ """Snake-case variant name, e.g. ``"select"``, ``"column"``, ``"add"``.
161
+
162
+ Matches the key in :meth:`to_dict` output and corresponds to the
163
+ serde tag of the underlying Rust enum variant.
164
+ """
165
+ ...
166
+
167
+ @property
168
+ def key(self) -> str:
169
+ """Alias for :attr:`kind` (sqlglot compatibility)."""
170
+ ...
171
+
172
+ @property
173
+ def tree_depth(self) -> int:
174
+ """Maximum depth of the sub-tree rooted at this node (0 for leaves)."""
175
+ ...
176
+
177
+ # ── SQL generation ───────────────────────────────────────────────
178
+
179
+ def sql(self, dialect: str | None = None, *, pretty: bool = False) -> str:
180
+ """Generate a SQL string for this expression.
181
+
182
+ Args:
183
+ dialect: Target dialect (e.g. ``"postgres"``, ``"mysql"``).
184
+ Defaults to ``"generic"`` (dialect-agnostic SQL).
185
+ pretty: When ``True``, emit formatted SQL with indentation.
186
+
187
+ Returns:
188
+ The SQL string.
189
+
190
+ Raises:
191
+ GenerateError: If generation fails.
192
+ ValueError: If the dialect name is unknown.
193
+ """
194
+ ...
195
+
196
+ # ── SQLGlot-compatible builder subset ───────────────────────────
197
+
198
+ def eq(self, other: TypingAny) -> Expression: ...
199
+ def neq(self, other: TypingAny) -> Expression: ...
200
+ def lt(self, other: TypingAny) -> Expression: ...
201
+ def lte(self, other: TypingAny) -> Expression: ...
202
+ def gt(self, other: TypingAny) -> Expression: ...
203
+ def gte(self, other: TypingAny) -> Expression: ...
204
+ def and_(self, other: TypingAny) -> Expression: ...
205
+ def or_(self, other: TypingAny) -> Expression: ...
206
+ def xor(self, other: TypingAny) -> Expression: ...
207
+ def not_(self) -> Expression: ...
208
+ def is_(self, other: TypingAny) -> Expression: ...
209
+ def is_null(self) -> Expression: ...
210
+ def is_not_null(self) -> Expression: ...
211
+ def like(self, pattern: TypingAny) -> Expression: ...
212
+ def ilike(self, pattern: TypingAny) -> Expression: ...
213
+ def rlike(self, pattern: TypingAny) -> Expression: ...
214
+ def between(self, low: TypingAny, high: TypingAny) -> Expression: ...
215
+ def isin(self, *expressions: TypingAny) -> Expression: ...
216
+ def not_in(self, *expressions: TypingAny) -> Expression: ...
217
+ def as_(self, alias: str) -> Expression: ...
218
+ def cast(self, to: str) -> Expression: ...
219
+ def asc(self) -> Expression: ...
220
+ def desc(self) -> Expression: ...
221
+ def select(self, *expressions: TypingAny, append: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
222
+ def from_(self, expression: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
223
+ def join(self, expression: TypingAny, on: TypingAny = None, join_type: str = "", dialect: str | None = None, copy: bool = True) -> Expression: ...
224
+ def where(self, *expressions: TypingAny, append: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
225
+ def group_by(self, *expressions: TypingAny, append: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
226
+ def having(self, *expressions: TypingAny, append: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
227
+ def order_by(self, *expressions: TypingAny, append: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
228
+ def sort_by(self, *expressions: TypingAny, append: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
229
+ def limit(self, expression: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
230
+ def offset(self, expression: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
231
+ def distinct(self, distinct: bool = True, copy: bool = True) -> Expression: ...
232
+ def qualify(self, *expressions: TypingAny, append: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
233
+ def lateral_view(self, expression: TypingAny, table_alias: str | None = None, column_aliases: list[str] | None = None, outer: bool = False, dialect: str | None = None, copy: bool = True) -> Expression: ...
234
+ def window(self, name: str, partition_by: tuple[TypingAny, ...] | None = None, order_by: tuple[TypingAny, ...] | None = None, dialect: str | None = None, copy: bool = True) -> Expression: ...
235
+ def for_update(self, copy: bool = True) -> Expression: ...
236
+ def for_share(self, copy: bool = True) -> Expression: ...
237
+ def hint(self, text: str, copy: bool = True) -> Expression: ...
238
+ def ctas(self, table: str, replace: bool = False, temporary: bool = False, copy: bool = True) -> Expression: ...
239
+ def subquery(self, alias: str | None = None, copy: bool = True) -> Expression: ...
240
+ def union(self, expression: TypingAny, distinct: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
241
+ def intersect(self, expression: TypingAny, distinct: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
242
+ def except_(self, expression: TypingAny, distinct: bool = True, dialect: str | None = None, copy: bool = True) -> Expression: ...
243
+ def when(self, condition: TypingAny, result: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
244
+ def else_(self, result: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
245
+ def set_(self, assignments: dict[str, TypingAny], copy: bool = True) -> Expression: ...
246
+ def columns(self, columns: list[str], copy: bool = True) -> Expression: ...
247
+ def values(self, *values: TypingAny, copy: bool = True) -> Expression: ...
248
+ def query(self, query: TypingAny, copy: bool = True) -> Expression: ...
249
+ def merge_using(self, source: TypingAny, on: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
250
+ def when_matched_update(self, assignments: dict[str, TypingAny], condition: TypingAny = None, dialect: str | None = None, copy: bool = True) -> Expression: ...
251
+ def when_matched_delete(self, condition: TypingAny = None, dialect: str | None = None, copy: bool = True) -> Expression: ...
252
+ def when_not_matched_insert(self, columns: list[str], values: tuple[TypingAny, ...], condition: TypingAny = None, dialect: str | None = None, copy: bool = True) -> Expression: ...
253
+ def __add__(self, other: TypingAny) -> Expression: ...
254
+ def __sub__(self, other: TypingAny) -> Expression: ...
255
+ def __mul__(self, other: TypingAny) -> Expression: ...
256
+ def __truediv__(self, other: TypingAny) -> Expression: ...
257
+ def __mod__(self, other: TypingAny) -> Expression: ...
258
+ def __and__(self, other: TypingAny) -> Expression: ...
259
+ def __or__(self, other: TypingAny) -> Expression: ...
260
+ def __xor__(self, other: TypingAny) -> Expression: ...
261
+ def __invert__(self) -> Expression: ...
262
+ def __neg__(self) -> Expression: ...
263
+
264
+ # ── Serialization ────────────────────────────────────────────────
265
+
266
+ def to_dict(self) -> dict[str, TypingAny]:
267
+ """Serialize this node to a nested Python dict (JSON-like).
268
+
269
+ The top-level key is the :attr:`kind` string and the value is a dict
270
+ of the node's fields.
271
+
272
+ Example::
273
+
274
+ polyglot_sql.parse_one("SELECT 1").to_dict()
275
+ # {"select": {"expressions": [{"literal": {"value": "1", ...}}], ...}}
276
+ """
277
+ ...
278
+
279
+ def arg(self, name: str) -> TypingAny:
280
+ """Look up a single field by name from the serialized payload.
281
+
282
+ Returns a Python object: child ``Expression`` objects are wrapped
283
+ automatically; scalars are returned as ``str`` / ``int`` / ``bool``;
284
+ missing keys return ``None``.
285
+ """
286
+ ...
287
+
288
+ # ── Child accessors (no serialization, fast) ─────────────────────
289
+
290
+ @property
291
+ def this(self) -> Expression | None:
292
+ """Primary child expression.
293
+
294
+ For unary operators and functions this is the operand.
295
+ For binary operators this is the *left* operand.
296
+ For ``Alias`` this is the aliased expression.
297
+ For clauses (``Where``, ``Having``, ...) this is the predicate.
298
+
299
+ Returns ``None`` for leaf nodes and types without a primary child
300
+ (e.g. ``Select``, ``Identifier``, ``Literal``).
301
+ """
302
+ ...
303
+
304
+ @property
305
+ def expression(self) -> Expression | None:
306
+ """Secondary child expression.
307
+
308
+ For binary operators this is the *right* operand.
309
+ For ``BinaryFunc`` types (``Power``, ``NullIf``, ...) this is the
310
+ second argument.
311
+
312
+ Returns ``None`` for most other node types.
313
+ """
314
+ ...
315
+
316
+ @property
317
+ def expressions(self) -> list[Expression]:
318
+ """List of child expressions.
319
+
320
+ - ``Select.expressions`` — the selected columns
321
+ - ``Function.expressions`` / ``AggregateFunction.expressions`` — arguments
322
+ - ``From.expressions`` — tables in the FROM clause
323
+ - ``In.expressions`` — values in an IN list
324
+ - ``Array`` / ``Tuple`` / ``Coalesce`` / ``Greatest`` / ``Least`` — elements
325
+
326
+ Returns an empty list for node types without a list child.
327
+ """
328
+ ...
329
+
330
+ @property
331
+ def args(self) -> dict[str, TypingAny]:
332
+ """All fields as a dict (uses serialization, not on the hot path).
333
+
334
+ Keys are field names, values are Python objects.
335
+ """
336
+ ...
337
+
338
+ @property
339
+ def name(self) -> str:
340
+ """Short name of this expression.
341
+
342
+ - ``Column`` → column name (e.g. ``"id"``)
343
+ - ``Table`` → table name (e.g. ``"users"``)
344
+ - ``Identifier`` → identifier text
345
+ - ``Literal`` → literal value as string (e.g. ``"42"``)
346
+ - ``Function`` / ``AggregateFunction`` → function name
347
+ - ``Star`` → ``"*"``
348
+ - ``Alias`` → delegates to the aliased expression's name
349
+ - ``Boolean`` → ``"TRUE"`` / ``"FALSE"``
350
+ - ``Null`` → ``"NULL"``
351
+
352
+ Returns ``""`` for types without a meaningful name.
353
+ """
354
+ ...
355
+
356
+ @property
357
+ def alias(self) -> str:
358
+ """Alias name, if this expression has one.
359
+
360
+ - ``Alias`` → the alias identifier (e.g. ``"x"`` in ``a AS x``)
361
+ - ``Table`` → table alias if present
362
+ - ``Subquery`` → subquery alias if present
363
+
364
+ Returns ``""`` otherwise.
365
+ """
366
+ ...
367
+
368
+ @property
369
+ def alias_or_name(self) -> str:
370
+ """Returns :attr:`alias` if non-empty, else :attr:`name`."""
371
+ ...
372
+
373
+ @property
374
+ def output_name(self) -> str:
375
+ """The name this expression produces in a result set.
376
+
377
+ - ``Alias`` → the alias identifier
378
+ - ``Column`` → the column name
379
+ - ``Literal`` → the literal value
380
+ - ``Star`` → ``"*"``
381
+
382
+ Returns ``""`` for types without an output name.
383
+ """
384
+ ...
385
+
386
+ @property
387
+ def comments(self) -> list[str]:
388
+ """SQL comments attached to this node (trailing or leading)."""
389
+ ...
390
+
391
+ @property
392
+ def type_(self) -> Expression | None:
393
+ """Inferred data type (a ``DataType`` expression), or ``None``."""
394
+ ...
395
+
396
+ # ── Type predicates ──────────────────────────────────────────────
397
+
398
+ @property
399
+ def is_string(self) -> bool:
400
+ """``True`` if this is a string literal."""
401
+ ...
402
+
403
+ @property
404
+ def is_number(self) -> bool:
405
+ """``True`` if this is a numeric literal (or negated numeric literal)."""
406
+ ...
407
+
408
+ @property
409
+ def is_int(self) -> bool:
410
+ """``True`` if this is an integer literal (or negated integer literal)."""
411
+ ...
412
+
413
+ @property
414
+ def is_star(self) -> bool:
415
+ """``True`` if this is a ``*`` (star / wildcard) expression."""
416
+ ...
417
+
418
+ def is_leaf(self) -> bool:
419
+ """``True`` if this node has no children."""
420
+ ...
421
+
422
+ # ── Parent tracking ──────────────────────────────────────────────
423
+
424
+ @property
425
+ def parent(self) -> Expression | None:
426
+ """The parent node, or ``None`` for root nodes.
427
+
428
+ Parent references are set lazily when accessing children via
429
+ :attr:`this`, :attr:`expression`, :attr:`expressions`,
430
+ or :meth:`children`.
431
+ """
432
+ ...
433
+
434
+ @property
435
+ def depth(self) -> int:
436
+ """Number of parent hops to the root (0 for root nodes)."""
437
+ ...
438
+
439
+ def root(self) -> Expression:
440
+ """Walk the parent chain and return the root node."""
441
+ ...
442
+
443
+ def find_ancestor(self, *types: type[Expression] | str) -> Expression | None:
444
+ """Walk the parent chain and return the first ancestor matching any of *types*.
445
+
446
+ Args:
447
+ *types: One or more ``Expression`` subclasses or snake-case kind strings.
448
+
449
+ Returns:
450
+ The matching ancestor, or ``None``.
451
+ """
452
+ ...
453
+
454
+ @property
455
+ def parent_select(self) -> Expression | None:
456
+ """Shorthand for ``find_ancestor(Select)``."""
457
+ ...
458
+
459
+ # ── Traversal ────────────────────────────────────────────────────
460
+
461
+ def children(self) -> list[Expression]:
462
+ """Immediate child expressions (with parent references set)."""
463
+ ...
464
+
465
+ def walk(self, order: str = "dfs") -> list[Expression]:
466
+ """Traverse the entire sub-tree.
467
+
468
+ Args:
469
+ order: ``"dfs"`` (depth-first, default) or ``"bfs"`` (breadth-first).
470
+
471
+ Returns:
472
+ All nodes including ``self``.
473
+
474
+ Raises:
475
+ ValueError: If *order* is not ``"dfs"`` or ``"bfs"``.
476
+ """
477
+ ...
478
+
479
+ def find(self, *types: type[Expression] | str) -> Expression | None:
480
+ """Find the first descendant matching any of *types* (DFS, skips self).
481
+
482
+ Args:
483
+ *types: One or more ``Expression`` subclasses (e.g. ``Column``)
484
+ or snake-case kind strings (e.g. ``"column"``).
485
+
486
+ Returns:
487
+ The first matching descendant, or ``None``.
488
+
489
+ Example::
490
+
491
+ ast = polyglot_sql.parse_one("SELECT a, 1 FROM t")
492
+ ast.find(polyglot_sql.Column) # Column(a)
493
+ ast.find("literal") # Literal(1)
494
+ ast.find(polyglot_sql.Column, polyglot_sql.Literal) # Column(a) — first match
495
+ """
496
+ ...
497
+
498
+ def find_all(self, *types: type[Expression] | str) -> list[Expression]:
499
+ """Find all descendants matching any of *types* (DFS, skips self).
500
+
501
+ Same argument format as :meth:`find`.
502
+ """
503
+ ...
504
+
505
+ def unnest(self) -> Expression:
506
+ """Recursively unwrap ``Paren`` wrappers. Returns self if not a ``Paren``."""
507
+ ...
508
+
509
+ def unalias(self) -> Expression:
510
+ """Unwrap one ``Alias`` layer. Returns self if not an ``Alias``."""
511
+ ...
512
+
513
+ def flatten(self) -> list[Expression]:
514
+ """Flatten same-variant chains into a list.
515
+
516
+ For example, ``And(And(a, b), c)`` flattens to ``[a, b, c]``.
517
+ Useful for normalizing chained ``AND`` / ``OR`` predicates.
518
+ """
519
+ ...
520
+
521
+ def iter_expressions(self) -> list[Expression]:
522
+ """Alias for :meth:`children` (sqlglot compatibility)."""
523
+ ...
524
+
525
+ def text(self, key: str) -> str:
526
+ """Extract a field as a plain string.
527
+
528
+ Looks up *key* in the serialized payload and returns:
529
+ - Strings and numbers directly
530
+ - Nested expressions via their :attr:`name`
531
+ - Nested structs (e.g. ``Identifier``) via their ``name`` field
532
+ - ``""`` for missing keys
533
+ """
534
+ ...
535
+
536
+
537
+ # Expression subclasses — one per AST variant.
538
+ # All inherit from Expression and share its methods.
539
+ class Abs(Expression): ...
540
+ class Add(Expression): ...
541
+ class AddMonths(Expression): ...
542
+ class AddPartition(Expression): ...
543
+ class Adjacent(Expression): ...
544
+ class AggregateFunction(Expression): ...
545
+ class AIAgg(Expression): ...
546
+ class AIClassify(Expression): ...
547
+ class AlgorithmProperty(Expression): ...
548
+ class Alias(Expression): ...
549
+ class Aliases(Expression): ...
550
+ class All(Expression): ...
551
+ class AllowedValuesProperty(Expression): ...
552
+ class AlterColumn(Expression): ...
553
+ class AlterIndex(Expression): ...
554
+ class AlterSequence(Expression): ...
555
+ class AlterSession(Expression): ...
556
+ class AlterSet(Expression): ...
557
+ class AlterSortKey(Expression): ...
558
+ class AlterTable(Expression): ...
559
+ class AlterView(Expression): ...
560
+ class Analyze(Expression): ...
561
+ class AnalyzeDelete(Expression): ...
562
+ class AnalyzeHistogram(Expression): ...
563
+ class AnalyzeListChainedRows(Expression): ...
564
+ class AnalyzeSample(Expression): ...
565
+ class AnalyzeStatistics(Expression): ...
566
+ class AnalyzeValidate(Expression): ...
567
+ class AnalyzeWith(Expression): ...
568
+ class And(Expression): ...
569
+ class Annotated(Expression): ...
570
+ class Anonymous(Expression): ...
571
+ class AnonymousAggFunc(Expression): ...
572
+ class Any(Expression): ...
573
+ class AnyValue(Expression): ...
574
+ class Apply(Expression): ...
575
+ class ApproxCountDistinct(Expression): ...
576
+ class ApproxDistinct(Expression): ...
577
+ class ApproxPercentile(Expression): ...
578
+ class ApproxPercentileEstimate(Expression): ...
579
+ class ApproxQuantile(Expression): ...
580
+ class ApproxQuantiles(Expression): ...
581
+ class ApproxTopK(Expression): ...
582
+ class ApproxTopKAccumulate(Expression): ...
583
+ class ApproxTopKCombine(Expression): ...
584
+ class ApproxTopKEstimate(Expression): ...
585
+ class ApproxTopSum(Expression): ...
586
+ class ArgMax(Expression): ...
587
+ class ArgMin(Expression): ...
588
+ class Array(Expression): ...
589
+ class ArrayAgg(Expression): ...
590
+ class ArrayAll(Expression): ...
591
+ class ArrayAny(Expression): ...
592
+ class ArrayAppend(Expression): ...
593
+ class ArrayCompact(Expression): ...
594
+ class ArrayConcat(Expression): ...
595
+ class ArrayConcatAgg(Expression): ...
596
+ class ArrayConstructCompact(Expression): ...
597
+ class ArrayContainedBy(Expression): ...
598
+ class ArrayContains(Expression): ...
599
+ class ArrayContainsAll(Expression): ...
600
+ class ArrayDistinct(Expression): ...
601
+ class ArrayExcept(Expression): ...
602
+ class ArrayFilter(Expression): ...
603
+ class ArrayFlatten(Expression): ...
604
+ class ArrayFunc(Expression): ...
605
+ class ArrayIntersect(Expression): ...
606
+ class ArrayJoin(Expression): ...
607
+ class ArrayLength(Expression): ...
608
+ class ArrayOverlaps(Expression): ...
609
+ class ArrayPosition(Expression): ...
610
+ class ArrayPrepend(Expression): ...
611
+ class ArrayRemove(Expression): ...
612
+ class ArrayReverse(Expression): ...
613
+ class ArraySize(Expression): ...
614
+ class ArraySlice(Expression): ...
615
+ class ArraySort(Expression): ...
616
+ class ArraySum(Expression): ...
617
+ class ArrayToString(Expression): ...
618
+ class ArrayTransform(Expression): ...
619
+ class ArrayUnion(Expression): ...
620
+ class ArrayUniqueAgg(Expression): ...
621
+ class ArrayZip(Expression): ...
622
+ class Ascii(Expression): ...
623
+ class Asin(Expression): ...
624
+ class Acos(Expression): ...
625
+ class AssumeColumnConstraint(Expression): ...
626
+ class Atan(Expression): ...
627
+ class Atan2(Expression): ...
628
+ class AtIndex(Expression): ...
629
+ class AtTimeZone(Expression): ...
630
+ class Attach(Expression): ...
631
+ class AttachOption(Expression): ...
632
+ class AutoIncrementColumnConstraint(Expression): ...
633
+ class AutoIncrementProperty(Expression): ...
634
+ class AutoRefreshProperty(Expression): ...
635
+ class Avg(Expression): ...
636
+ class BackupProperty(Expression): ...
637
+ class Base64DecodeBinary(Expression): ...
638
+ class Base64DecodeString(Expression): ...
639
+ class Base64Encode(Expression): ...
640
+ class Between(Expression): ...
641
+ class BitwiseAnd(Expression): ...
642
+ class BitwiseAndAgg(Expression): ...
643
+ class BitwiseCount(Expression): ...
644
+ class BitwiseLeftShift(Expression): ...
645
+ class BitwiseNot(Expression): ...
646
+ class BitwiseOr(Expression): ...
647
+ class BitwiseOrAgg(Expression): ...
648
+ class BitwiseRightShift(Expression): ...
649
+ class BitwiseXor(Expression): ...
650
+ class BitwiseXorAgg(Expression): ...
651
+ class BlockCompressionProperty(Expression): ...
652
+ class BoolXorAgg(Expression): ...
653
+ class Boolean(Expression): ...
654
+ class Booland(Expression): ...
655
+ class Boolor(Expression): ...
656
+ class BracedWildcard(Expression): ...
657
+ class BuildProperty(Expression): ...
658
+ class ByteLength(Expression): ...
659
+ class ByteString(Expression): ...
660
+ class Cache(Expression): ...
661
+ class Cardinality(Expression): ...
662
+ class Case(Expression): ...
663
+ class CaseSpecificColumnConstraint(Expression): ...
664
+ class Cast(Expression): ...
665
+ class CastToStrType(Expression): ...
666
+ class Cbrt(Expression): ...
667
+ class Ceil(Expression): ...
668
+ class Changes(Expression): ...
669
+ class CharFunc(Expression): ...
670
+ class CharacterSetColumnConstraint(Expression): ...
671
+ class CharacterSetProperty(Expression): ...
672
+ class CheckColumnConstraint(Expression): ...
673
+ class CheckJson(Expression): ...
674
+ class CheckXml(Expression): ...
675
+ class ChecksumProperty(Expression): ...
676
+ class Chr(Expression): ...
677
+ class Clone(Expression): ...
678
+ class ClusterBy(Expression): ...
679
+ class ClusterByColumnsProperty(Expression): ...
680
+ class ClusteredByProperty(Expression): ...
681
+ class Coalesce(Expression): ...
682
+ class Collation(Expression): ...
683
+ class CollateProperty(Expression): ...
684
+ class Column(Expression): ...
685
+ class ColumnConstraint(Expression): ...
686
+ class ColumnDef(Expression): ...
687
+ class ColumnPosition(Expression): ...
688
+ class ColumnPrefix(Expression): ...
689
+ class Columns(Expression): ...
690
+ class CombinedAggFunc(Expression): ...
691
+ class CombinedParameterizedAgg(Expression): ...
692
+ class Command(Expression): ...
693
+ class Comment(Expression): ...
694
+ class CommentColumnConstraint(Expression): ...
695
+ class Commit(Expression): ...
696
+ class Comprehension(Expression): ...
697
+ class Compress(Expression): ...
698
+ class CompressColumnConstraint(Expression): ...
699
+ class ComputedColumnConstraint(Expression): ...
700
+ class Concat(Expression): ...
701
+ class ConcatWs(Expression): ...
702
+ class ConditionalInsert(Expression): ...
703
+ class Connect(Expression): ...
704
+ class ConnectByRoot(Expression): ...
705
+ class Constraint(Expression): ...
706
+ class Contains(Expression): ...
707
+ class Convert(Expression): ...
708
+ class ConvertTimezone(Expression): ...
709
+ class ConvertToCharset(Expression): ...
710
+ class Copy(Expression): ...
711
+ class CopyParameter(Expression): ...
712
+ class Corr(Expression): ...
713
+ class Cos(Expression): ...
714
+ class CosineDistance(Expression): ...
715
+ class Count(Expression): ...
716
+ class CountIf(Expression): ...
717
+ class CovarPop(Expression): ...
718
+ class CovarSamp(Expression): ...
719
+ class CreateDatabase(Expression): ...
720
+ class CreateFunction(Expression): ...
721
+ class CreateIndex(Expression): ...
722
+ class CreateProcedure(Expression): ...
723
+ class CreateSchema(Expression): ...
724
+ class CreateSequence(Expression): ...
725
+ class CreateTable(Expression): ...
726
+ class CreateTrigger(Expression): ...
727
+ class CreateType(Expression): ...
728
+ class CreateView(Expression): ...
729
+ class FlashbackTable(Expression): ...
730
+ class Credentials(Expression): ...
731
+ class CredentialsProperty(Expression): ...
732
+ class Cte(Expression): ...
733
+ class Cube(Expression): ...
734
+ class CumeDist(Expression): ...
735
+ class CurrentDate(Expression): ...
736
+ class CurrentDatetime(Expression): ...
737
+ class CurrentSchema(Expression): ...
738
+ class CurrentSchemas(Expression): ...
739
+ class CurrentTime(Expression): ...
740
+ class CurrentTimestamp(Expression): ...
741
+ class CurrentTimestampLTZ(Expression): ...
742
+ class CurrentUser(Expression): ...
743
+ class DPipe(Expression): ...
744
+ class DataBlocksizeProperty(Expression): ...
745
+ class DataDeletionProperty(Expression): ...
746
+ class DataType(Expression): ...
747
+ class Date(Expression): ...
748
+ class DateAdd(Expression): ...
749
+ class DateBin(Expression): ...
750
+ class DateDiff(Expression): ...
751
+ class DateFormat(Expression): ...
752
+ class DateFormatColumnConstraint(Expression): ...
753
+ class DateFromParts(Expression): ...
754
+ class DateFromUnixDate(Expression): ...
755
+ class DateStrToDate(Expression): ...
756
+ class DateSub(Expression): ...
757
+ class DateToDateStr(Expression): ...
758
+ class DateToDi(Expression): ...
759
+ class DateTrunc(Expression): ...
760
+ class Datetime(Expression): ...
761
+ class DatetimeAdd(Expression): ...
762
+ class DatetimeDiff(Expression): ...
763
+ class DatetimeSub(Expression): ...
764
+ class DatetimeTrunc(Expression): ...
765
+ class Day(Expression): ...
766
+ class DayOfMonth(Expression): ...
767
+ class DayOfWeek(Expression): ...
768
+ class DayOfWeekIso(Expression): ...
769
+ class DayOfYear(Expression): ...
770
+ class Dayname(Expression): ...
771
+ class Declare(Expression): ...
772
+ class DeclareItem(Expression): ...
773
+ class Decode(Expression): ...
774
+ class DecodeCase(Expression): ...
775
+ class DecompressBinary(Expression): ...
776
+ class DecompressString(Expression): ...
777
+ class Decrypt(Expression): ...
778
+ class DecryptRaw(Expression): ...
779
+ class DefaultColumnConstraint(Expression): ...
780
+ class DefinerProperty(Expression): ...
781
+ class Degrees(Expression): ...
782
+ class Delete(Expression): ...
783
+ class DenseRank(Expression): ...
784
+ class Describe(Expression): ...
785
+ class Detach(Expression): ...
786
+ class DictProperty(Expression): ...
787
+ class DictRange(Expression): ...
788
+ class DiToDate(Expression): ...
789
+ class Directory(Expression): ...
790
+ class DistKeyProperty(Expression): ...
791
+ class DistStyleProperty(Expression): ...
792
+ class DistributeBy(Expression): ...
793
+ class DistributedByProperty(Expression): ...
794
+ class Div(Expression): ...
795
+ class Dot(Expression): ...
796
+ class DotProduct(Expression): ...
797
+ class DropDatabase(Expression): ...
798
+ class DropFunction(Expression): ...
799
+ class DropIndex(Expression): ...
800
+ class DropNamespace(Expression): ...
801
+ class DropPartition(Expression): ...
802
+ class DropProcedure(Expression): ...
803
+ class DropSchema(Expression): ...
804
+ class DropSequence(Expression): ...
805
+ class DropTable(Expression): ...
806
+ class DropTrigger(Expression): ...
807
+ class DropType(Expression): ...
808
+ class DropView(Expression): ...
809
+ class DuplicateKeyProperty(Expression): ...
810
+ class ElementAt(Expression): ...
811
+ class Elt(Expression): ...
812
+ class Encode(Expression): ...
813
+ class EncodeProperty(Expression): ...
814
+ class Encrypt(Expression): ...
815
+ class EncryptRaw(Expression): ...
816
+ class EndsWith(Expression): ...
817
+ class EngineProperty(Expression): ...
818
+ class EnviromentProperty(Expression): ...
819
+ class Epoch(Expression): ...
820
+ class EpochMs(Expression): ...
821
+ class Eq(Expression): ...
822
+ class EqualNull(Expression): ...
823
+ class EuclideanDistance(Expression): ...
824
+ class Except(Expression): ...
825
+ class Execute(Expression): ...
826
+ class ExecuteAsProperty(Expression): ...
827
+ class Exists(Expression): ...
828
+ class Exp(Expression): ...
829
+ class Explode(Expression): ...
830
+ class ExplodeOuter(Expression): ...
831
+ class ExplodingGenerateSeries(Expression): ...
832
+ class Export(Expression): ...
833
+ class ExtendsLeft(Expression): ...
834
+ class ExtendsRight(Expression): ...
835
+ class ExternalProperty(Expression): ...
836
+ class Extract(Expression): ...
837
+ class FallbackProperty(Expression): ...
838
+ class FarmFingerprint(Expression): ...
839
+ class FeaturesAtTime(Expression): ...
840
+ class Fetch(Expression): ...
841
+ class FileFormatProperty(Expression): ...
842
+ class Filter(Expression): ...
843
+ class First(Expression): ...
844
+ class FirstValue(Expression): ...
845
+ class Float64(Expression): ...
846
+ class Floor(Expression): ...
847
+ class ForIn(Expression): ...
848
+ class ForeignKey(Expression): ...
849
+ class Format(Expression): ...
850
+ class FormatDate(Expression): ...
851
+ class FormatPhrase(Expression): ...
852
+ class FreespaceProperty(Expression): ...
853
+ class From(Expression): ...
854
+ class FromBase(Expression): ...
855
+ class FromTimeZone(Expression): ...
856
+ class FromUnixtime(Expression): ...
857
+ class Function(Expression): ...
858
+ class Upsert(Expression): ...
859
+ class StorageProperty(Expression): ...
860
+ class Hierarchy(Expression): ...
861
+ class ViewParameter(Expression): ...
862
+ class Call(Expression): ...
863
+ class FunctionEmits(Expression): ...
864
+ class GapFill(Expression): ...
865
+ class Generate(Expression): ...
866
+ class GenerateDateArray(Expression): ...
867
+ class GenerateEmbedding(Expression): ...
868
+ class GenerateSeries(Expression): ...
869
+ class GenerateTimestampArray(Expression): ...
870
+ class GeneratedAsIdentityColumnConstraint(Expression): ...
871
+ class GeneratedAsRowColumnConstraint(Expression): ...
872
+ class Get(Expression): ...
873
+ class Getbit(Expression): ...
874
+ class GetExtract(Expression): ...
875
+ class Glob(Expression): ...
876
+ class Grant(Expression): ...
877
+ class GrantPrincipal(Expression): ...
878
+ class GrantPrivilege(Expression): ...
879
+ class Greatest(Expression): ...
880
+ class Group(Expression): ...
881
+ class GroupBy(Expression): ...
882
+ class GroupConcat(Expression): ...
883
+ class Grouping(Expression): ...
884
+ class GroupingId(Expression): ...
885
+ class GroupingSets(Expression): ...
886
+ class Gt(Expression): ...
887
+ class Gte(Expression): ...
888
+ class HashAgg(Expression): ...
889
+ class Having(Expression): ...
890
+ class HavingMax(Expression): ...
891
+ class Heredoc(Expression): ...
892
+ class Hex(Expression): ...
893
+ class HexEncode(Expression): ...
894
+ class HexStringExpr(Expression): ...
895
+ class Hint(Expression): ...
896
+ class HistoricalData(Expression): ...
897
+ class Hll(Expression): ...
898
+ class Hour(Expression): ...
899
+ class ILike(Expression): ...
900
+ class IfFunc(Expression): ...
901
+ class IfNull(Expression): ...
902
+ class Identifier(Expression): ...
903
+ class In(Expression): ...
904
+ class IncludeProperty(Expression): ...
905
+ class Index(Expression): ...
906
+ class IndexColumnConstraint(Expression): ...
907
+ class IndexConstraintOption(Expression): ...
908
+ class IndexParameters(Expression): ...
909
+ class IndexTableHint(Expression): ...
910
+ class Initcap(Expression): ...
911
+ class InOutColumnConstraint(Expression): ...
912
+ class InputModelProperty(Expression): ...
913
+ class InputOutputFormat(Expression): ...
914
+ class InheritsProperty(Expression): ...
915
+ class Insert(Expression): ...
916
+ class Install(Expression): ...
917
+ class Int64(Expression): ...
918
+ class IntDiv(Expression): ...
919
+ class Intersect(Expression): ...
920
+ class Interval(Expression): ...
921
+ class IntervalOp(Expression): ...
922
+ class IntervalSpan(Expression): ...
923
+ class IntoClause(Expression): ...
924
+ class Introducer(Expression): ...
925
+ class Is(Expression): ...
926
+ class IsFalse(Expression): ...
927
+ class IsInf(Expression): ...
928
+ class IsJson(Expression): ...
929
+ class IsNan(Expression): ...
930
+ class IsNull(Expression): ...
931
+ class IsTrue(Expression): ...
932
+ class IsolatedLoadingProperty(Expression): ...
933
+ class JSON(Expression): ...
934
+ class JSONArray(Expression): ...
935
+ class JSONArrayAgg(Expression): ...
936
+ class JSONArrayAppend(Expression): ...
937
+ class JSONArrayContains(Expression): ...
938
+ class JSONArrayInsert(Expression): ...
939
+ class JSONBContains(Expression): ...
940
+ class JSONBContainsAllTopKeys(Expression): ...
941
+ class JSONBContainsAnyTopKeys(Expression): ...
942
+ class JSONBDeleteAtPath(Expression): ...
943
+ class JSONBExists(Expression): ...
944
+ class JSONBExtract(Expression): ...
945
+ class JSONBExtractScalar(Expression): ...
946
+ class JSONBObjectAgg(Expression): ...
947
+ class JSONBool(Expression): ...
948
+ class JSONCast(Expression): ...
949
+ class JSONColumnDef(Expression): ...
950
+ class JSONExists(Expression): ...
951
+ class JSONExtract(Expression): ...
952
+ class JSONExtractArray(Expression): ...
953
+ class JSONExtractQuote(Expression): ...
954
+ class JSONExtractScalar(Expression): ...
955
+ class JSONFormat(Expression): ...
956
+ class JSONKeyValue(Expression): ...
957
+ class JSONKeys(Expression): ...
958
+ class JSONKeysAtDepth(Expression): ...
959
+ class JSONObject(Expression): ...
960
+ class JSONObjectAgg(Expression): ...
961
+ class JSONPath(Expression): ...
962
+ class JSONPathFilter(Expression): ...
963
+ class JSONPathKey(Expression): ...
964
+ class JSONPathRecursive(Expression): ...
965
+ class JSONPathRoot(Expression): ...
966
+ class JSONPathScript(Expression): ...
967
+ class JSONPathSelector(Expression): ...
968
+ class JSONPathSlice(Expression): ...
969
+ class JSONPathSubscript(Expression): ...
970
+ class JSONPathUnion(Expression): ...
971
+ class JSONRemove(Expression): ...
972
+ class JSONSchema(Expression): ...
973
+ class JSONSet(Expression): ...
974
+ class JSONStripNulls(Expression): ...
975
+ class JSONTable(Expression): ...
976
+ class JSONType(Expression): ...
977
+ class JSONValue(Expression): ...
978
+ class JSONValueArray(Expression): ...
979
+ class JarowinklerSimilarity(Expression): ...
980
+ class Join(Expression): ...
981
+ class JoinHint(Expression): ...
982
+ class JoinedTable(Expression): ...
983
+ class JournalProperty(Expression): ...
984
+ class JsonArray(Expression): ...
985
+ class JsonArrayAgg(Expression): ...
986
+ class JsonArrayLength(Expression): ...
987
+ class JsonExtract(Expression): ...
988
+ class JsonExtractPath(Expression): ...
989
+ class JsonExtractScalar(Expression): ...
990
+ class JsonInsert(Expression): ...
991
+ class JsonKeys(Expression): ...
992
+ class JsonMergePatch(Expression): ...
993
+ class JsonObject(Expression): ...
994
+ class JsonObjectAgg(Expression): ...
995
+ class JsonQuery(Expression): ...
996
+ class JsonRemove(Expression): ...
997
+ class JsonSet(Expression): ...
998
+ class JsonType(Expression): ...
999
+ class JsonValue(Expression): ...
1000
+ class Kill(Expression): ...
1001
+ class Lag(Expression): ...
1002
+ class Lambda(Expression): ...
1003
+ class LanguageProperty(Expression): ...
1004
+ class Last(Expression): ...
1005
+ class LastDay(Expression): ...
1006
+ class LastValue(Expression): ...
1007
+ class Lateral(Expression): ...
1008
+ class LateralView(Expression): ...
1009
+ class Lead(Expression): ...
1010
+ class Least(Expression): ...
1011
+ class Left(Expression): ...
1012
+ class Length(Expression): ...
1013
+ class Levenshtein(Expression): ...
1014
+ class Like(Expression): ...
1015
+ class LikeProperty(Expression): ...
1016
+ class Limit(Expression): ...
1017
+ class LimitOptions(Expression): ...
1018
+ class List(Expression): ...
1019
+ class ListAgg(Expression): ...
1020
+ class Literal(Expression): ...
1021
+ class Ln(Expression): ...
1022
+ class LoadData(Expression): ...
1023
+ class Localtime(Expression): ...
1024
+ class Localtimestamp(Expression): ...
1025
+ class LocationProperty(Expression): ...
1026
+ class Lock(Expression): ...
1027
+ class LockProperty(Expression): ...
1028
+ class LockingProperty(Expression): ...
1029
+ class LockingStatement(Expression): ...
1030
+ class Log(Expression): ...
1031
+ class LogProperty(Expression): ...
1032
+ class LogicalAnd(Expression): ...
1033
+ class LogicalOr(Expression): ...
1034
+ class Lower(Expression): ...
1035
+ class LowerHex(Expression): ...
1036
+ class Lpad(Expression): ...
1037
+ class LTrim(Expression): ...
1038
+ class MLForecast(Expression): ...
1039
+ class MLTranslate(Expression): ...
1040
+ class MD5Digest(Expression): ...
1041
+ class MD5NumberLower64(Expression): ...
1042
+ class MD5NumberUpper64(Expression): ...
1043
+ class MakeDate(Expression): ...
1044
+ class MakeInterval(Expression): ...
1045
+ class MakeTimestamp(Expression): ...
1046
+ class ManhattanDistance(Expression): ...
1047
+ class Map(Expression): ...
1048
+ class MapCat(Expression): ...
1049
+ class MapConcat(Expression): ...
1050
+ class MapContainsKey(Expression): ...
1051
+ class MapDelete(Expression): ...
1052
+ class MapFromArrays(Expression): ...
1053
+ class MapFromEntries(Expression): ...
1054
+ class MapFunc(Expression): ...
1055
+ class MapInsert(Expression): ...
1056
+ class MapKeys(Expression): ...
1057
+ class MapPick(Expression): ...
1058
+ class MapValues(Expression): ...
1059
+ class MaskingPolicyColumnConstraint(Expression): ...
1060
+ class Match(Expression): ...
1061
+ class MatchAgainst(Expression): ...
1062
+ class MatchRecognize(Expression): ...
1063
+ class MatchRecognizeMeasure(Expression): ...
1064
+ class MaterializedProperty(Expression): ...
1065
+ class Max(Expression): ...
1066
+ class Median(Expression): ...
1067
+ class MemberOf(Expression): ...
1068
+ class Merge(Expression): ...
1069
+ class MergeBlockRatioProperty(Expression): ...
1070
+ class MergeTreeTTL(Expression): ...
1071
+ class MergeTreeTTLAction(Expression): ...
1072
+ class MethodCall(Expression): ...
1073
+ class Min(Expression): ...
1074
+ class Minhash(Expression): ...
1075
+ class Minute(Expression): ...
1076
+ class Mod(Expression): ...
1077
+ class ModFunc(Expression): ...
1078
+ class Mode(Expression): ...
1079
+ class ModelAttribute(Expression): ...
1080
+ class Month(Expression): ...
1081
+ class MonthsBetween(Expression): ...
1082
+ class Monthname(Expression): ...
1083
+ class Mul(Expression): ...
1084
+ class MultitableInserts(Expression): ...
1085
+ class NTile(Expression): ...
1086
+ class NamedArgument(Expression): ...
1087
+ class NamedStruct(Expression): ...
1088
+ class Neg(Expression): ...
1089
+ class Neq(Expression): ...
1090
+ class NextDay(Expression): ...
1091
+ class NextValueFor(Expression): ...
1092
+ class Normal(Expression): ...
1093
+ class Normalize(Expression): ...
1094
+ class Not(Expression): ...
1095
+ class NotNullColumnConstraint(Expression): ...
1096
+ class Ntile(Expression): ...
1097
+ class Null(Expression): ...
1098
+ class NullIf(Expression): ...
1099
+ class Nullif(Expression): ...
1100
+ class NullSafeEq(Expression): ...
1101
+ class NullSafeNeq(Expression): ...
1102
+ class NumberToStr(Expression): ...
1103
+ class Nvl(Expression): ...
1104
+ class Nvl2(Expression): ...
1105
+ class NthValue(Expression): ...
1106
+ class ObjectAgg(Expression): ...
1107
+ class ObjectIdentifier(Expression): ...
1108
+ class ObjectInsert(Expression): ...
1109
+ class Offset(Expression): ...
1110
+ class OnCluster(Expression): ...
1111
+ class OnCommitProperty(Expression): ...
1112
+ class OnCondition(Expression): ...
1113
+ class OnConflict(Expression): ...
1114
+ class OnProperty(Expression): ...
1115
+ class Opclass(Expression): ...
1116
+ class OpenJSON(Expression): ...
1117
+ class OpenJSONColumnDef(Expression): ...
1118
+ class Operator(Expression): ...
1119
+ class OptionsProperty(Expression): ...
1120
+ class Or(Expression): ...
1121
+ class Ordered(Expression): ...
1122
+ class OrderBy(Expression): ...
1123
+ class OutputModelProperty(Expression): ...
1124
+ class Over(Expression): ...
1125
+ class OverflowTruncateBehavior(Expression): ...
1126
+ class Overlaps(Expression): ...
1127
+ class Overlay(Expression): ...
1128
+ class Pad(Expression): ...
1129
+ class Parameter(Expression): ...
1130
+ class ParameterizedAgg(Expression): ...
1131
+ class Paren(Expression): ...
1132
+ class ParseDatetime(Expression): ...
1133
+ class ParseIp(Expression): ...
1134
+ class ParseJSON(Expression): ...
1135
+ class ParseJson(Expression): ...
1136
+ class ParseTime(Expression): ...
1137
+ class ParseUrl(Expression): ...
1138
+ class Partition(Expression): ...
1139
+ class PartitionBoundSpec(Expression): ...
1140
+ class PartitionByListProperty(Expression): ...
1141
+ class PartitionByProperty(Expression): ...
1142
+ class PartitionByRangeProperty(Expression): ...
1143
+ class PartitionByRangePropertyDynamic(Expression): ...
1144
+ class PartitionByTruncate(Expression): ...
1145
+ class PartitionList(Expression): ...
1146
+ class PartitionRange(Expression): ...
1147
+ class PartitionedByBucket(Expression): ...
1148
+ class PartitionedByProperty(Expression): ...
1149
+ class PartitionedOfProperty(Expression): ...
1150
+ class PathColumnConstraint(Expression): ...
1151
+ class Percentile(Expression): ...
1152
+ class PercentileCont(Expression): ...
1153
+ class PercentileDisc(Expression): ...
1154
+ class PercentRank(Expression): ...
1155
+ class PeriodForSystemTimeConstraint(Expression): ...
1156
+ class Pi(Expression): ...
1157
+ class PipeOperator(Expression): ...
1158
+ class Pivot(Expression): ...
1159
+ class PivotAlias(Expression): ...
1160
+ class PivotAny(Expression): ...
1161
+ class Placeholder(Expression): ...
1162
+ class Position(Expression): ...
1163
+ class Power(Expression): ...
1164
+ class Pragma(Expression): ...
1165
+ class Prepare(Expression): ...
1166
+ class PreWhere(Expression): ...
1167
+ class Predict(Expression): ...
1168
+ class PreviousDay(Expression): ...
1169
+ class PrimaryKey(Expression): ...
1170
+ class PrimaryKeyColumnConstraint(Expression): ...
1171
+ class Prior(Expression): ...
1172
+ class ProjectionDef(Expression): ...
1173
+ class Properties(Expression): ...
1174
+ class Property(Expression): ...
1175
+ class PropertyEQ(Expression): ...
1176
+ class Pseudocolumn(Expression): ...
1177
+ class PseudoType(Expression): ...
1178
+ class Put(Expression): ...
1179
+ class Qualify(Expression): ...
1180
+ class Quantile(Expression): ...
1181
+ class Quarter(Expression): ...
1182
+ class QueryBand(Expression): ...
1183
+ class QueryOption(Expression): ...
1184
+ class QueryTransform(Expression): ...
1185
+ class RTrim(Expression): ...
1186
+ class Radians(Expression): ...
1187
+ class Rand(Expression): ...
1188
+ class Random(Expression): ...
1189
+ class Randn(Expression): ...
1190
+ class Randstr(Expression): ...
1191
+ class RangeBucket(Expression): ...
1192
+ class RangeN(Expression): ...
1193
+ class Rank(Expression): ...
1194
+ class Raw(Expression): ...
1195
+ class ReadCSV(Expression): ...
1196
+ class ReadParquet(Expression): ...
1197
+ class RecursiveWithSearch(Expression): ...
1198
+ class Reduce(Expression): ...
1199
+ class Reference(Expression): ...
1200
+ class Refresh(Expression): ...
1201
+ class RefreshTriggerProperty(Expression): ...
1202
+ class RegexpCount(Expression): ...
1203
+ class RegexpExtract(Expression): ...
1204
+ class RegexpExtractAll(Expression): ...
1205
+ class RegexpFullMatch(Expression): ...
1206
+ class RegexpILike(Expression): ...
1207
+ class RegexpInstr(Expression): ...
1208
+ class RegexpLike(Expression): ...
1209
+ class RegexpReplace(Expression): ...
1210
+ class RegexpSplit(Expression): ...
1211
+ class RegrAvgx(Expression): ...
1212
+ class RegrAvgy(Expression): ...
1213
+ class RegrCount(Expression): ...
1214
+ class RegrIntercept(Expression): ...
1215
+ class RegrR2(Expression): ...
1216
+ class RegrSlope(Expression): ...
1217
+ class RegrSxx(Expression): ...
1218
+ class RegrSxy(Expression): ...
1219
+ class RegrSyy(Expression): ...
1220
+ class RegrValx(Expression): ...
1221
+ class RegrValy(Expression): ...
1222
+ class RemoteWithConnectionModelProperty(Expression): ...
1223
+ class RenameColumn(Expression): ...
1224
+ class Repeat(Expression): ...
1225
+ class Replace(Expression): ...
1226
+ class ReplacePartition(Expression): ...
1227
+ class ReturnStmt(Expression): ...
1228
+ class Returning(Expression): ...
1229
+ class ReturnsProperty(Expression): ...
1230
+ class Reverse(Expression): ...
1231
+ class Revoke(Expression): ...
1232
+ class Right(Expression): ...
1233
+ class Rollback(Expression): ...
1234
+ class Rollup(Expression): ...
1235
+ class RollupProperty(Expression): ...
1236
+ class Round(Expression): ...
1237
+ class RowFormatDelimitedProperty(Expression): ...
1238
+ class RowFormatProperty(Expression): ...
1239
+ class RowFormatSerdeProperty(Expression): ...
1240
+ class RowNumber(Expression): ...
1241
+ class RowsFrom(Expression): ...
1242
+ class Rpad(Expression): ...
1243
+ class SHA(Expression): ...
1244
+ class SHA1Digest(Expression): ...
1245
+ class SHA2(Expression): ...
1246
+ class SHA2Digest(Expression): ...
1247
+ class SafeAdd(Expression): ...
1248
+ class SafeCast(Expression): ...
1249
+ class SafeDivide(Expression): ...
1250
+ class SafeMultiply(Expression): ...
1251
+ class SafeSubtract(Expression): ...
1252
+ class SampleProperty(Expression): ...
1253
+ class Schema(Expression): ...
1254
+ class SchemaCommentProperty(Expression): ...
1255
+ class ScopeResolution(Expression): ...
1256
+ class Search(Expression): ...
1257
+ class SearchIp(Expression): ...
1258
+ class Second(Expression): ...
1259
+ class SecurityProperty(Expression): ...
1260
+ class Select(Expression): ...
1261
+ class SemanticView(Expression): ...
1262
+ class Sequence(Expression): ...
1263
+ class SequenceProperties(Expression): ...
1264
+ class SerdeProperties(Expression): ...
1265
+ class SessionParameter(Expression): ...
1266
+ class SessionUser(Expression): ...
1267
+ class Set(Expression): ...
1268
+ class SetConfigProperty(Expression): ...
1269
+ class SetItem(Expression): ...
1270
+ class SetOperation(Expression): ...
1271
+ class SetProperty(Expression): ...
1272
+ class SetStatement(Expression): ...
1273
+ class SettingsProperty(Expression): ...
1274
+ class SharingProperty(Expression): ...
1275
+ class Show(Expression): ...
1276
+ class Sign(Expression): ...
1277
+ class SimilarTo(Expression): ...
1278
+ class Sin(Expression): ...
1279
+ class Skewness(Expression): ...
1280
+ class Slice(Expression): ...
1281
+ class SortArray(Expression): ...
1282
+ class SortBy(Expression): ...
1283
+ class SortKeyProperty(Expression): ...
1284
+ class Soundex(Expression): ...
1285
+ class Split(Expression): ...
1286
+ class SplitPart(Expression): ...
1287
+ class SplitTable(Expression): ...
1288
+ class SqlComment(Expression): ...
1289
+ class SqlReadWriteProperty(Expression): ...
1290
+ class SqlSecurityProperty(Expression): ...
1291
+ class Sqrt(Expression): ...
1292
+ class StDistance(Expression): ...
1293
+ class StPoint(Expression): ...
1294
+ class StabilityProperty(Expression): ...
1295
+ class StageReference(Expression): ...
1296
+ class StandardHash(Expression): ...
1297
+ class Star(Expression): ...
1298
+ class StarMap(Expression): ...
1299
+ class StartsWith(Expression): ...
1300
+ class Stddev(Expression): ...
1301
+ class StddevPop(Expression): ...
1302
+ class StddevSamp(Expression): ...
1303
+ class StorageHandlerProperty(Expression): ...
1304
+ class StrPosition(Expression): ...
1305
+ class StrToDate(Expression): ...
1306
+ class StrToMap(Expression): ...
1307
+ class StrToTime(Expression): ...
1308
+ class StrToUnix(Expression): ...
1309
+ class Stream(Expression): ...
1310
+ class StringAgg(Expression): ...
1311
+ class StringFunc(Expression): ...
1312
+ class StringToArray(Expression): ...
1313
+ class Struct(Expression): ...
1314
+ class StructExtract(Expression): ...
1315
+ class StructFunc(Expression): ...
1316
+ class Stuff(Expression): ...
1317
+ class Sub(Expression): ...
1318
+ class Subquery(Expression): ...
1319
+ class Subscript(Expression): ...
1320
+ class Substring(Expression): ...
1321
+ class SubstringIndex(Expression): ...
1322
+ class Sum(Expression): ...
1323
+ class SumIf(Expression): ...
1324
+ class Summarize(Expression): ...
1325
+ class Systimestamp(Expression): ...
1326
+ class Table(Expression): ...
1327
+ class TableAlias(Expression): ...
1328
+ class TableArgument(Expression): ...
1329
+ class TableFromRows(Expression): ...
1330
+ class TableSample(Expression): ...
1331
+ class Tag(Expression): ...
1332
+ class Tags(Expression): ...
1333
+ class Tan(Expression): ...
1334
+ class TemporaryProperty(Expression): ...
1335
+ class Time(Expression): ...
1336
+ class TimeAdd(Expression): ...
1337
+ class TimeDiff(Expression): ...
1338
+ class TimeFromParts(Expression): ...
1339
+ class TimeSlice(Expression): ...
1340
+ class TimeStrToDate(Expression): ...
1341
+ class TimeStrToTime(Expression): ...
1342
+ class TimeStrToUnix(Expression): ...
1343
+ class TimeSub(Expression): ...
1344
+ class TimeToStr(Expression): ...
1345
+ class TimeToUnix(Expression): ...
1346
+ class TimeTrunc(Expression): ...
1347
+ class TimeUnit(Expression): ...
1348
+ class Timestamp(Expression): ...
1349
+ class TimestampAdd(Expression): ...
1350
+ class TimestampDiff(Expression): ...
1351
+ class TimestampFromParts(Expression): ...
1352
+ class TimestampSub(Expression): ...
1353
+ class TimestampTrunc(Expression): ...
1354
+ class TimestampTzFromParts(Expression): ...
1355
+ class ToArray(Expression): ...
1356
+ class ToBoolean(Expression): ...
1357
+ class ToBinary(Expression): ...
1358
+ class ToChar(Expression): ...
1359
+ class ToDate(Expression): ...
1360
+ class ToDecfloat(Expression): ...
1361
+ class ToDouble(Expression): ...
1362
+ class ToFile(Expression): ...
1363
+ class ToJson(Expression): ...
1364
+ class ToMap(Expression): ...
1365
+ class ToNumber(Expression): ...
1366
+ class ToTableProperty(Expression): ...
1367
+ class ToTimestamp(Expression): ...
1368
+ class Transaction(Expression): ...
1369
+ class Transform(Expression): ...
1370
+ class TransformKeys(Expression): ...
1371
+ class TransformModelProperty(Expression): ...
1372
+ class TransformValues(Expression): ...
1373
+ class TransientProperty(Expression): ...
1374
+ class Translate(Expression): ...
1375
+ class TranslateCharacters(Expression): ...
1376
+ class Trim(Expression): ...
1377
+ class Truncate(Expression): ...
1378
+ class TruncFunc(Expression): ...
1379
+ class TruncateTable(Expression): ...
1380
+ class TryCast(Expression): ...
1381
+ class TryCatch(Expression): ...
1382
+ class TryBase64DecodeBinary(Expression): ...
1383
+ class TryBase64DecodeString(Expression): ...
1384
+ class TryToDecfloat(Expression): ...
1385
+ class TsMatch(Expression): ...
1386
+ class TsOrDiToDi(Expression): ...
1387
+ class TsOrDsAdd(Expression): ...
1388
+ class TsOrDsDiff(Expression): ...
1389
+ class TsOrDsToDate(Expression): ...
1390
+ class TsOrDsToDatetime(Expression): ...
1391
+ class TsOrDsToTime(Expression): ...
1392
+ class TsOrDsToTimestamp(Expression): ...
1393
+ class Tuple(Expression): ...
1394
+ class Typeof(Expression): ...
1395
+ class Uncache(Expression): ...
1396
+ class Unhex(Expression): ...
1397
+ class Unicode(Expression): ...
1398
+ class UnicodeString(Expression): ...
1399
+ class Uniform(Expression): ...
1400
+ class Union(Expression): ...
1401
+ class UniqueColumnConstraint(Expression): ...
1402
+ class UniqueKeyProperty(Expression): ...
1403
+ class UnixDate(Expression): ...
1404
+ class UnixMicros(Expression): ...
1405
+ class UnixMillis(Expression): ...
1406
+ class UnixSeconds(Expression): ...
1407
+ class UnixTimestamp(Expression): ...
1408
+ class UnixToStr(Expression): ...
1409
+ class UnixToTime(Expression): ...
1410
+ class UnixToTimeStr(Expression): ...
1411
+ class Unnest(Expression): ...
1412
+ class Unpivot(Expression): ...
1413
+ class UnpivotColumns(Expression): ...
1414
+ class Update(Expression): ...
1415
+ class Upper(Expression): ...
1416
+ class Use(Expression): ...
1417
+ class UserDefinedFunction(Expression): ...
1418
+ class UsingData(Expression): ...
1419
+ class UsingTemplateProperty(Expression): ...
1420
+ class UtcTime(Expression): ...
1421
+ class UtcTimestamp(Expression): ...
1422
+ class Uuid(Expression): ...
1423
+ class Values(Expression): ...
1424
+ class Var(Expression): ...
1425
+ class VarMap(Expression): ...
1426
+ class VarPop(Expression): ...
1427
+ class VarSamp(Expression): ...
1428
+ class Variadic(Expression): ...
1429
+ class Variance(Expression): ...
1430
+ class VectorSearch(Expression): ...
1431
+ class Version(Expression): ...
1432
+ class Vertica(Expression): ...
1433
+ class ViewAttributeProperty(Expression): ...
1434
+ class VolatileProperty(Expression): ...
1435
+ class WatermarkColumnConstraint(Expression): ...
1436
+ class Week(Expression): ...
1437
+ class When(Expression): ...
1438
+ class Whens(Expression): ...
1439
+ class Where(Expression): ...
1440
+ class WidthBucket(Expression): ...
1441
+ class Window(Expression): ...
1442
+ class WindowFunction(Expression): ...
1443
+ class WindowSpec(Expression): ...
1444
+ class With(Expression): ...
1445
+ class WithDataProperty(Expression): ...
1446
+ class WithFill(Expression): ...
1447
+ class WithJournalTableProperty(Expression): ...
1448
+ class WithOperator(Expression): ...
1449
+ class WithProcedureOptions(Expression): ...
1450
+ class WithSchemaBindingProperty(Expression): ...
1451
+ class WithSystemVersioningProperty(Expression): ...
1452
+ class WithTableHint(Expression): ...
1453
+ class WithinGroup(Expression): ...
1454
+ class XMLElement(Expression): ...
1455
+ class XMLGet(Expression): ...
1456
+ class XMLKeyValueOption(Expression): ...
1457
+ class XMLTable(Expression): ...
1458
+ class XmlNamespace(Expression): ...
1459
+ class Xor(Expression): ...
1460
+ class Year(Expression): ...
1461
+ class YearOfWeek(Expression): ...
1462
+ class YearOfWeekIso(Expression): ...
1463
+ class Zipf(Expression): ...
1464
+
1465
+
1466
+ def transpile(
1467
+ sql: str,
1468
+ read: str | None = None,
1469
+ write: str | None = None,
1470
+ *,
1471
+ identity: bool = True,
1472
+ error_level: str | None = None,
1473
+ unsupported_level: str | None = None,
1474
+ pretty: bool = False,
1475
+ max_unsupported: int | None = None,
1476
+ complexity_guard: ComplexityGuardOptions | None = None,
1477
+ ) -> list[str]:
1478
+ """Transpile SQL from one dialect to another.
1479
+
1480
+ Args:
1481
+ sql: One or more SQL statements separated by semicolons.
1482
+ read: Source dialect (e.g. ``"mysql"``). Defaults to ``"generic"``.
1483
+ write: Target dialect (e.g. ``"postgres"``). Defaults to ``"generic"``.
1484
+ identity: Keep SQL unchanged when read == write. Defaults to ``True``.
1485
+ error_level: Error handling: ``"raise"`` (default), ``"warn"``, or ``"ignore"``.
1486
+ pretty: Emit formatted SQL with indentation.
1487
+
1488
+ Returns:
1489
+ A list of transpiled SQL strings (one per statement).
1490
+
1491
+ Raises:
1492
+ TranspileError: If transpilation fails.
1493
+ ValueError: If a dialect name is unknown.
1494
+ """
1495
+ ...
1496
+
1497
+
1498
+ def parse(
1499
+ sql: str,
1500
+ read: str | None = None,
1501
+ dialect: str | None = None,
1502
+ *,
1503
+ error_level: str | None = None,
1504
+ complexity_guard: ComplexityGuardOptions | None = None,
1505
+ ) -> list[Expression]:
1506
+ """Parse SQL into a list of ``Expression`` AST nodes.
1507
+
1508
+ Args:
1509
+ sql: One or more SQL statements separated by semicolons.
1510
+ read: Source dialect. Alias for *dialect*.
1511
+ dialect: Source dialect (e.g. ``"postgres"``). Defaults to ``"generic"``.
1512
+ error_level: ``"raise"`` (default), ``"warn"``, or ``"ignore"``.
1513
+
1514
+ Returns:
1515
+ A list of typed ``Expression`` objects (e.g. ``Select``, ``Insert``).
1516
+
1517
+ Raises:
1518
+ ParseError: If parsing fails and *error_level* is ``"raise"``.
1519
+ ValueError: If the dialect name is unknown.
1520
+ """
1521
+ ...
1522
+
1523
+
1524
+ @overload
1525
+ def parse_one(
1526
+ sql: str,
1527
+ read: str | None = None,
1528
+ dialect: str | None = None,
1529
+ *,
1530
+ into: type[DataType],
1531
+ error_level: str | None = None,
1532
+ complexity_guard: ComplexityGuardOptions | None = None,
1533
+ ) -> DataType:
1534
+ ...
1535
+
1536
+ @overload
1537
+ def parse_one(
1538
+ sql: str,
1539
+ read: str | None = None,
1540
+ dialect: str | None = None,
1541
+ *,
1542
+ into: None = None,
1543
+ error_level: str | None = None,
1544
+ complexity_guard: ComplexityGuardOptions | None = None,
1545
+ ) -> Expression:
1546
+ ...
1547
+
1548
+ def parse_one(
1549
+ sql: str,
1550
+ read: str | None = None,
1551
+ dialect: str | None = None,
1552
+ *,
1553
+ into: type[DataType] | None = None,
1554
+ error_level: str | None = None,
1555
+ complexity_guard: ComplexityGuardOptions | None = None,
1556
+ ) -> Expression | DataType:
1557
+ """Parse a single SQL statement into an ``Expression`` AST node.
1558
+
1559
+ Args:
1560
+ sql: Exactly one SQL statement.
1561
+ read: Source dialect. Alias for *dialect*.
1562
+ dialect: Source dialect (e.g. ``"postgres"``). Defaults to ``"generic"``.
1563
+ into: Set to ``polyglot_sql.DataType`` to parse a standalone data type.
1564
+ error_level: ``"raise"`` (default), ``"warn"``, or ``"ignore"``.
1565
+
1566
+ Returns:
1567
+ A typed ``Expression`` object (e.g. ``Select``) or ``DataType`` when
1568
+ ``into=polyglot_sql.DataType`` is used.
1569
+
1570
+ Raises:
1571
+ ParseError: If the input contains zero or multiple statements.
1572
+ ValueError: If the dialect name is unknown.
1573
+ """
1574
+ ...
1575
+
1576
+
1577
+ def parse_data_type(
1578
+ sql: str,
1579
+ read: str | None = None,
1580
+ dialect: str | None = None,
1581
+ *,
1582
+ error_level: str | None = None,
1583
+ complexity_guard: ComplexityGuardOptions | None = None,
1584
+ ) -> DataType:
1585
+ """Parse a standalone SQL data type string.
1586
+
1587
+ Args:
1588
+ sql: A data type string such as ``"DECIMAL(10, 2)"``.
1589
+ read: Source dialect. Alias for *dialect*.
1590
+ dialect: Source dialect (e.g. ``"duckdb"``). Defaults to ``"generic"``.
1591
+ error_level: ``"raise"`` (default), ``"warn"``, or ``"ignore"``.
1592
+
1593
+ Returns:
1594
+ A typed ``DataType`` expression that can be rendered with ``.sql()``.
1595
+ """
1596
+ ...
1597
+
1598
+
1599
+ def generate(
1600
+ ast: Expression | dict[str, TypingAny] | list[Expression] | list[dict[str, TypingAny]],
1601
+ dialect: str = "generic",
1602
+ *,
1603
+ pretty: bool = False,
1604
+ ) -> list[str]:
1605
+ """Generate SQL strings from AST nodes.
1606
+
1607
+ Accepts a single ``Expression``, a list of ``Expression`` objects, or
1608
+ their ``dict`` equivalents (as returned by :meth:`Expression.to_dict`).
1609
+
1610
+ Args:
1611
+ ast: One or more AST nodes.
1612
+ dialect: Target dialect. Defaults to ``"generic"``.
1613
+ pretty: Emit formatted SQL with indentation.
1614
+
1615
+ Returns:
1616
+ A list of SQL strings (one per input AST).
1617
+
1618
+ Raises:
1619
+ GenerateError: If generation fails.
1620
+ ValueError: If the dialect name is unknown.
1621
+ """
1622
+ ...
1623
+
1624
+
1625
+ def qualify_tables(
1626
+ ast: Expression | dict[str, TypingAny] | list[Expression] | list[dict[str, TypingAny]],
1627
+ *,
1628
+ db: str | None = None,
1629
+ catalog: str | None = None,
1630
+ dialect: str | None = None,
1631
+ canonicalize_table_aliases: bool = False,
1632
+ alias_unaliased_tables: bool = True,
1633
+ alias_unaliased_subqueries: bool = True,
1634
+ alias_prefix: str = "_",
1635
+ normalize_set_operation_subqueries: bool = True,
1636
+ ) -> Expression | list[Expression]:
1637
+ """Qualify table references in an AST.
1638
+
1639
+ The returned shape matches the input shape: a single AST returns a single
1640
+ ``Expression`` and a list input returns a list.
1641
+ """
1642
+ ...
1643
+
1644
+
1645
+ def set_limit(
1646
+ ast: Expression | dict[str, TypingAny] | list[Expression] | list[dict[str, TypingAny]],
1647
+ limit: int,
1648
+ ) -> Expression | list[Expression]:
1649
+ """Set LIMIT on a SELECT or set operation AST.
1650
+
1651
+ The returned shape matches the input shape: a single AST returns a single
1652
+ ``Expression`` and a list input returns a list.
1653
+ """
1654
+ ...
1655
+
1656
+
1657
+ def set_offset(
1658
+ ast: Expression | dict[str, TypingAny] | list[Expression] | list[dict[str, TypingAny]],
1659
+ offset: int,
1660
+ ) -> Expression | list[Expression]:
1661
+ """Set OFFSET on a SELECT or set operation AST.
1662
+
1663
+ The returned shape matches the input shape: a single AST returns a single
1664
+ ``Expression`` and a list input returns a list.
1665
+ """
1666
+ ...
1667
+
1668
+
1669
+ def set_order_by(
1670
+ ast: Expression | dict[str, TypingAny] | list[Expression] | list[dict[str, TypingAny]],
1671
+ order_by: Expression | dict[str, TypingAny] | list[Expression] | list[dict[str, TypingAny]],
1672
+ ) -> Expression | list[Expression]:
1673
+ """Set ORDER BY on a SELECT or set operation AST.
1674
+
1675
+ Bare expressions are normalized to ascending order entries. The returned
1676
+ shape matches the input shape.
1677
+ """
1678
+ ...
1679
+
1680
+
1681
+ def rename_tables(
1682
+ ast: Expression | dict[str, TypingAny] | list[Expression] | list[dict[str, TypingAny]],
1683
+ mapping: dict[str, str],
1684
+ *,
1685
+ alias_renamed_tables: bool = False,
1686
+ preserve_existing_aliases: bool = True,
1687
+ ) -> Expression | list[Expression]:
1688
+ """Rename table references in an AST.
1689
+
1690
+ The returned shape matches the input shape: a single AST returns a single
1691
+ ``Expression`` and a list input returns a list.
1692
+ """
1693
+ ...
1694
+
1695
+
1696
+ def format_sql(
1697
+ sql: str,
1698
+ dialect: str = "generic",
1699
+ *,
1700
+ max_input_bytes: int | None = None,
1701
+ max_tokens: int | None = None,
1702
+ max_ast_nodes: int | None = None,
1703
+ max_set_op_chain: int | None = None,
1704
+ ) -> str:
1705
+ """Parse and pretty-print SQL (identity transpile with formatting).
1706
+
1707
+ Args:
1708
+ sql: A single SQL statement.
1709
+ dialect: Dialect for parsing and generation. Defaults to ``"generic"``.
1710
+ max_input_bytes: Override the input size limit (bytes).
1711
+ max_tokens: Override the token count limit.
1712
+ max_ast_nodes: Override the AST node count limit.
1713
+ max_set_op_chain: Override the ``UNION``/``INTERSECT``/``EXCEPT`` chain limit.
1714
+
1715
+ Returns:
1716
+ Formatted SQL string.
1717
+
1718
+ Raises:
1719
+ ParseError: If parsing fails or a guard limit is exceeded.
1720
+ ValueError: If the dialect name is unknown.
1721
+ """
1722
+ ...
1723
+
1724
+
1725
+ def validate(
1726
+ sql: str,
1727
+ dialect: str = "generic",
1728
+ *,
1729
+ strict_syntax: bool = False,
1730
+ semantic: bool = False,
1731
+ complexity_guard: ComplexityGuardOptions | None = None,
1732
+ ) -> ValidationResult:
1733
+ """Validate SQL syntax and optional semantic correctness/quality checks.
1734
+
1735
+ Does **not** raise on invalid SQL — check ``result.valid`` or
1736
+ ``bool(result)`` instead.
1737
+
1738
+ Args:
1739
+ sql: SQL to validate.
1740
+ dialect: Dialect for parsing. Defaults to ``"generic"``.
1741
+ strict_syntax: Reject permissive forms such as trailing commas.
1742
+ semantic: Report correctness errors E230-E232 and quality warnings W001-W004.
1743
+
1744
+ Raises:
1745
+ ValueError: If the dialect name is unknown.
1746
+ """
1747
+ ...
1748
+
1749
+
1750
+ def validate_with_schema(
1751
+ sql: str,
1752
+ schema: ValidationSchema | dict[str, TypingAny],
1753
+ dialect: str = "generic",
1754
+ *,
1755
+ check_types: bool = False,
1756
+ check_references: bool = False,
1757
+ strict: bool | None = None,
1758
+ semantic: bool = False,
1759
+ strict_syntax: bool = False,
1760
+ complexity_guard: ComplexityGuardOptions | None = None,
1761
+ function_catalog: FunctionCatalogSpec | dict[str, TypingAny] | None = None,
1762
+ ) -> ValidationResult:
1763
+ """Validate SQL against a shared ValidationSchema dictionary using Rust.
1764
+
1765
+ Unknown tables, columns and aliases are checked by default. check_types
1766
+ enables type checks; check_references enables ambiguity and foreign-key
1767
+ checks. strict overrides schema['strict'], which otherwise defaults to
1768
+ True. Non-strict reference/type findings are warnings. Empty column lists
1769
+ and '*' columns represent open schemas, not known-empty tables.
1770
+
1771
+ semantic and strict_syntax behave as in validate. Syntax errors take
1772
+ precedence. Invalid SQL returns findings; invalid schemas or dialect names
1773
+ raise ValueError. Options are snake_case keyword arguments, not a dictionary.
1774
+
1775
+ function_catalog replaces the embedded name/arity catalog for check_types;
1776
+ it does not enable checks by itself. Unknown nested input keys are rejected.
1777
+ Proven semantic errors remain errors even with strict=False.
1778
+ """
1779
+ ...
1780
+
1781
+
1782
+ def optimize(sql: str, dialect: str | None = None, *, read: str | None = None) -> str:
1783
+ """Apply basic SQL optimizations (predicate simplification, etc.).
1784
+
1785
+ Args:
1786
+ sql: SQL to optimize.
1787
+ dialect: Dialect for parsing and generation. Defaults to ``"generic"``.
1788
+ read: Alias for *dialect*.
1789
+
1790
+ Returns:
1791
+ Optimized SQL string.
1792
+
1793
+ Raises:
1794
+ ParseError: If parsing fails.
1795
+ ValueError: If the dialect name is unknown.
1796
+ """
1797
+ ...
1798
+
1799
+
1800
+ def lineage(column: str, sql: str, dialect: str = "generic") -> dict[str, TypingAny]:
1801
+ """Trace column lineage through a SQL query.
1802
+
1803
+ Args:
1804
+ column: Target column name to trace.
1805
+ sql: SQL query.
1806
+ dialect: Dialect for parsing. Defaults to ``"generic"``.
1807
+
1808
+ Returns:
1809
+ A dict describing the lineage graph.
1810
+ """
1811
+ ...
1812
+
1813
+ def lineage_with_schema(
1814
+ column: str,
1815
+ sql: str,
1816
+ schema: dict[str, TypingAny],
1817
+ dialect: str = "generic",
1818
+ ) -> dict[str, TypingAny]:
1819
+ """Trace column lineage with an explicit schema for disambiguation.
1820
+
1821
+ Args:
1822
+ column: Target column name to trace.
1823
+ sql: SQL query.
1824
+ schema: Schema dict mapping ``table_name`` to ``{column: type}`` dicts.
1825
+ dialect: Dialect for parsing. Defaults to ``"generic"``.
1826
+
1827
+ Returns:
1828
+ A dict describing the lineage graph.
1829
+ """
1830
+ ...
1831
+
1832
+ def lineage_at(
1833
+ ordinal: int,
1834
+ sql: str,
1835
+ dialect: str = "generic",
1836
+ ) -> dict[str, TypingAny]:
1837
+ """Trace lineage for a zero-based output ordinal."""
1838
+ ...
1839
+
1840
+ def lineage_at_with_schema(
1841
+ ordinal: int,
1842
+ sql: str,
1843
+ schema: dict[str, TypingAny],
1844
+ dialect: str = "generic",
1845
+ ) -> dict[str, TypingAny]:
1846
+ """Trace schema-aware lineage for a zero-based output ordinal."""
1847
+ ...
1848
+
1849
+ def output_columns(
1850
+ sql: str,
1851
+ dialect: str = "generic",
1852
+ ) -> dict[str, TypingAny]:
1853
+ """Return the ordered query output description."""
1854
+ ...
1855
+
1856
+ def output_columns_with_schema(
1857
+ sql: str,
1858
+ schema: dict[str, TypingAny],
1859
+ dialect: str = "generic",
1860
+ ) -> dict[str, TypingAny]:
1861
+ """Return the ordered output description after schema-aware wildcard expansion."""
1862
+ ...
1863
+
1864
+
1865
+ def source_tables(column: str, sql: str, dialect: str = "generic") -> list[str]:
1866
+ """Return source table names that contribute to a column.
1867
+
1868
+ Args:
1869
+ column: Target column name.
1870
+ sql: SQL query.
1871
+ dialect: Dialect for parsing. Defaults to ``"generic"``.
1872
+
1873
+ Returns:
1874
+ A list of table name strings.
1875
+ """
1876
+ ...
1877
+
1878
+
1879
+ def analyze_query(
1880
+ sql: str,
1881
+ options: AnalyzeQueryOptions | dict[str, TypingAny] | None = None,
1882
+ dialect: str = "generic",
1883
+ *,
1884
+ complexity_guard: ComplexityGuardOptions | None = None,
1885
+ ) -> QueryAnalysis:
1886
+ """Return compact query analysis facts for a SELECT or set operation.
1887
+
1888
+ Options use camelCase keys and support ``dialect``, ``complexityGuard`` and optional
1889
+ ``schema`` in the same ValidationSchema shape accepted by schema-aware
1890
+ validation and lineage APIs. Schema columns use the ``type`` key for type
1891
+ strings; ``dataType`` and ``data_type`` are not accepted aliases.
1892
+
1893
+ Supply guard limits using either ``complexity_guard`` or the options entry,
1894
+ not both. Omitted limits use defaults; a field-level None disables one check.
1895
+
1896
+ The returned dict includes ``relations``, transitive ``baseTables``,
1897
+ top-level ``cteFacts``, original ``starProjections``, and projection
1898
+ ``nullability`` values of ``"non_null"``, ``"nullable"``, or ``"unknown"``.
1899
+ ``columnUses`` groups non-projection references by clause, with ``context``,
1900
+ ``scopePath``, ``expressionPath``, dialect-rendered ``expressionSql`` and
1901
+ ``references``. Optional ``span`` objects use half-open Unicode-character
1902
+ offsets into the original SQL. Reference spans locate uses, not definitions.
1903
+ """
1904
+ ...
1905
+
1906
+
1907
+ def openlineage_column_lineage(
1908
+ sql: str,
1909
+ options: dict[str, TypingAny],
1910
+ ) -> dict[str, TypingAny]:
1911
+ """Build an OpenLineage columnLineage facet and dataset payload.
1912
+
1913
+ The options dict uses the same camelCase keys as the JSON API, including
1914
+ ``producer``, ``datasetNamespace``, ``outputDataset``, and optional
1915
+ ``schema``. This function does not send events.
1916
+ """
1917
+ ...
1918
+
1919
+
1920
+ def openlineage_job_event(
1921
+ sql: str,
1922
+ options: dict[str, TypingAny],
1923
+ ) -> dict[str, TypingAny]:
1924
+ """Build an OpenLineage JobEvent payload without sending it."""
1925
+ ...
1926
+
1927
+
1928
+ def openlineage_run_event(
1929
+ sql: str,
1930
+ options: dict[str, TypingAny],
1931
+ ) -> dict[str, TypingAny]:
1932
+ """Build an OpenLineage RunEvent payload without sending it."""
1933
+ ...
1934
+
1935
+
1936
+ def diff(sql1: str, sql2: str, dialect: str = "generic") -> list[dict[str, TypingAny]]:
1937
+ """Compute a structural diff between two SQL statements.
1938
+
1939
+ Args:
1940
+ sql1: First SQL statement.
1941
+ sql2: Second SQL statement.
1942
+ dialect: Dialect for parsing. Defaults to ``"generic"``.
1943
+
1944
+ Returns:
1945
+ A list of diff entries (insertions, deletions, moves).
1946
+
1947
+ Raises:
1948
+ ValueError: If the dialect name is unknown.
1949
+ """
1950
+ ...
1951
+
1952
+
1953
+ def dialects() -> list[str]:
1954
+ """Return the list of supported dialect names.
1955
+
1956
+ Example::
1957
+
1958
+ polyglot_sql.dialects()
1959
+ # ["athena", "bigquery", "clickhouse", "databricks", "doris", ...]
1960
+ """
1961
+ ...
1962
+
1963
+
1964
+ def format(
1965
+ sql: str,
1966
+ dialect: str = "generic",
1967
+ *,
1968
+ max_input_bytes: int | None = None,
1969
+ max_tokens: int | None = None,
1970
+ max_ast_nodes: int | None = None,
1971
+ max_set_op_chain: int | None = None,
1972
+ ) -> str:
1973
+ """Alias for :func:`format_sql`."""
1974
+ ...
1975
+
1976
+
1977
+ # SQLGlot-compatible builder subset
1978
+ def select(*expressions: TypingAny, dialect: str | None = None, copy: bool = True) -> Select: ...
1979
+ def from_(expression: TypingAny, dialect: str | None = None, copy: bool = True) -> Select: ...
1980
+ def column(name: str, table: str | None = None) -> Column: ...
1981
+ def col(name: str, table: str | None = None) -> Column: ...
1982
+ def table_(name: str) -> Table: ...
1983
+ def convert(value: TypingAny, copy: bool = False) -> Expression: ...
1984
+ def lit(value: TypingAny) -> Expression: ...
1985
+ def condition(expression: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
1986
+ def and_(*expressions: TypingAny, dialect: str | None = None, copy: bool = True, wrap: bool = True) -> Expression: ...
1987
+ def or_(*expressions: TypingAny, dialect: str | None = None, copy: bool = True, wrap: bool = True) -> Expression: ...
1988
+ def not_(expression: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
1989
+ def alias_(expression: TypingAny, alias: str, dialect: str | None = None, copy: bool = True) -> Expression: ...
1990
+ def func(name: str, *args: TypingAny, dialect: str | None = None, copy: bool = True) -> Expression: ...
1991
+ def count(expression: TypingAny) -> Expression: ...
1992
+ def count_star() -> Expression: ...
1993
+ def count_distinct(expression: TypingAny) -> Expression: ...
1994
+ def sum_(expression: TypingAny) -> Expression: ...
1995
+ def avg(expression: TypingAny) -> Expression: ...
1996
+ def min_(expression: TypingAny) -> Expression: ...
1997
+ def max_(expression: TypingAny) -> Expression: ...
1998
+ def approx_distinct(expression: TypingAny) -> Expression: ...
1999
+ def upper(expression: TypingAny) -> Expression: ...
2000
+ def lower(expression: TypingAny) -> Expression: ...
2001
+ def length(expression: TypingAny) -> Expression: ...
2002
+ def trim(expression: TypingAny) -> Expression: ...
2003
+ def ltrim(expression: TypingAny) -> Expression: ...
2004
+ def rtrim(expression: TypingAny) -> Expression: ...
2005
+ def reverse(expression: TypingAny) -> Expression: ...
2006
+ def initcap(expression: TypingAny) -> Expression: ...
2007
+ def substring(expression: TypingAny, start: TypingAny, length: TypingAny = None) -> Expression: ...
2008
+ def replace_(expression: TypingAny, old: TypingAny, new: TypingAny) -> Expression: ...
2009
+ def concat_ws(separator: TypingAny, *expressions: TypingAny) -> Expression: ...
2010
+ def coalesce(*expressions: TypingAny) -> Expression: ...
2011
+ def null_if(left: TypingAny, right: TypingAny) -> Expression: ...
2012
+ def if_null(expression: TypingAny, fallback: TypingAny) -> Expression: ...
2013
+ def abs_(expression: TypingAny) -> Expression: ...
2014
+ def round_(expression: TypingAny, decimals: TypingAny = None) -> Expression: ...
2015
+ def floor(expression: TypingAny) -> Expression: ...
2016
+ def ceil(expression: TypingAny) -> Expression: ...
2017
+ def power(base: TypingAny, exponent: TypingAny) -> Expression: ...
2018
+ def sqrt(expression: TypingAny) -> Expression: ...
2019
+ def ln(expression: TypingAny) -> Expression: ...
2020
+ def exp(expression: TypingAny) -> Expression: ...
2021
+ def sign(expression: TypingAny) -> Expression: ...
2022
+ def greatest(*expressions: TypingAny) -> Expression: ...
2023
+ def least(*expressions: TypingAny) -> Expression: ...
2024
+ def current_date() -> Expression: ...
2025
+ def current_time() -> Expression: ...
2026
+ def current_timestamp() -> Expression: ...
2027
+ def extract(field: str, expression: TypingAny) -> Expression: ...
2028
+ def row_number() -> Expression: ...
2029
+ def rank() -> Expression: ...
2030
+ def dense_rank() -> Expression: ...
2031
+ def case(expression: TypingAny = None, dialect: str | None = None, copy: bool = True) -> Case: ...
2032
+ def update(table: str, properties: dict[str, TypingAny] | None = None, where: TypingAny = None, from_: str | None = None, dialect: str | None = None, copy: bool = True) -> Update: ...
2033
+ def delete(table: str, where: TypingAny = None, dialect: str | None = None, copy: bool = True) -> Delete: ...
2034
+ def insert(expression: TypingAny, into: str, columns: list[str] | None = None, dialect: str | None = None, copy: bool = True) -> Insert: ...
2035
+ def merge_into(target: str, dialect: str | None = None, copy: bool = True) -> Merge: ...
2036
+ def union(left: TypingAny, right: TypingAny, distinct: bool = True, dialect: str | None = None, copy: bool = True) -> Union: ...
2037
+ def intersect(left: TypingAny, right: TypingAny, distinct: bool = True, dialect: str | None = None, copy: bool = True) -> Intersect: ...
2038
+ def except_(left: TypingAny, right: TypingAny, distinct: bool = True, dialect: str | None = None, copy: bool = True) -> Except: ...
2039
+
2040
+
2041
+ __version__: str
2042
+ """Package version string (e.g. ``"0.1.15"``)."""