Expressions
Every AST node in SQLGlot is represented by a subclass of Expression.
This module contains the implementation of all supported Expression types. Additionally,
it exposes a number of helper functions, which are mainly used to programmatically build
SQL expressions, such as sqlglot.expressions.select.
1""" 2## Expressions 3 4Every AST node in SQLGlot is represented by a subclass of `Expression`. 5 6This module contains the implementation of all supported `Expression` types. Additionally, 7it exposes a number of helper functions, which are mainly used to programmatically build 8SQL expressions, such as `sqlglot.expressions.select`. 9 10---- 11""" 12 13from __future__ import annotations 14 15import datetime 16import math 17import numbers 18import re 19import sys 20import textwrap 21import typing as t 22from collections import deque 23from copy import deepcopy 24from decimal import Decimal 25from enum import auto 26from functools import reduce 27 28from sqlglot.errors import ErrorLevel, ParseError 29from sqlglot.helper import ( 30 AutoName, 31 camel_to_snake_case, 32 ensure_collection, 33 ensure_list, 34 seq_get, 35 split_num_words, 36 subclasses, 37 to_bool, 38) 39from sqlglot.tokens import Token, TokenError 40 41if t.TYPE_CHECKING: 42 from typing_extensions import Self 43 44 from sqlglot._typing import E, Lit 45 from sqlglot.dialects.dialect import DialectType 46 47 Q = t.TypeVar("Q", bound="Query") 48 S = t.TypeVar("S", bound="SetOperation") 49 50 51class _Expression(type): 52 def __new__(cls, clsname, bases, attrs): 53 klass = super().__new__(cls, clsname, bases, attrs) 54 55 # When an Expression class is created, its key is automatically set 56 # to be the lowercase version of the class' name. 57 klass.key = clsname.lower() 58 klass.required_args = {k for k, v in klass.arg_types.items() if v} 59 60 # This is so that docstrings are not inherited in pdoc 61 klass.__doc__ = klass.__doc__ or "" 62 63 return klass 64 65 66SQLGLOT_META = "sqlglot.meta" 67SQLGLOT_ANONYMOUS = "sqlglot.anonymous" 68TABLE_PARTS = ("this", "db", "catalog") 69COLUMN_PARTS = ("this", "table", "db", "catalog") 70POSITION_META_KEYS = ("line", "col", "start", "end") 71UNITTEST = "unittest" in sys.modules or "pytest" in sys.modules 72 73 74class Expression(metaclass=_Expression): 75 """ 76 The base class for all expressions in a syntax tree. Each Expression encapsulates any necessary 77 context, such as its child expressions, their names (arg keys), and whether a given child expression 78 is optional or not. 79 80 Attributes: 81 key: a unique key for each class in the Expression hierarchy. This is useful for hashing 82 and representing expressions as strings. 83 arg_types: determines the arguments (child nodes) supported by an expression. It maps 84 arg keys to booleans that indicate whether the corresponding args are optional. 85 parent: a reference to the parent expression (or None, in case of root expressions). 86 arg_key: the arg key an expression is associated with, i.e. the name its parent expression 87 uses to refer to it. 88 index: the index of an expression if it is inside of a list argument in its parent. 89 comments: a list of comments that are associated with a given expression. This is used in 90 order to preserve comments when transpiling SQL code. 91 type: the `sqlglot.expressions.DataType` type of an expression. This is inferred by the 92 optimizer, in order to enable some transformations that require type information. 93 meta: a dictionary that can be used to store useful metadata for a given expression. 94 95 Example: 96 >>> class Foo(Expression): 97 ... arg_types = {"this": True, "expression": False} 98 99 The above definition informs us that Foo is an Expression that requires an argument called 100 "this" and may also optionally receive an argument called "expression". 101 102 Args: 103 args: a mapping used for retrieving the arguments of an expression, given their arg keys. 104 """ 105 106 key = "expression" 107 arg_types = {"this": True} 108 required_args = {"this"} 109 __slots__ = ("args", "parent", "arg_key", "index", "comments", "_type", "_meta", "_hash") 110 111 def __init__(self, **args: t.Any): 112 self.args: t.Dict[str, t.Any] = args 113 self.parent: t.Optional[Expression] = None 114 self.arg_key: t.Optional[str] = None 115 self.index: t.Optional[int] = None 116 self.comments: t.Optional[t.List[str]] = None 117 self._type: t.Optional[DataType] = None 118 self._meta: t.Optional[t.Dict[str, t.Any]] = None 119 self._hash: t.Optional[int] = None 120 121 for arg_key, value in self.args.items(): 122 self._set_parent(arg_key, value) 123 124 def __eq__(self, other) -> bool: 125 return self is other or (type(self) is type(other) and hash(self) == hash(other)) 126 127 def __hash__(self) -> int: 128 if self._hash is None: 129 nodes = [] 130 queue = deque([self]) 131 132 while queue: 133 node = queue.popleft() 134 nodes.append(node) 135 136 for v in node.iter_expressions(): 137 if v._hash is None: 138 queue.append(v) 139 140 for node in reversed(nodes): 141 hash_ = hash(node.key) 142 t = type(node) 143 144 if t is Literal or t is Identifier: 145 for k, v in sorted(node.args.items()): 146 if v: 147 hash_ = hash((hash_, k, v)) 148 else: 149 for k, v in sorted(node.args.items()): 150 t = type(v) 151 152 if t is list: 153 for x in v: 154 if x is not None and x is not False: 155 hash_ = hash((hash_, k, x.lower() if type(x) is str else x)) 156 else: 157 hash_ = hash((hash_, k)) 158 elif v is not None and v is not False: 159 hash_ = hash((hash_, k, v.lower() if t is str else v)) 160 161 node._hash = hash_ 162 assert self._hash 163 return self._hash 164 165 def __reduce__(self) -> t.Tuple[t.Callable, t.Tuple[t.List[t.Dict[str, t.Any]]]]: 166 from sqlglot.serde import dump, load 167 168 return (load, (dump(self),)) 169 170 @property 171 def this(self) -> t.Any: 172 """ 173 Retrieves the argument with key "this". 174 """ 175 return self.args.get("this") 176 177 @property 178 def expression(self) -> t.Any: 179 """ 180 Retrieves the argument with key "expression". 181 """ 182 return self.args.get("expression") 183 184 @property 185 def expressions(self) -> t.List[t.Any]: 186 """ 187 Retrieves the argument with key "expressions". 188 """ 189 return self.args.get("expressions") or [] 190 191 def text(self, key) -> str: 192 """ 193 Returns a textual representation of the argument corresponding to "key". This can only be used 194 for args that are strings or leaf Expression instances, such as identifiers and literals. 195 """ 196 field = self.args.get(key) 197 if isinstance(field, str): 198 return field 199 if isinstance(field, (Identifier, Literal, Var)): 200 return field.this 201 if isinstance(field, (Star, Null)): 202 return field.name 203 return "" 204 205 @property 206 def is_string(self) -> bool: 207 """ 208 Checks whether a Literal expression is a string. 209 """ 210 return isinstance(self, Literal) and self.args["is_string"] 211 212 @property 213 def is_number(self) -> bool: 214 """ 215 Checks whether a Literal expression is a number. 216 """ 217 return (isinstance(self, Literal) and not self.args["is_string"]) or ( 218 isinstance(self, Neg) and self.this.is_number 219 ) 220 221 def to_py(self) -> t.Any: 222 """ 223 Returns a Python object equivalent of the SQL node. 224 """ 225 raise ValueError(f"{self} cannot be converted to a Python object.") 226 227 @property 228 def is_int(self) -> bool: 229 """ 230 Checks whether an expression is an integer. 231 """ 232 return self.is_number and isinstance(self.to_py(), int) 233 234 @property 235 def is_star(self) -> bool: 236 """Checks whether an expression is a star.""" 237 return isinstance(self, Star) or (isinstance(self, Column) and isinstance(self.this, Star)) 238 239 @property 240 def alias(self) -> str: 241 """ 242 Returns the alias of the expression, or an empty string if it's not aliased. 243 """ 244 if isinstance(self.args.get("alias"), TableAlias): 245 return self.args["alias"].name 246 return self.text("alias") 247 248 @property 249 def alias_column_names(self) -> t.List[str]: 250 table_alias = self.args.get("alias") 251 if not table_alias: 252 return [] 253 return [c.name for c in table_alias.args.get("columns") or []] 254 255 @property 256 def name(self) -> str: 257 return self.text("this") 258 259 @property 260 def alias_or_name(self) -> str: 261 return self.alias or self.name 262 263 @property 264 def output_name(self) -> str: 265 """ 266 Name of the output column if this expression is a selection. 267 268 If the Expression has no output name, an empty string is returned. 269 270 Example: 271 >>> from sqlglot import parse_one 272 >>> parse_one("SELECT a").expressions[0].output_name 273 'a' 274 >>> parse_one("SELECT b AS c").expressions[0].output_name 275 'c' 276 >>> parse_one("SELECT 1 + 2").expressions[0].output_name 277 '' 278 """ 279 return "" 280 281 @property 282 def type(self) -> t.Optional[DataType]: 283 if isinstance(self, Cast): 284 return self._type or self.to 285 return self._type 286 287 @type.setter 288 def type(self, dtype: t.Optional[DataType | DataType.Type | str]) -> None: 289 if dtype and not isinstance(dtype, DataType): 290 dtype = DataType.build(dtype) 291 self._type = dtype # type: ignore 292 293 def is_type(self, *dtypes) -> bool: 294 return self.type is not None and self.type.is_type(*dtypes) 295 296 def is_leaf(self) -> bool: 297 return not any(isinstance(v, (Expression, list)) and v for v in self.args.values()) 298 299 @property 300 def meta(self) -> t.Dict[str, t.Any]: 301 if self._meta is None: 302 self._meta = {} 303 return self._meta 304 305 def __deepcopy__(self, memo): 306 root = self.__class__() 307 stack = [(self, root)] 308 309 while stack: 310 node, copy = stack.pop() 311 312 if node.comments is not None: 313 copy.comments = deepcopy(node.comments) 314 if node._type is not None: 315 copy._type = deepcopy(node._type) 316 if node._meta is not None: 317 copy._meta = deepcopy(node._meta) 318 if node._hash is not None: 319 copy._hash = node._hash 320 321 for k, vs in node.args.items(): 322 if hasattr(vs, "parent"): 323 stack.append((vs, vs.__class__())) 324 copy.set(k, stack[-1][-1]) 325 elif type(vs) is list: 326 copy.args[k] = [] 327 328 for v in vs: 329 if hasattr(v, "parent"): 330 stack.append((v, v.__class__())) 331 copy.append(k, stack[-1][-1]) 332 else: 333 copy.append(k, v) 334 else: 335 copy.args[k] = vs 336 337 return root 338 339 def copy(self) -> Self: 340 """ 341 Returns a deep copy of the expression. 342 """ 343 return deepcopy(self) 344 345 def add_comments(self, comments: t.Optional[t.List[str]] = None, prepend: bool = False) -> None: 346 if self.comments is None: 347 self.comments = [] 348 349 if comments: 350 for comment in comments: 351 _, *meta = comment.split(SQLGLOT_META) 352 if meta: 353 for kv in "".join(meta).split(","): 354 k, *v = kv.split("=") 355 value = v[0].strip() if v else True 356 self.meta[k.strip()] = to_bool(value) 357 358 if not prepend: 359 self.comments.append(comment) 360 361 if prepend: 362 self.comments = comments + self.comments 363 364 def pop_comments(self) -> t.List[str]: 365 comments = self.comments or [] 366 self.comments = None 367 return comments 368 369 def append(self, arg_key: str, value: t.Any) -> None: 370 """ 371 Appends value to arg_key if it's a list or sets it as a new list. 372 373 Args: 374 arg_key (str): name of the list expression arg 375 value (Any): value to append to the list 376 """ 377 if type(self.args.get(arg_key)) is not list: 378 self.args[arg_key] = [] 379 self._set_parent(arg_key, value) 380 values = self.args[arg_key] 381 if hasattr(value, "parent"): 382 value.index = len(values) 383 values.append(value) 384 385 def set( 386 self, 387 arg_key: str, 388 value: t.Any, 389 index: t.Optional[int] = None, 390 overwrite: bool = True, 391 ) -> None: 392 """ 393 Sets arg_key to value. 394 395 Args: 396 arg_key: name of the expression arg. 397 value: value to set the arg to. 398 index: if the arg is a list, this specifies what position to add the value in it. 399 overwrite: assuming an index is given, this determines whether to overwrite the 400 list entry instead of only inserting a new value (i.e., like list.insert). 401 """ 402 expression: t.Optional[Expression] = self 403 404 while expression and expression._hash is not None: 405 expression._hash = None 406 expression = expression.parent 407 408 if index is not None: 409 expressions = self.args.get(arg_key) or [] 410 411 if seq_get(expressions, index) is None: 412 return 413 if value is None: 414 expressions.pop(index) 415 for v in expressions[index:]: 416 v.index = v.index - 1 417 return 418 419 if isinstance(value, list): 420 expressions.pop(index) 421 expressions[index:index] = value 422 elif overwrite: 423 expressions[index] = value 424 else: 425 expressions.insert(index, value) 426 427 value = expressions 428 elif value is None: 429 self.args.pop(arg_key, None) 430 return 431 432 self.args[arg_key] = value 433 self._set_parent(arg_key, value, index) 434 435 def _set_parent(self, arg_key: str, value: t.Any, index: t.Optional[int] = None) -> None: 436 if hasattr(value, "parent"): 437 value.parent = self 438 value.arg_key = arg_key 439 value.index = index 440 elif type(value) is list: 441 for index, v in enumerate(value): 442 if hasattr(v, "parent"): 443 v.parent = self 444 v.arg_key = arg_key 445 v.index = index 446 447 @property 448 def depth(self) -> int: 449 """ 450 Returns the depth of this tree. 451 """ 452 if self.parent: 453 return self.parent.depth + 1 454 return 0 455 456 def iter_expressions(self, reverse: bool = False) -> t.Iterator[Expression]: 457 """Yields the key and expression for all arguments, exploding list args.""" 458 for vs in reversed(self.args.values()) if reverse else self.args.values(): # type: ignore 459 if type(vs) is list: 460 for v in reversed(vs) if reverse else vs: # type: ignore 461 if hasattr(v, "parent"): 462 yield v 463 elif hasattr(vs, "parent"): 464 yield vs 465 466 def find(self, *expression_types: t.Type[E], bfs: bool = True) -> t.Optional[E]: 467 """ 468 Returns the first node in this tree which matches at least one of 469 the specified types. 470 471 Args: 472 expression_types: the expression type(s) to match. 473 bfs: whether to search the AST using the BFS algorithm (DFS is used if false). 474 475 Returns: 476 The node which matches the criteria or None if no such node was found. 477 """ 478 return next(self.find_all(*expression_types, bfs=bfs), None) 479 480 def find_all(self, *expression_types: t.Type[E], bfs: bool = True) -> t.Iterator[E]: 481 """ 482 Returns a generator object which visits all nodes in this tree and only 483 yields those that match at least one of the specified expression types. 484 485 Args: 486 expression_types: the expression type(s) to match. 487 bfs: whether to search the AST using the BFS algorithm (DFS is used if false). 488 489 Returns: 490 The generator object. 491 """ 492 for expression in self.walk(bfs=bfs): 493 if isinstance(expression, expression_types): 494 yield expression 495 496 def find_ancestor(self, *expression_types: t.Type[E]) -> t.Optional[E]: 497 """ 498 Returns a nearest parent matching expression_types. 499 500 Args: 501 expression_types: the expression type(s) to match. 502 503 Returns: 504 The parent node. 505 """ 506 ancestor = self.parent 507 while ancestor and not isinstance(ancestor, expression_types): 508 ancestor = ancestor.parent 509 return ancestor # type: ignore 510 511 @property 512 def parent_select(self) -> t.Optional[Select]: 513 """ 514 Returns the parent select statement. 515 """ 516 return self.find_ancestor(Select) 517 518 @property 519 def same_parent(self) -> bool: 520 """Returns if the parent is the same class as itself.""" 521 return type(self.parent) is self.__class__ 522 523 def root(self) -> Expression: 524 """ 525 Returns the root expression of this tree. 526 """ 527 expression = self 528 while expression.parent: 529 expression = expression.parent 530 return expression 531 532 def walk( 533 self, bfs: bool = True, prune: t.Optional[t.Callable[[Expression], bool]] = None 534 ) -> t.Iterator[Expression]: 535 """ 536 Returns a generator object which visits all nodes in this tree. 537 538 Args: 539 bfs: if set to True the BFS traversal order will be applied, 540 otherwise the DFS traversal will be used instead. 541 prune: callable that returns True if the generator should stop traversing 542 this branch of the tree. 543 544 Returns: 545 the generator object. 546 """ 547 if bfs: 548 yield from self.bfs(prune=prune) 549 else: 550 yield from self.dfs(prune=prune) 551 552 def dfs( 553 self, prune: t.Optional[t.Callable[[Expression], bool]] = None 554 ) -> t.Iterator[Expression]: 555 """ 556 Returns a generator object which visits all nodes in this tree in 557 the DFS (Depth-first) order. 558 559 Returns: 560 The generator object. 561 """ 562 stack = [self] 563 564 while stack: 565 node = stack.pop() 566 567 yield node 568 569 if prune and prune(node): 570 continue 571 572 for v in node.iter_expressions(reverse=True): 573 stack.append(v) 574 575 def bfs( 576 self, prune: t.Optional[t.Callable[[Expression], bool]] = None 577 ) -> t.Iterator[Expression]: 578 """ 579 Returns a generator object which visits all nodes in this tree in 580 the BFS (Breadth-first) order. 581 582 Returns: 583 The generator object. 584 """ 585 queue = deque([self]) 586 587 while queue: 588 node = queue.popleft() 589 590 yield node 591 592 if prune and prune(node): 593 continue 594 595 for v in node.iter_expressions(): 596 queue.append(v) 597 598 def unnest(self): 599 """ 600 Returns the first non parenthesis child or self. 601 """ 602 expression = self 603 while type(expression) is Paren: 604 expression = expression.this 605 return expression 606 607 def unalias(self): 608 """ 609 Returns the inner expression if this is an Alias. 610 """ 611 if isinstance(self, Alias): 612 return self.this 613 return self 614 615 def unnest_operands(self): 616 """ 617 Returns unnested operands as a tuple. 618 """ 619 return tuple(arg.unnest() for arg in self.iter_expressions()) 620 621 def flatten(self, unnest=True): 622 """ 623 Returns a generator which yields child nodes whose parents are the same class. 624 625 A AND B AND C -> [A, B, C] 626 """ 627 for node in self.dfs(prune=lambda n: n.parent and type(n) is not self.__class__): 628 if type(node) is not self.__class__: 629 yield node.unnest() if unnest and not isinstance(node, Subquery) else node 630 631 def __str__(self) -> str: 632 return self.sql() 633 634 def __repr__(self) -> str: 635 return _to_s(self) 636 637 def to_s(self) -> str: 638 """ 639 Same as __repr__, but includes additional information which can be useful 640 for debugging, like empty or missing args and the AST nodes' object IDs. 641 """ 642 return _to_s(self, verbose=True) 643 644 def sql(self, dialect: DialectType = None, **opts) -> str: 645 """ 646 Returns SQL string representation of this tree. 647 648 Args: 649 dialect: the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql"). 650 opts: other `sqlglot.generator.Generator` options. 651 652 Returns: 653 The SQL string. 654 """ 655 from sqlglot.dialects import Dialect 656 657 return Dialect.get_or_raise(dialect).generate(self, **opts) 658 659 def transform(self, fun: t.Callable, *args: t.Any, copy: bool = True, **kwargs) -> Expression: 660 """ 661 Visits all tree nodes (excluding already transformed ones) 662 and applies the given transformation function to each node. 663 664 Args: 665 fun: a function which takes a node as an argument and returns a 666 new transformed node or the same node without modifications. If the function 667 returns None, then the corresponding node will be removed from the syntax tree. 668 copy: if set to True a new tree instance is constructed, otherwise the tree is 669 modified in place. 670 671 Returns: 672 The transformed tree. 673 """ 674 root = None 675 new_node = None 676 677 for node in (self.copy() if copy else self).dfs(prune=lambda n: n is not new_node): 678 parent, arg_key, index = node.parent, node.arg_key, node.index 679 new_node = fun(node, *args, **kwargs) 680 681 if not root: 682 root = new_node 683 elif parent and arg_key and new_node is not node: 684 parent.set(arg_key, new_node, index) 685 686 assert root 687 return root.assert_is(Expression) 688 689 @t.overload 690 def replace(self, expression: E) -> E: ... 691 692 @t.overload 693 def replace(self, expression: None) -> None: ... 694 695 def replace(self, expression): 696 """ 697 Swap out this expression with a new expression. 698 699 For example:: 700 701 >>> tree = Select().select("x").from_("tbl") 702 >>> tree.find(Column).replace(column("y")) 703 Column( 704 this=Identifier(this=y, quoted=False)) 705 >>> tree.sql() 706 'SELECT y FROM tbl' 707 708 Args: 709 expression: new node 710 711 Returns: 712 The new expression or expressions. 713 """ 714 parent = self.parent 715 716 if not parent or parent is expression: 717 return expression 718 719 key = self.arg_key 720 value = parent.args.get(key) 721 722 if type(expression) is list and isinstance(value, Expression): 723 # We are trying to replace an Expression with a list, so it's assumed that 724 # the intention was to really replace the parent of this expression. 725 value.parent.replace(expression) 726 else: 727 parent.set(key, expression, self.index) 728 729 if expression is not self: 730 self.parent = None 731 self.arg_key = None 732 self.index = None 733 734 return expression 735 736 def pop(self: E) -> E: 737 """ 738 Remove this expression from its AST. 739 740 Returns: 741 The popped expression. 742 """ 743 self.replace(None) 744 return self 745 746 def assert_is(self, type_: t.Type[E]) -> E: 747 """ 748 Assert that this `Expression` is an instance of `type_`. 749 750 If it is NOT an instance of `type_`, this raises an assertion error. 751 Otherwise, this returns this expression. 752 753 Examples: 754 This is useful for type security in chained expressions: 755 756 >>> import sqlglot 757 >>> sqlglot.parse_one("SELECT x from y").assert_is(Select).select("z").sql() 758 'SELECT x, z FROM y' 759 """ 760 if not isinstance(self, type_): 761 raise AssertionError(f"{self} is not {type_}.") 762 return self 763 764 def error_messages(self, args: t.Optional[t.Sequence] = None) -> t.List[str]: 765 """ 766 Checks if this expression is valid (e.g. all mandatory args are set). 767 768 Args: 769 args: a sequence of values that were used to instantiate a Func expression. This is used 770 to check that the provided arguments don't exceed the function argument limit. 771 772 Returns: 773 A list of error messages for all possible errors that were found. 774 """ 775 errors: t.List[str] = [] 776 777 if UNITTEST: 778 for k in self.args: 779 if k not in self.arg_types: 780 raise TypeError(f"Unexpected keyword: '{k}' for {self.__class__}") 781 782 for k in self.required_args: 783 v = self.args.get(k) 784 if v is None or (type(v) is list and not v): 785 errors.append(f"Required keyword: '{k}' missing for {self.__class__}") 786 787 if ( 788 args 789 and isinstance(self, Func) 790 and len(args) > len(self.arg_types) 791 and not self.is_var_len_args 792 ): 793 errors.append( 794 f"The number of provided arguments ({len(args)}) is greater than " 795 f"the maximum number of supported arguments ({len(self.arg_types)})" 796 ) 797 798 return errors 799 800 def dump(self): 801 """ 802 Dump this Expression to a JSON-serializable dict. 803 """ 804 from sqlglot.serde import dump 805 806 return dump(self) 807 808 @classmethod 809 def load(cls, obj): 810 """ 811 Load a dict (as returned by `Expression.dump`) into an Expression instance. 812 """ 813 from sqlglot.serde import load 814 815 return load(obj) 816 817 def and_( 818 self, 819 *expressions: t.Optional[ExpOrStr], 820 dialect: DialectType = None, 821 copy: bool = True, 822 wrap: bool = True, 823 **opts, 824 ) -> Condition: 825 """ 826 AND this condition with one or multiple expressions. 827 828 Example: 829 >>> condition("x=1").and_("y=1").sql() 830 'x = 1 AND y = 1' 831 832 Args: 833 *expressions: the SQL code strings to parse. 834 If an `Expression` instance is passed, it will be used as-is. 835 dialect: the dialect used to parse the input expression. 836 copy: whether to copy the involved expressions (only applies to Expressions). 837 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 838 precedence issues, but can be turned off when the produced AST is too deep and 839 causes recursion-related issues. 840 opts: other options to use to parse the input expressions. 841 842 Returns: 843 The new And condition. 844 """ 845 return and_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts) 846 847 def or_( 848 self, 849 *expressions: t.Optional[ExpOrStr], 850 dialect: DialectType = None, 851 copy: bool = True, 852 wrap: bool = True, 853 **opts, 854 ) -> Condition: 855 """ 856 OR this condition with one or multiple expressions. 857 858 Example: 859 >>> condition("x=1").or_("y=1").sql() 860 'x = 1 OR y = 1' 861 862 Args: 863 *expressions: the SQL code strings to parse. 864 If an `Expression` instance is passed, it will be used as-is. 865 dialect: the dialect used to parse the input expression. 866 copy: whether to copy the involved expressions (only applies to Expressions). 867 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 868 precedence issues, but can be turned off when the produced AST is too deep and 869 causes recursion-related issues. 870 opts: other options to use to parse the input expressions. 871 872 Returns: 873 The new Or condition. 874 """ 875 return or_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts) 876 877 def not_(self, copy: bool = True): 878 """ 879 Wrap this condition with NOT. 880 881 Example: 882 >>> condition("x=1").not_().sql() 883 'NOT x = 1' 884 885 Args: 886 copy: whether to copy this object. 887 888 Returns: 889 The new Not instance. 890 """ 891 return not_(self, copy=copy) 892 893 def update_positions( 894 self: E, 895 other: t.Optional[Token | Expression] = None, 896 line: t.Optional[int] = None, 897 col: t.Optional[int] = None, 898 start: t.Optional[int] = None, 899 end: t.Optional[int] = None, 900 ) -> E: 901 """ 902 Update this expression with positions from a token or other expression. 903 904 Args: 905 other: a token or expression to update this expression with. 906 line: the line number to use if other is None 907 col: column number 908 start: start char index 909 end: end char index 910 911 Returns: 912 The updated expression. 913 """ 914 if other is None: 915 self.meta["line"] = line 916 self.meta["col"] = col 917 self.meta["start"] = start 918 self.meta["end"] = end 919 elif hasattr(other, "meta"): 920 for k in POSITION_META_KEYS: 921 self.meta[k] = other.meta[k] 922 else: 923 self.meta["line"] = other.line 924 self.meta["col"] = other.col 925 self.meta["start"] = other.start 926 self.meta["end"] = other.end 927 return self 928 929 def as_( 930 self, 931 alias: str | Identifier, 932 quoted: t.Optional[bool] = None, 933 dialect: DialectType = None, 934 copy: bool = True, 935 **opts, 936 ) -> Alias: 937 return alias_(self, alias, quoted=quoted, dialect=dialect, copy=copy, **opts) 938 939 def _binop(self, klass: t.Type[E], other: t.Any, reverse: bool = False) -> E: 940 this = self.copy() 941 other = convert(other, copy=True) 942 if not isinstance(this, klass) and not isinstance(other, klass): 943 this = _wrap(this, Binary) 944 other = _wrap(other, Binary) 945 if reverse: 946 return klass(this=other, expression=this) 947 return klass(this=this, expression=other) 948 949 def __getitem__(self, other: ExpOrStr | t.Tuple[ExpOrStr]) -> Bracket: 950 return Bracket( 951 this=self.copy(), expressions=[convert(e, copy=True) for e in ensure_list(other)] 952 ) 953 954 def __iter__(self) -> t.Iterator: 955 if "expressions" in self.arg_types: 956 return iter(self.args.get("expressions") or []) 957 # We define this because __getitem__ converts Expression into an iterable, which is 958 # problematic because one can hit infinite loops if they do "for x in some_expr: ..." 959 # See: https://peps.python.org/pep-0234/ 960 raise TypeError(f"'{self.__class__.__name__}' object is not iterable") 961 962 def isin( 963 self, 964 *expressions: t.Any, 965 query: t.Optional[ExpOrStr] = None, 966 unnest: t.Optional[ExpOrStr] | t.Collection[ExpOrStr] = None, 967 copy: bool = True, 968 **opts, 969 ) -> In: 970 subquery = maybe_parse(query, copy=copy, **opts) if query else None 971 if subquery and not isinstance(subquery, Subquery): 972 subquery = subquery.subquery(copy=False) 973 974 return In( 975 this=maybe_copy(self, copy), 976 expressions=[convert(e, copy=copy) for e in expressions], 977 query=subquery, 978 unnest=( 979 Unnest( 980 expressions=[ 981 maybe_parse(t.cast(ExpOrStr, e), copy=copy, **opts) 982 for e in ensure_list(unnest) 983 ] 984 ) 985 if unnest 986 else None 987 ), 988 ) 989 990 def between( 991 self, 992 low: t.Any, 993 high: t.Any, 994 copy: bool = True, 995 symmetric: t.Optional[bool] = None, 996 **opts, 997 ) -> Between: 998 between = Between( 999 this=maybe_copy(self, copy), 1000 low=convert(low, copy=copy, **opts), 1001 high=convert(high, copy=copy, **opts), 1002 ) 1003 if symmetric is not None: 1004 between.set("symmetric", symmetric) 1005 1006 return between 1007 1008 def is_(self, other: ExpOrStr) -> Is: 1009 return self._binop(Is, other) 1010 1011 def like(self, other: ExpOrStr) -> Like: 1012 return self._binop(Like, other) 1013 1014 def ilike(self, other: ExpOrStr) -> ILike: 1015 return self._binop(ILike, other) 1016 1017 def eq(self, other: t.Any) -> EQ: 1018 return self._binop(EQ, other) 1019 1020 def neq(self, other: t.Any) -> NEQ: 1021 return self._binop(NEQ, other) 1022 1023 def rlike(self, other: ExpOrStr) -> RegexpLike: 1024 return self._binop(RegexpLike, other) 1025 1026 def div(self, other: ExpOrStr, typed: bool = False, safe: bool = False) -> Div: 1027 div = self._binop(Div, other) 1028 div.set("typed", typed) 1029 div.set("safe", safe) 1030 return div 1031 1032 def asc(self, nulls_first: bool = True) -> Ordered: 1033 return Ordered(this=self.copy(), nulls_first=nulls_first) 1034 1035 def desc(self, nulls_first: bool = False) -> Ordered: 1036 return Ordered(this=self.copy(), desc=True, nulls_first=nulls_first) 1037 1038 def __lt__(self, other: t.Any) -> LT: 1039 return self._binop(LT, other) 1040 1041 def __le__(self, other: t.Any) -> LTE: 1042 return self._binop(LTE, other) 1043 1044 def __gt__(self, other: t.Any) -> GT: 1045 return self._binop(GT, other) 1046 1047 def __ge__(self, other: t.Any) -> GTE: 1048 return self._binop(GTE, other) 1049 1050 def __add__(self, other: t.Any) -> Add: 1051 return self._binop(Add, other) 1052 1053 def __radd__(self, other: t.Any) -> Add: 1054 return self._binop(Add, other, reverse=True) 1055 1056 def __sub__(self, other: t.Any) -> Sub: 1057 return self._binop(Sub, other) 1058 1059 def __rsub__(self, other: t.Any) -> Sub: 1060 return self._binop(Sub, other, reverse=True) 1061 1062 def __mul__(self, other: t.Any) -> Mul: 1063 return self._binop(Mul, other) 1064 1065 def __rmul__(self, other: t.Any) -> Mul: 1066 return self._binop(Mul, other, reverse=True) 1067 1068 def __truediv__(self, other: t.Any) -> Div: 1069 return self._binop(Div, other) 1070 1071 def __rtruediv__(self, other: t.Any) -> Div: 1072 return self._binop(Div, other, reverse=True) 1073 1074 def __floordiv__(self, other: t.Any) -> IntDiv: 1075 return self._binop(IntDiv, other) 1076 1077 def __rfloordiv__(self, other: t.Any) -> IntDiv: 1078 return self._binop(IntDiv, other, reverse=True) 1079 1080 def __mod__(self, other: t.Any) -> Mod: 1081 return self._binop(Mod, other) 1082 1083 def __rmod__(self, other: t.Any) -> Mod: 1084 return self._binop(Mod, other, reverse=True) 1085 1086 def __pow__(self, other: t.Any) -> Pow: 1087 return self._binop(Pow, other) 1088 1089 def __rpow__(self, other: t.Any) -> Pow: 1090 return self._binop(Pow, other, reverse=True) 1091 1092 def __and__(self, other: t.Any) -> And: 1093 return self._binop(And, other) 1094 1095 def __rand__(self, other: t.Any) -> And: 1096 return self._binop(And, other, reverse=True) 1097 1098 def __or__(self, other: t.Any) -> Or: 1099 return self._binop(Or, other) 1100 1101 def __ror__(self, other: t.Any) -> Or: 1102 return self._binop(Or, other, reverse=True) 1103 1104 def __neg__(self) -> Neg: 1105 return Neg(this=_wrap(self.copy(), Binary)) 1106 1107 def __invert__(self) -> Not: 1108 return not_(self.copy()) 1109 1110 1111IntoType = t.Union[ 1112 str, 1113 t.Type[Expression], 1114 t.Collection[t.Union[str, t.Type[Expression]]], 1115] 1116ExpOrStr = t.Union[str, Expression] 1117 1118 1119class Condition(Expression): 1120 """Logical conditions like x AND y, or simply x""" 1121 1122 1123class Predicate(Condition): 1124 """Relationships like x = y, x > 1, x >= y.""" 1125 1126 1127class DerivedTable(Expression): 1128 @property 1129 def selects(self) -> t.List[Expression]: 1130 return self.this.selects if isinstance(self.this, Query) else [] 1131 1132 @property 1133 def named_selects(self) -> t.List[str]: 1134 return [select.output_name for select in self.selects] 1135 1136 1137class Query(Expression): 1138 def subquery(self, alias: t.Optional[ExpOrStr] = None, copy: bool = True) -> Subquery: 1139 """ 1140 Returns a `Subquery` that wraps around this query. 1141 1142 Example: 1143 >>> subquery = Select().select("x").from_("tbl").subquery() 1144 >>> Select().select("x").from_(subquery).sql() 1145 'SELECT x FROM (SELECT x FROM tbl)' 1146 1147 Args: 1148 alias: an optional alias for the subquery. 1149 copy: if `False`, modify this expression instance in-place. 1150 """ 1151 instance = maybe_copy(self, copy) 1152 if not isinstance(alias, Expression): 1153 alias = TableAlias(this=to_identifier(alias)) if alias else None 1154 1155 return Subquery(this=instance, alias=alias) 1156 1157 def limit( 1158 self: Q, expression: ExpOrStr | int, dialect: DialectType = None, copy: bool = True, **opts 1159 ) -> Q: 1160 """ 1161 Adds a LIMIT clause to this query. 1162 1163 Example: 1164 >>> select("1").union(select("1")).limit(1).sql() 1165 'SELECT 1 UNION SELECT 1 LIMIT 1' 1166 1167 Args: 1168 expression: the SQL code string to parse. 1169 This can also be an integer. 1170 If a `Limit` instance is passed, it will be used as-is. 1171 If another `Expression` instance is passed, it will be wrapped in a `Limit`. 1172 dialect: the dialect used to parse the input expression. 1173 copy: if `False`, modify this expression instance in-place. 1174 opts: other options to use to parse the input expressions. 1175 1176 Returns: 1177 A limited Select expression. 1178 """ 1179 return _apply_builder( 1180 expression=expression, 1181 instance=self, 1182 arg="limit", 1183 into=Limit, 1184 prefix="LIMIT", 1185 dialect=dialect, 1186 copy=copy, 1187 into_arg="expression", 1188 **opts, 1189 ) 1190 1191 def offset( 1192 self: Q, expression: ExpOrStr | int, dialect: DialectType = None, copy: bool = True, **opts 1193 ) -> Q: 1194 """ 1195 Set the OFFSET expression. 1196 1197 Example: 1198 >>> Select().from_("tbl").select("x").offset(10).sql() 1199 'SELECT x FROM tbl OFFSET 10' 1200 1201 Args: 1202 expression: the SQL code string to parse. 1203 This can also be an integer. 1204 If a `Offset` instance is passed, this is used as-is. 1205 If another `Expression` instance is passed, it will be wrapped in a `Offset`. 1206 dialect: the dialect used to parse the input expression. 1207 copy: if `False`, modify this expression instance in-place. 1208 opts: other options to use to parse the input expressions. 1209 1210 Returns: 1211 The modified Select expression. 1212 """ 1213 return _apply_builder( 1214 expression=expression, 1215 instance=self, 1216 arg="offset", 1217 into=Offset, 1218 prefix="OFFSET", 1219 dialect=dialect, 1220 copy=copy, 1221 into_arg="expression", 1222 **opts, 1223 ) 1224 1225 def order_by( 1226 self: Q, 1227 *expressions: t.Optional[ExpOrStr], 1228 append: bool = True, 1229 dialect: DialectType = None, 1230 copy: bool = True, 1231 **opts, 1232 ) -> Q: 1233 """ 1234 Set the ORDER BY expression. 1235 1236 Example: 1237 >>> Select().from_("tbl").select("x").order_by("x DESC").sql() 1238 'SELECT x FROM tbl ORDER BY x DESC' 1239 1240 Args: 1241 *expressions: the SQL code strings to parse. 1242 If a `Group` instance is passed, this is used as-is. 1243 If another `Expression` instance is passed, it will be wrapped in a `Order`. 1244 append: if `True`, add to any existing expressions. 1245 Otherwise, this flattens all the `Order` expression into a single expression. 1246 dialect: the dialect used to parse the input expression. 1247 copy: if `False`, modify this expression instance in-place. 1248 opts: other options to use to parse the input expressions. 1249 1250 Returns: 1251 The modified Select expression. 1252 """ 1253 return _apply_child_list_builder( 1254 *expressions, 1255 instance=self, 1256 arg="order", 1257 append=append, 1258 copy=copy, 1259 prefix="ORDER BY", 1260 into=Order, 1261 dialect=dialect, 1262 **opts, 1263 ) 1264 1265 @property 1266 def ctes(self) -> t.List[CTE]: 1267 """Returns a list of all the CTEs attached to this query.""" 1268 with_ = self.args.get("with_") 1269 return with_.expressions if with_ else [] 1270 1271 @property 1272 def selects(self) -> t.List[Expression]: 1273 """Returns the query's projections.""" 1274 raise NotImplementedError("Query objects must implement `selects`") 1275 1276 @property 1277 def named_selects(self) -> t.List[str]: 1278 """Returns the output names of the query's projections.""" 1279 raise NotImplementedError("Query objects must implement `named_selects`") 1280 1281 def select( 1282 self: Q, 1283 *expressions: t.Optional[ExpOrStr], 1284 append: bool = True, 1285 dialect: DialectType = None, 1286 copy: bool = True, 1287 **opts, 1288 ) -> Q: 1289 """ 1290 Append to or set the SELECT expressions. 1291 1292 Example: 1293 >>> Select().select("x", "y").sql() 1294 'SELECT x, y' 1295 1296 Args: 1297 *expressions: the SQL code strings to parse. 1298 If an `Expression` instance is passed, it will be used as-is. 1299 append: if `True`, add to any existing expressions. 1300 Otherwise, this resets the expressions. 1301 dialect: the dialect used to parse the input expressions. 1302 copy: if `False`, modify this expression instance in-place. 1303 opts: other options to use to parse the input expressions. 1304 1305 Returns: 1306 The modified Query expression. 1307 """ 1308 raise NotImplementedError("Query objects must implement `select`") 1309 1310 def where( 1311 self: Q, 1312 *expressions: t.Optional[ExpOrStr], 1313 append: bool = True, 1314 dialect: DialectType = None, 1315 copy: bool = True, 1316 **opts, 1317 ) -> Q: 1318 """ 1319 Append to or set the WHERE expressions. 1320 1321 Examples: 1322 >>> Select().select("x").from_("tbl").where("x = 'a' OR x < 'b'").sql() 1323 "SELECT x FROM tbl WHERE x = 'a' OR x < 'b'" 1324 1325 Args: 1326 *expressions: the SQL code strings to parse. 1327 If an `Expression` instance is passed, it will be used as-is. 1328 Multiple expressions are combined with an AND operator. 1329 append: if `True`, AND the new expressions to any existing expression. 1330 Otherwise, this resets the expression. 1331 dialect: the dialect used to parse the input expressions. 1332 copy: if `False`, modify this expression instance in-place. 1333 opts: other options to use to parse the input expressions. 1334 1335 Returns: 1336 The modified expression. 1337 """ 1338 return _apply_conjunction_builder( 1339 *[expr.this if isinstance(expr, Where) else expr for expr in expressions], 1340 instance=self, 1341 arg="where", 1342 append=append, 1343 into=Where, 1344 dialect=dialect, 1345 copy=copy, 1346 **opts, 1347 ) 1348 1349 def with_( 1350 self: Q, 1351 alias: ExpOrStr, 1352 as_: ExpOrStr, 1353 recursive: t.Optional[bool] = None, 1354 materialized: t.Optional[bool] = None, 1355 append: bool = True, 1356 dialect: DialectType = None, 1357 copy: bool = True, 1358 scalar: t.Optional[bool] = None, 1359 **opts, 1360 ) -> Q: 1361 """ 1362 Append to or set the common table expressions. 1363 1364 Example: 1365 >>> Select().with_("tbl2", as_="SELECT * FROM tbl").select("x").from_("tbl2").sql() 1366 'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2' 1367 1368 Args: 1369 alias: the SQL code string to parse as the table name. 1370 If an `Expression` instance is passed, this is used as-is. 1371 as_: the SQL code string to parse as the table expression. 1372 If an `Expression` instance is passed, it will be used as-is. 1373 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 1374 materialized: set the MATERIALIZED part of the expression. 1375 append: if `True`, add to any existing expressions. 1376 Otherwise, this resets the expressions. 1377 dialect: the dialect used to parse the input expression. 1378 copy: if `False`, modify this expression instance in-place. 1379 scalar: if `True`, this is a scalar common table expression. 1380 opts: other options to use to parse the input expressions. 1381 1382 Returns: 1383 The modified expression. 1384 """ 1385 return _apply_cte_builder( 1386 self, 1387 alias, 1388 as_, 1389 recursive=recursive, 1390 materialized=materialized, 1391 append=append, 1392 dialect=dialect, 1393 copy=copy, 1394 scalar=scalar, 1395 **opts, 1396 ) 1397 1398 def union( 1399 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1400 ) -> Union: 1401 """ 1402 Builds a UNION expression. 1403 1404 Example: 1405 >>> import sqlglot 1406 >>> sqlglot.parse_one("SELECT * FROM foo").union("SELECT * FROM bla").sql() 1407 'SELECT * FROM foo UNION SELECT * FROM bla' 1408 1409 Args: 1410 expressions: the SQL code strings. 1411 If `Expression` instances are passed, they will be used as-is. 1412 distinct: set the DISTINCT flag if and only if this is true. 1413 dialect: the dialect used to parse the input expression. 1414 opts: other options to use to parse the input expressions. 1415 1416 Returns: 1417 The new Union expression. 1418 """ 1419 return union(self, *expressions, distinct=distinct, dialect=dialect, **opts) 1420 1421 def intersect( 1422 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1423 ) -> Intersect: 1424 """ 1425 Builds an INTERSECT expression. 1426 1427 Example: 1428 >>> import sqlglot 1429 >>> sqlglot.parse_one("SELECT * FROM foo").intersect("SELECT * FROM bla").sql() 1430 'SELECT * FROM foo INTERSECT SELECT * FROM bla' 1431 1432 Args: 1433 expressions: the SQL code strings. 1434 If `Expression` instances are passed, they will be used as-is. 1435 distinct: set the DISTINCT flag if and only if this is true. 1436 dialect: the dialect used to parse the input expression. 1437 opts: other options to use to parse the input expressions. 1438 1439 Returns: 1440 The new Intersect expression. 1441 """ 1442 return intersect(self, *expressions, distinct=distinct, dialect=dialect, **opts) 1443 1444 def except_( 1445 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1446 ) -> Except: 1447 """ 1448 Builds an EXCEPT expression. 1449 1450 Example: 1451 >>> import sqlglot 1452 >>> sqlglot.parse_one("SELECT * FROM foo").except_("SELECT * FROM bla").sql() 1453 'SELECT * FROM foo EXCEPT SELECT * FROM bla' 1454 1455 Args: 1456 expressions: the SQL code strings. 1457 If `Expression` instance are passed, they will be used as-is. 1458 distinct: set the DISTINCT flag if and only if this is true. 1459 dialect: the dialect used to parse the input expression. 1460 opts: other options to use to parse the input expressions. 1461 1462 Returns: 1463 The new Except expression. 1464 """ 1465 return except_(self, *expressions, distinct=distinct, dialect=dialect, **opts) 1466 1467 1468class UDTF(DerivedTable): 1469 @property 1470 def selects(self) -> t.List[Expression]: 1471 alias = self.args.get("alias") 1472 return alias.columns if alias else [] 1473 1474 1475class Cache(Expression): 1476 arg_types = { 1477 "this": True, 1478 "lazy": False, 1479 "options": False, 1480 "expression": False, 1481 } 1482 1483 1484class Uncache(Expression): 1485 arg_types = {"this": True, "exists": False} 1486 1487 1488class Refresh(Expression): 1489 arg_types = {"this": True, "kind": True} 1490 1491 1492class DDL(Expression): 1493 @property 1494 def ctes(self) -> t.List[CTE]: 1495 """Returns a list of all the CTEs attached to this statement.""" 1496 with_ = self.args.get("with_") 1497 return with_.expressions if with_ else [] 1498 1499 @property 1500 def selects(self) -> t.List[Expression]: 1501 """If this statement contains a query (e.g. a CTAS), this returns the query's projections.""" 1502 return self.expression.selects if isinstance(self.expression, Query) else [] 1503 1504 @property 1505 def named_selects(self) -> t.List[str]: 1506 """ 1507 If this statement contains a query (e.g. a CTAS), this returns the output 1508 names of the query's projections. 1509 """ 1510 return self.expression.named_selects if isinstance(self.expression, Query) else [] 1511 1512 1513# https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/SQL-Data-Manipulation-Language/Statement-Syntax/LOCKING-Request-Modifier/LOCKING-Request-Modifier-Syntax 1514class LockingStatement(Expression): 1515 arg_types = {"this": True, "expression": True} 1516 1517 1518class DML(Expression): 1519 def returning( 1520 self, 1521 expression: ExpOrStr, 1522 dialect: DialectType = None, 1523 copy: bool = True, 1524 **opts, 1525 ) -> "Self": 1526 """ 1527 Set the RETURNING expression. Not supported by all dialects. 1528 1529 Example: 1530 >>> delete("tbl").returning("*", dialect="postgres").sql() 1531 'DELETE FROM tbl RETURNING *' 1532 1533 Args: 1534 expression: the SQL code strings to parse. 1535 If an `Expression` instance is passed, it will be used as-is. 1536 dialect: the dialect used to parse the input expressions. 1537 copy: if `False`, modify this expression instance in-place. 1538 opts: other options to use to parse the input expressions. 1539 1540 Returns: 1541 Delete: the modified expression. 1542 """ 1543 return _apply_builder( 1544 expression=expression, 1545 instance=self, 1546 arg="returning", 1547 prefix="RETURNING", 1548 dialect=dialect, 1549 copy=copy, 1550 into=Returning, 1551 **opts, 1552 ) 1553 1554 1555class Create(DDL): 1556 arg_types = { 1557 "with_": False, 1558 "this": True, 1559 "kind": True, 1560 "expression": False, 1561 "exists": False, 1562 "properties": False, 1563 "replace": False, 1564 "refresh": False, 1565 "unique": False, 1566 "indexes": False, 1567 "no_schema_binding": False, 1568 "begin": False, 1569 "end": False, 1570 "clone": False, 1571 "concurrently": False, 1572 "clustered": False, 1573 } 1574 1575 @property 1576 def kind(self) -> t.Optional[str]: 1577 kind = self.args.get("kind") 1578 return kind and kind.upper() 1579 1580 1581class SequenceProperties(Expression): 1582 arg_types = { 1583 "increment": False, 1584 "minvalue": False, 1585 "maxvalue": False, 1586 "cache": False, 1587 "start": False, 1588 "owned": False, 1589 "options": False, 1590 } 1591 1592 1593class TruncateTable(Expression): 1594 arg_types = { 1595 "expressions": True, 1596 "is_database": False, 1597 "exists": False, 1598 "only": False, 1599 "cluster": False, 1600 "identity": False, 1601 "option": False, 1602 "partition": False, 1603 } 1604 1605 1606# https://docs.snowflake.com/en/sql-reference/sql/create-clone 1607# https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_clone_statement 1608# https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_copy 1609class Clone(Expression): 1610 arg_types = {"this": True, "shallow": False, "copy": False} 1611 1612 1613class Describe(Expression): 1614 arg_types = { 1615 "this": True, 1616 "style": False, 1617 "kind": False, 1618 "expressions": False, 1619 "partition": False, 1620 "format": False, 1621 "as_json": False, 1622 } 1623 1624 1625# https://duckdb.org/docs/sql/statements/attach.html#attach 1626class Attach(Expression): 1627 arg_types = {"this": True, "exists": False, "expressions": False} 1628 1629 1630# https://duckdb.org/docs/sql/statements/attach.html#detach 1631class Detach(Expression): 1632 arg_types = {"this": True, "exists": False} 1633 1634 1635# https://duckdb.org/docs/sql/statements/load_and_install.html 1636class Install(Expression): 1637 arg_types = {"this": True, "from_": False, "force": False} 1638 1639 1640# https://duckdb.org/docs/guides/meta/summarize.html 1641class Summarize(Expression): 1642 arg_types = {"this": True, "table": False} 1643 1644 1645class Kill(Expression): 1646 arg_types = {"this": True, "kind": False} 1647 1648 1649class Pragma(Expression): 1650 pass 1651 1652 1653class Declare(Expression): 1654 arg_types = {"expressions": True} 1655 1656 1657class DeclareItem(Expression): 1658 arg_types = {"this": True, "kind": False, "default": False} 1659 1660 1661class Set(Expression): 1662 arg_types = {"expressions": False, "unset": False, "tag": False} 1663 1664 1665class Heredoc(Expression): 1666 arg_types = {"this": True, "tag": False} 1667 1668 1669class SetItem(Expression): 1670 arg_types = { 1671 "this": False, 1672 "expressions": False, 1673 "kind": False, 1674 "collate": False, # MySQL SET NAMES statement 1675 "global_": False, 1676 } 1677 1678 1679class QueryBand(Expression): 1680 arg_types = {"this": True, "scope": False, "update": False} 1681 1682 1683class Show(Expression): 1684 arg_types = { 1685 "this": True, 1686 "history": False, 1687 "terse": False, 1688 "target": False, 1689 "offset": False, 1690 "starts_with": False, 1691 "limit": False, 1692 "from_": False, 1693 "like": False, 1694 "where": False, 1695 "db": False, 1696 "scope": False, 1697 "scope_kind": False, 1698 "full": False, 1699 "mutex": False, 1700 "query": False, 1701 "channel": False, 1702 "global_": False, 1703 "log": False, 1704 "position": False, 1705 "types": False, 1706 "privileges": False, 1707 "for_table": False, 1708 "for_group": False, 1709 "for_user": False, 1710 "for_role": False, 1711 "into_outfile": False, 1712 "json": False, 1713 } 1714 1715 1716class UserDefinedFunction(Expression): 1717 arg_types = {"this": True, "expressions": False, "wrapped": False} 1718 1719 1720class CharacterSet(Expression): 1721 arg_types = {"this": True, "default": False} 1722 1723 1724class RecursiveWithSearch(Expression): 1725 arg_types = {"kind": True, "this": True, "expression": True, "using": False} 1726 1727 1728class With(Expression): 1729 arg_types = {"expressions": True, "recursive": False, "search": False} 1730 1731 @property 1732 def recursive(self) -> bool: 1733 return bool(self.args.get("recursive")) 1734 1735 1736class WithinGroup(Expression): 1737 arg_types = {"this": True, "expression": False} 1738 1739 1740# clickhouse supports scalar ctes 1741# https://clickhouse.com/docs/en/sql-reference/statements/select/with 1742class CTE(DerivedTable): 1743 arg_types = { 1744 "this": True, 1745 "alias": True, 1746 "scalar": False, 1747 "materialized": False, 1748 "key_expressions": False, 1749 } 1750 1751 1752class ProjectionDef(Expression): 1753 arg_types = {"this": True, "expression": True} 1754 1755 1756class TableAlias(Expression): 1757 arg_types = {"this": False, "columns": False} 1758 1759 @property 1760 def columns(self): 1761 return self.args.get("columns") or [] 1762 1763 1764class BitString(Condition): 1765 pass 1766 1767 1768class HexString(Condition): 1769 arg_types = {"this": True, "is_integer": False} 1770 1771 1772class ByteString(Condition): 1773 arg_types = {"this": True, "is_bytes": False} 1774 1775 1776class RawString(Condition): 1777 pass 1778 1779 1780class UnicodeString(Condition): 1781 arg_types = {"this": True, "escape": False} 1782 1783 1784class Column(Condition): 1785 arg_types = {"this": True, "table": False, "db": False, "catalog": False, "join_mark": False} 1786 1787 @property 1788 def table(self) -> str: 1789 return self.text("table") 1790 1791 @property 1792 def db(self) -> str: 1793 return self.text("db") 1794 1795 @property 1796 def catalog(self) -> str: 1797 return self.text("catalog") 1798 1799 @property 1800 def output_name(self) -> str: 1801 return self.name 1802 1803 @property 1804 def parts(self) -> t.List[Identifier]: 1805 """Return the parts of a column in order catalog, db, table, name.""" 1806 return [ 1807 t.cast(Identifier, self.args[part]) 1808 for part in ("catalog", "db", "table", "this") 1809 if self.args.get(part) 1810 ] 1811 1812 def to_dot(self, include_dots: bool = True) -> Dot | Identifier: 1813 """Converts the column into a dot expression.""" 1814 parts = self.parts 1815 parent = self.parent 1816 1817 if include_dots: 1818 while isinstance(parent, Dot): 1819 parts.append(parent.expression) 1820 parent = parent.parent 1821 1822 return Dot.build(deepcopy(parts)) if len(parts) > 1 else parts[0] 1823 1824 1825class Pseudocolumn(Column): 1826 pass 1827 1828 1829class ColumnPosition(Expression): 1830 arg_types = {"this": False, "position": True} 1831 1832 1833class ColumnDef(Expression): 1834 arg_types = { 1835 "this": True, 1836 "kind": False, 1837 "constraints": False, 1838 "exists": False, 1839 "position": False, 1840 "default": False, 1841 "output": False, 1842 } 1843 1844 @property 1845 def constraints(self) -> t.List[ColumnConstraint]: 1846 return self.args.get("constraints") or [] 1847 1848 @property 1849 def kind(self) -> t.Optional[DataType]: 1850 return self.args.get("kind") 1851 1852 1853class AlterColumn(Expression): 1854 arg_types = { 1855 "this": True, 1856 "dtype": False, 1857 "collate": False, 1858 "using": False, 1859 "default": False, 1860 "drop": False, 1861 "comment": False, 1862 "allow_null": False, 1863 "visible": False, 1864 "rename_to": False, 1865 } 1866 1867 1868# https://dev.mysql.com/doc/refman/8.0/en/invisible-indexes.html 1869class AlterIndex(Expression): 1870 arg_types = {"this": True, "visible": True} 1871 1872 1873# https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html 1874class AlterDistStyle(Expression): 1875 pass 1876 1877 1878class AlterSortKey(Expression): 1879 arg_types = {"this": False, "expressions": False, "compound": False} 1880 1881 1882class AlterSet(Expression): 1883 arg_types = { 1884 "expressions": False, 1885 "option": False, 1886 "tablespace": False, 1887 "access_method": False, 1888 "file_format": False, 1889 "copy_options": False, 1890 "tag": False, 1891 "location": False, 1892 "serde": False, 1893 } 1894 1895 1896class RenameColumn(Expression): 1897 arg_types = {"this": True, "to": True, "exists": False} 1898 1899 1900class AlterRename(Expression): 1901 pass 1902 1903 1904class SwapTable(Expression): 1905 pass 1906 1907 1908class Comment(Expression): 1909 arg_types = { 1910 "this": True, 1911 "kind": True, 1912 "expression": True, 1913 "exists": False, 1914 "materialized": False, 1915 } 1916 1917 1918class Comprehension(Expression): 1919 arg_types = { 1920 "this": True, 1921 "expression": True, 1922 "position": False, 1923 "iterator": True, 1924 "condition": False, 1925 } 1926 1927 1928# https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree#mergetree-table-ttl 1929class MergeTreeTTLAction(Expression): 1930 arg_types = { 1931 "this": True, 1932 "delete": False, 1933 "recompress": False, 1934 "to_disk": False, 1935 "to_volume": False, 1936 } 1937 1938 1939# https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree#mergetree-table-ttl 1940class MergeTreeTTL(Expression): 1941 arg_types = { 1942 "expressions": True, 1943 "where": False, 1944 "group": False, 1945 "aggregates": False, 1946 } 1947 1948 1949# https://dev.mysql.com/doc/refman/8.0/en/create-table.html 1950class IndexConstraintOption(Expression): 1951 arg_types = { 1952 "key_block_size": False, 1953 "using": False, 1954 "parser": False, 1955 "comment": False, 1956 "visible": False, 1957 "engine_attr": False, 1958 "secondary_engine_attr": False, 1959 } 1960 1961 1962class ColumnConstraint(Expression): 1963 arg_types = {"this": False, "kind": True} 1964 1965 @property 1966 def kind(self) -> ColumnConstraintKind: 1967 return self.args["kind"] 1968 1969 1970class ColumnConstraintKind(Expression): 1971 pass 1972 1973 1974class AutoIncrementColumnConstraint(ColumnConstraintKind): 1975 pass 1976 1977 1978class ZeroFillColumnConstraint(ColumnConstraint): 1979 arg_types = {} 1980 1981 1982class PeriodForSystemTimeConstraint(ColumnConstraintKind): 1983 arg_types = {"this": True, "expression": True} 1984 1985 1986class CaseSpecificColumnConstraint(ColumnConstraintKind): 1987 arg_types = {"not_": True} 1988 1989 1990class CharacterSetColumnConstraint(ColumnConstraintKind): 1991 arg_types = {"this": True} 1992 1993 1994class CheckColumnConstraint(ColumnConstraintKind): 1995 arg_types = {"this": True, "enforced": False} 1996 1997 1998class ClusteredColumnConstraint(ColumnConstraintKind): 1999 pass 2000 2001 2002class CollateColumnConstraint(ColumnConstraintKind): 2003 pass 2004 2005 2006class CommentColumnConstraint(ColumnConstraintKind): 2007 pass 2008 2009 2010class CompressColumnConstraint(ColumnConstraintKind): 2011 arg_types = {"this": False} 2012 2013 2014class DateFormatColumnConstraint(ColumnConstraintKind): 2015 arg_types = {"this": True} 2016 2017 2018class DefaultColumnConstraint(ColumnConstraintKind): 2019 pass 2020 2021 2022class EncodeColumnConstraint(ColumnConstraintKind): 2023 pass 2024 2025 2026# https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-EXCLUDE 2027class ExcludeColumnConstraint(ColumnConstraintKind): 2028 pass 2029 2030 2031class EphemeralColumnConstraint(ColumnConstraintKind): 2032 arg_types = {"this": False} 2033 2034 2035class WithOperator(Expression): 2036 arg_types = {"this": True, "op": True} 2037 2038 2039class GeneratedAsIdentityColumnConstraint(ColumnConstraintKind): 2040 # this: True -> ALWAYS, this: False -> BY DEFAULT 2041 arg_types = { 2042 "this": False, 2043 "expression": False, 2044 "on_null": False, 2045 "start": False, 2046 "increment": False, 2047 "minvalue": False, 2048 "maxvalue": False, 2049 "cycle": False, 2050 "order": False, 2051 } 2052 2053 2054class GeneratedAsRowColumnConstraint(ColumnConstraintKind): 2055 arg_types = {"start": False, "hidden": False} 2056 2057 2058# https://dev.mysql.com/doc/refman/8.0/en/create-table.html 2059# https://github.com/ClickHouse/ClickHouse/blob/master/src/Parsers/ParserCreateQuery.h#L646 2060class IndexColumnConstraint(ColumnConstraintKind): 2061 arg_types = { 2062 "this": False, 2063 "expressions": False, 2064 "kind": False, 2065 "index_type": False, 2066 "options": False, 2067 "expression": False, # Clickhouse 2068 "granularity": False, 2069 } 2070 2071 2072class InlineLengthColumnConstraint(ColumnConstraintKind): 2073 pass 2074 2075 2076class NonClusteredColumnConstraint(ColumnConstraintKind): 2077 pass 2078 2079 2080class NotForReplicationColumnConstraint(ColumnConstraintKind): 2081 arg_types = {} 2082 2083 2084# https://docs.snowflake.com/en/sql-reference/sql/create-table 2085class MaskingPolicyColumnConstraint(ColumnConstraintKind): 2086 arg_types = {"this": True, "expressions": False} 2087 2088 2089class NotNullColumnConstraint(ColumnConstraintKind): 2090 arg_types = {"allow_null": False} 2091 2092 2093# https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html 2094class OnUpdateColumnConstraint(ColumnConstraintKind): 2095 pass 2096 2097 2098class PrimaryKeyColumnConstraint(ColumnConstraintKind): 2099 arg_types = {"desc": False, "options": False} 2100 2101 2102class TitleColumnConstraint(ColumnConstraintKind): 2103 pass 2104 2105 2106class UniqueColumnConstraint(ColumnConstraintKind): 2107 arg_types = { 2108 "this": False, 2109 "index_type": False, 2110 "on_conflict": False, 2111 "nulls": False, 2112 "options": False, 2113 } 2114 2115 2116class UppercaseColumnConstraint(ColumnConstraintKind): 2117 arg_types: t.Dict[str, t.Any] = {} 2118 2119 2120# https://docs.risingwave.com/processing/watermarks#syntax 2121class WatermarkColumnConstraint(Expression): 2122 arg_types = {"this": True, "expression": True} 2123 2124 2125class PathColumnConstraint(ColumnConstraintKind): 2126 pass 2127 2128 2129# https://docs.snowflake.com/en/sql-reference/sql/create-table 2130class ProjectionPolicyColumnConstraint(ColumnConstraintKind): 2131 pass 2132 2133 2134# computed column expression 2135# https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql?view=sql-server-ver16 2136class ComputedColumnConstraint(ColumnConstraintKind): 2137 arg_types = {"this": True, "persisted": False, "not_null": False, "data_type": False} 2138 2139 2140# https://docs.oracle.com/en/database/other-databases/timesten/22.1/plsql-developer/examples-using-input-and-output-parameters-and-bind-variables.html#GUID-4B20426E-F93F-4835-88CB-6A79829A8D7F 2141class InOutColumnConstraint(ColumnConstraintKind): 2142 arg_types = {"input_": False, "output": False, "variadic": False} 2143 2144 2145class Constraint(Expression): 2146 arg_types = {"this": True, "expressions": True} 2147 2148 2149class Delete(DML): 2150 arg_types = { 2151 "with_": False, 2152 "this": False, 2153 "using": False, 2154 "where": False, 2155 "returning": False, 2156 "order": False, 2157 "limit": False, 2158 "tables": False, # Multiple-Table Syntax (MySQL) 2159 "cluster": False, # Clickhouse 2160 } 2161 2162 def delete( 2163 self, 2164 table: ExpOrStr, 2165 dialect: DialectType = None, 2166 copy: bool = True, 2167 **opts, 2168 ) -> Delete: 2169 """ 2170 Create a DELETE expression or replace the table on an existing DELETE expression. 2171 2172 Example: 2173 >>> delete("tbl").sql() 2174 'DELETE FROM tbl' 2175 2176 Args: 2177 table: the table from which to delete. 2178 dialect: the dialect used to parse the input expression. 2179 copy: if `False`, modify this expression instance in-place. 2180 opts: other options to use to parse the input expressions. 2181 2182 Returns: 2183 Delete: the modified expression. 2184 """ 2185 return _apply_builder( 2186 expression=table, 2187 instance=self, 2188 arg="this", 2189 dialect=dialect, 2190 into=Table, 2191 copy=copy, 2192 **opts, 2193 ) 2194 2195 def where( 2196 self, 2197 *expressions: t.Optional[ExpOrStr], 2198 append: bool = True, 2199 dialect: DialectType = None, 2200 copy: bool = True, 2201 **opts, 2202 ) -> Delete: 2203 """ 2204 Append to or set the WHERE expressions. 2205 2206 Example: 2207 >>> delete("tbl").where("x = 'a' OR x < 'b'").sql() 2208 "DELETE FROM tbl WHERE x = 'a' OR x < 'b'" 2209 2210 Args: 2211 *expressions: the SQL code strings to parse. 2212 If an `Expression` instance is passed, it will be used as-is. 2213 Multiple expressions are combined with an AND operator. 2214 append: if `True`, AND the new expressions to any existing expression. 2215 Otherwise, this resets the expression. 2216 dialect: the dialect used to parse the input expressions. 2217 copy: if `False`, modify this expression instance in-place. 2218 opts: other options to use to parse the input expressions. 2219 2220 Returns: 2221 Delete: the modified expression. 2222 """ 2223 return _apply_conjunction_builder( 2224 *expressions, 2225 instance=self, 2226 arg="where", 2227 append=append, 2228 into=Where, 2229 dialect=dialect, 2230 copy=copy, 2231 **opts, 2232 ) 2233 2234 2235class Drop(Expression): 2236 arg_types = { 2237 "this": False, 2238 "kind": False, 2239 "expressions": False, 2240 "exists": False, 2241 "temporary": False, 2242 "materialized": False, 2243 "cascade": False, 2244 "constraints": False, 2245 "purge": False, 2246 "cluster": False, 2247 "concurrently": False, 2248 } 2249 2250 @property 2251 def kind(self) -> t.Optional[str]: 2252 kind = self.args.get("kind") 2253 return kind and kind.upper() 2254 2255 2256# https://cloud.google.com/bigquery/docs/reference/standard-sql/export-statements 2257class Export(Expression): 2258 arg_types = {"this": True, "connection": False, "options": True} 2259 2260 2261class Filter(Expression): 2262 arg_types = {"this": True, "expression": True} 2263 2264 2265class Check(Expression): 2266 pass 2267 2268 2269class Changes(Expression): 2270 arg_types = {"information": True, "at_before": False, "end": False} 2271 2272 2273# https://docs.snowflake.com/en/sql-reference/constructs/connect-by 2274class Connect(Expression): 2275 arg_types = {"start": False, "connect": True, "nocycle": False} 2276 2277 2278class CopyParameter(Expression): 2279 arg_types = {"this": True, "expression": False, "expressions": False} 2280 2281 2282class Copy(DML): 2283 arg_types = { 2284 "this": True, 2285 "kind": True, 2286 "files": False, 2287 "credentials": False, 2288 "format": False, 2289 "params": False, 2290 } 2291 2292 2293class Credentials(Expression): 2294 arg_types = { 2295 "credentials": False, 2296 "encryption": False, 2297 "storage": False, 2298 "iam_role": False, 2299 "region": False, 2300 } 2301 2302 2303class Prior(Expression): 2304 pass 2305 2306 2307class Directory(Expression): 2308 arg_types = {"this": True, "local": False, "row_format": False} 2309 2310 2311# https://docs.snowflake.com/en/user-guide/data-load-dirtables-query 2312class DirectoryStage(Expression): 2313 pass 2314 2315 2316class ForeignKey(Expression): 2317 arg_types = { 2318 "expressions": False, 2319 "reference": False, 2320 "delete": False, 2321 "update": False, 2322 "options": False, 2323 } 2324 2325 2326class ColumnPrefix(Expression): 2327 arg_types = {"this": True, "expression": True} 2328 2329 2330class PrimaryKey(Expression): 2331 arg_types = {"this": False, "expressions": True, "options": False, "include": False} 2332 2333 2334# https://www.postgresql.org/docs/9.1/sql-selectinto.html 2335# https://docs.aws.amazon.com/redshift/latest/dg/r_SELECT_INTO.html#r_SELECT_INTO-examples 2336class Into(Expression): 2337 arg_types = { 2338 "this": False, 2339 "temporary": False, 2340 "unlogged": False, 2341 "bulk_collect": False, 2342 "expressions": False, 2343 } 2344 2345 2346class From(Expression): 2347 @property 2348 def name(self) -> str: 2349 return self.this.name 2350 2351 @property 2352 def alias_or_name(self) -> str: 2353 return self.this.alias_or_name 2354 2355 2356class Having(Expression): 2357 pass 2358 2359 2360class Hint(Expression): 2361 arg_types = {"expressions": True} 2362 2363 2364class JoinHint(Expression): 2365 arg_types = {"this": True, "expressions": True} 2366 2367 2368class Identifier(Expression): 2369 arg_types = {"this": True, "quoted": False, "global_": False, "temporary": False} 2370 2371 @property 2372 def quoted(self) -> bool: 2373 return bool(self.args.get("quoted")) 2374 2375 @property 2376 def output_name(self) -> str: 2377 return self.name 2378 2379 2380# https://www.postgresql.org/docs/current/indexes-opclass.html 2381class Opclass(Expression): 2382 arg_types = {"this": True, "expression": True} 2383 2384 2385class Index(Expression): 2386 arg_types = { 2387 "this": False, 2388 "table": False, 2389 "unique": False, 2390 "primary": False, 2391 "amp": False, # teradata 2392 "params": False, 2393 } 2394 2395 2396class IndexParameters(Expression): 2397 arg_types = { 2398 "using": False, 2399 "include": False, 2400 "columns": False, 2401 "with_storage": False, 2402 "partition_by": False, 2403 "tablespace": False, 2404 "where": False, 2405 "on": False, 2406 } 2407 2408 2409class Insert(DDL, DML): 2410 arg_types = { 2411 "hint": False, 2412 "with_": False, 2413 "is_function": False, 2414 "this": False, 2415 "expression": False, 2416 "conflict": False, 2417 "returning": False, 2418 "overwrite": False, 2419 "exists": False, 2420 "alternative": False, 2421 "where": False, 2422 "ignore": False, 2423 "by_name": False, 2424 "stored": False, 2425 "partition": False, 2426 "settings": False, 2427 "source": False, 2428 "default": False, 2429 } 2430 2431 def with_( 2432 self, 2433 alias: ExpOrStr, 2434 as_: ExpOrStr, 2435 recursive: t.Optional[bool] = None, 2436 materialized: t.Optional[bool] = None, 2437 append: bool = True, 2438 dialect: DialectType = None, 2439 copy: bool = True, 2440 **opts, 2441 ) -> Insert: 2442 """ 2443 Append to or set the common table expressions. 2444 2445 Example: 2446 >>> insert("SELECT x FROM cte", "t").with_("cte", as_="SELECT * FROM tbl").sql() 2447 'WITH cte AS (SELECT * FROM tbl) INSERT INTO t SELECT x FROM cte' 2448 2449 Args: 2450 alias: the SQL code string to parse as the table name. 2451 If an `Expression` instance is passed, this is used as-is. 2452 as_: the SQL code string to parse as the table expression. 2453 If an `Expression` instance is passed, it will be used as-is. 2454 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 2455 materialized: set the MATERIALIZED part of the expression. 2456 append: if `True`, add to any existing expressions. 2457 Otherwise, this resets the expressions. 2458 dialect: the dialect used to parse the input expression. 2459 copy: if `False`, modify this expression instance in-place. 2460 opts: other options to use to parse the input expressions. 2461 2462 Returns: 2463 The modified expression. 2464 """ 2465 return _apply_cte_builder( 2466 self, 2467 alias, 2468 as_, 2469 recursive=recursive, 2470 materialized=materialized, 2471 append=append, 2472 dialect=dialect, 2473 copy=copy, 2474 **opts, 2475 ) 2476 2477 2478class ConditionalInsert(Expression): 2479 arg_types = {"this": True, "expression": False, "else_": False} 2480 2481 2482class MultitableInserts(Expression): 2483 arg_types = {"expressions": True, "kind": True, "source": True} 2484 2485 2486class OnConflict(Expression): 2487 arg_types = { 2488 "duplicate": False, 2489 "expressions": False, 2490 "action": False, 2491 "conflict_keys": False, 2492 "index_predicate": False, 2493 "constraint": False, 2494 "where": False, 2495 } 2496 2497 2498class OnCondition(Expression): 2499 arg_types = {"error": False, "empty": False, "null": False} 2500 2501 2502class Returning(Expression): 2503 arg_types = {"expressions": True, "into": False} 2504 2505 2506# https://dev.mysql.com/doc/refman/8.0/en/charset-introducer.html 2507class Introducer(Expression): 2508 arg_types = {"this": True, "expression": True} 2509 2510 2511# national char, like n'utf8' 2512class National(Expression): 2513 pass 2514 2515 2516class LoadData(Expression): 2517 arg_types = { 2518 "this": True, 2519 "local": False, 2520 "overwrite": False, 2521 "inpath": True, 2522 "partition": False, 2523 "input_format": False, 2524 "serde": False, 2525 } 2526 2527 2528class Partition(Expression): 2529 arg_types = {"expressions": True, "subpartition": False} 2530 2531 2532class PartitionRange(Expression): 2533 arg_types = {"this": True, "expression": False, "expressions": False} 2534 2535 2536# https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#how-to-set-partition-expression 2537class PartitionId(Expression): 2538 pass 2539 2540 2541class Fetch(Expression): 2542 arg_types = { 2543 "direction": False, 2544 "count": False, 2545 "limit_options": False, 2546 } 2547 2548 2549class Grant(Expression): 2550 arg_types = { 2551 "privileges": True, 2552 "kind": False, 2553 "securable": True, 2554 "principals": True, 2555 "grant_option": False, 2556 } 2557 2558 2559class Revoke(Expression): 2560 arg_types = {**Grant.arg_types, "cascade": False} 2561 2562 2563class Group(Expression): 2564 arg_types = { 2565 "expressions": False, 2566 "grouping_sets": False, 2567 "cube": False, 2568 "rollup": False, 2569 "totals": False, 2570 "all": False, 2571 } 2572 2573 2574class Cube(Expression): 2575 arg_types = {"expressions": False} 2576 2577 2578class Rollup(Expression): 2579 arg_types = {"expressions": False} 2580 2581 2582class GroupingSets(Expression): 2583 arg_types = {"expressions": True} 2584 2585 2586class Lambda(Expression): 2587 arg_types = {"this": True, "expressions": True, "colon": False} 2588 2589 2590class Limit(Expression): 2591 arg_types = { 2592 "this": False, 2593 "expression": True, 2594 "offset": False, 2595 "limit_options": False, 2596 "expressions": False, 2597 } 2598 2599 2600class LimitOptions(Expression): 2601 arg_types = { 2602 "percent": False, 2603 "rows": False, 2604 "with_ties": False, 2605 } 2606 2607 2608class Literal(Condition): 2609 arg_types = {"this": True, "is_string": True} 2610 2611 @classmethod 2612 def number(cls, number) -> Literal | Neg: 2613 expr: Literal | Neg = cls(this=str(number), is_string=False) 2614 2615 try: 2616 to_py = expr.to_py() 2617 2618 if not isinstance(to_py, str) and to_py < 0: 2619 expr.set("this", str(abs(to_py))) 2620 expr = Neg(this=expr) 2621 except Exception: 2622 pass 2623 2624 return expr 2625 2626 @classmethod 2627 def string(cls, string) -> Literal: 2628 return cls(this=str(string), is_string=True) 2629 2630 @property 2631 def output_name(self) -> str: 2632 return self.name 2633 2634 def to_py(self) -> int | str | Decimal: 2635 if self.is_number: 2636 try: 2637 return int(self.this) 2638 except ValueError: 2639 return Decimal(self.this) 2640 return self.this 2641 2642 2643class Join(Expression): 2644 arg_types = { 2645 "this": True, 2646 "on": False, 2647 "side": False, 2648 "kind": False, 2649 "using": False, 2650 "method": False, 2651 "global_": False, 2652 "hint": False, 2653 "match_condition": False, # Snowflake 2654 "directed": False, # Snowflake 2655 "expressions": False, 2656 "pivots": False, 2657 } 2658 2659 @property 2660 def method(self) -> str: 2661 return self.text("method").upper() 2662 2663 @property 2664 def kind(self) -> str: 2665 return self.text("kind").upper() 2666 2667 @property 2668 def side(self) -> str: 2669 return self.text("side").upper() 2670 2671 @property 2672 def hint(self) -> str: 2673 return self.text("hint").upper() 2674 2675 @property 2676 def alias_or_name(self) -> str: 2677 return self.this.alias_or_name 2678 2679 @property 2680 def is_semi_or_anti_join(self) -> bool: 2681 return self.kind in ("SEMI", "ANTI") 2682 2683 def on( 2684 self, 2685 *expressions: t.Optional[ExpOrStr], 2686 append: bool = True, 2687 dialect: DialectType = None, 2688 copy: bool = True, 2689 **opts, 2690 ) -> Join: 2691 """ 2692 Append to or set the ON expressions. 2693 2694 Example: 2695 >>> import sqlglot 2696 >>> sqlglot.parse_one("JOIN x", into=Join).on("y = 1").sql() 2697 'JOIN x ON y = 1' 2698 2699 Args: 2700 *expressions: the SQL code strings to parse. 2701 If an `Expression` instance is passed, it will be used as-is. 2702 Multiple expressions are combined with an AND operator. 2703 append: if `True`, AND the new expressions to any existing expression. 2704 Otherwise, this resets the expression. 2705 dialect: the dialect used to parse the input expressions. 2706 copy: if `False`, modify this expression instance in-place. 2707 opts: other options to use to parse the input expressions. 2708 2709 Returns: 2710 The modified Join expression. 2711 """ 2712 join = _apply_conjunction_builder( 2713 *expressions, 2714 instance=self, 2715 arg="on", 2716 append=append, 2717 dialect=dialect, 2718 copy=copy, 2719 **opts, 2720 ) 2721 2722 if join.kind == "CROSS": 2723 join.set("kind", None) 2724 2725 return join 2726 2727 def using( 2728 self, 2729 *expressions: t.Optional[ExpOrStr], 2730 append: bool = True, 2731 dialect: DialectType = None, 2732 copy: bool = True, 2733 **opts, 2734 ) -> Join: 2735 """ 2736 Append to or set the USING expressions. 2737 2738 Example: 2739 >>> import sqlglot 2740 >>> sqlglot.parse_one("JOIN x", into=Join).using("foo", "bla").sql() 2741 'JOIN x USING (foo, bla)' 2742 2743 Args: 2744 *expressions: the SQL code strings to parse. 2745 If an `Expression` instance is passed, it will be used as-is. 2746 append: if `True`, concatenate the new expressions to the existing "using" list. 2747 Otherwise, this resets the expression. 2748 dialect: the dialect used to parse the input expressions. 2749 copy: if `False`, modify this expression instance in-place. 2750 opts: other options to use to parse the input expressions. 2751 2752 Returns: 2753 The modified Join expression. 2754 """ 2755 join = _apply_list_builder( 2756 *expressions, 2757 instance=self, 2758 arg="using", 2759 append=append, 2760 dialect=dialect, 2761 copy=copy, 2762 **opts, 2763 ) 2764 2765 if join.kind == "CROSS": 2766 join.set("kind", None) 2767 2768 return join 2769 2770 2771class Lateral(UDTF): 2772 arg_types = { 2773 "this": True, 2774 "view": False, 2775 "outer": False, 2776 "alias": False, 2777 "cross_apply": False, # True -> CROSS APPLY, False -> OUTER APPLY 2778 "ordinality": False, 2779 } 2780 2781 2782# https://docs.snowflake.com/sql-reference/literals-table 2783# https://docs.snowflake.com/en/sql-reference/functions-table#using-a-table-function 2784class TableFromRows(UDTF): 2785 arg_types = { 2786 "this": True, 2787 "alias": False, 2788 "joins": False, 2789 "pivots": False, 2790 "sample": False, 2791 } 2792 2793 2794class MatchRecognizeMeasure(Expression): 2795 arg_types = { 2796 "this": True, 2797 "window_frame": False, 2798 } 2799 2800 2801class MatchRecognize(Expression): 2802 arg_types = { 2803 "partition_by": False, 2804 "order": False, 2805 "measures": False, 2806 "rows": False, 2807 "after": False, 2808 "pattern": False, 2809 "define": False, 2810 "alias": False, 2811 } 2812 2813 2814# Clickhouse FROM FINAL modifier 2815# https://clickhouse.com/docs/en/sql-reference/statements/select/from/#final-modifier 2816class Final(Expression): 2817 pass 2818 2819 2820class Offset(Expression): 2821 arg_types = {"this": False, "expression": True, "expressions": False} 2822 2823 2824class Order(Expression): 2825 arg_types = {"this": False, "expressions": True, "siblings": False} 2826 2827 2828# https://clickhouse.com/docs/en/sql-reference/statements/select/order-by#order-by-expr-with-fill-modifier 2829class WithFill(Expression): 2830 arg_types = { 2831 "from_": False, 2832 "to": False, 2833 "step": False, 2834 "interpolate": False, 2835 } 2836 2837 2838# hive specific sorts 2839# https://cwiki.apache.org/confluence/display/Hive/LanguageManual+SortBy 2840class Cluster(Order): 2841 pass 2842 2843 2844class Distribute(Order): 2845 pass 2846 2847 2848class Sort(Order): 2849 pass 2850 2851 2852class Ordered(Expression): 2853 arg_types = {"this": True, "desc": False, "nulls_first": True, "with_fill": False} 2854 2855 @property 2856 def name(self) -> str: 2857 return self.this.name 2858 2859 2860class Property(Expression): 2861 arg_types = {"this": True, "value": True} 2862 2863 2864class GrantPrivilege(Expression): 2865 arg_types = {"this": True, "expressions": False} 2866 2867 2868class GrantPrincipal(Expression): 2869 arg_types = {"this": True, "kind": False} 2870 2871 2872class AllowedValuesProperty(Expression): 2873 arg_types = {"expressions": True} 2874 2875 2876class AlgorithmProperty(Property): 2877 arg_types = {"this": True} 2878 2879 2880class AutoIncrementProperty(Property): 2881 arg_types = {"this": True} 2882 2883 2884# https://docs.aws.amazon.com/prescriptive-guidance/latest/materialized-views-redshift/refreshing-materialized-views.html 2885class AutoRefreshProperty(Property): 2886 arg_types = {"this": True} 2887 2888 2889class BackupProperty(Property): 2890 arg_types = {"this": True} 2891 2892 2893# https://doris.apache.org/docs/sql-manual/sql-statements/table-and-view/async-materialized-view/CREATE-ASYNC-MATERIALIZED-VIEW/ 2894class BuildProperty(Property): 2895 arg_types = {"this": True} 2896 2897 2898class BlockCompressionProperty(Property): 2899 arg_types = { 2900 "autotemp": False, 2901 "always": False, 2902 "default": False, 2903 "manual": False, 2904 "never": False, 2905 } 2906 2907 2908class CharacterSetProperty(Property): 2909 arg_types = {"this": True, "default": True} 2910 2911 2912class ChecksumProperty(Property): 2913 arg_types = {"on": False, "default": False} 2914 2915 2916class CollateProperty(Property): 2917 arg_types = {"this": True, "default": False} 2918 2919 2920class CopyGrantsProperty(Property): 2921 arg_types = {} 2922 2923 2924class DataBlocksizeProperty(Property): 2925 arg_types = { 2926 "size": False, 2927 "units": False, 2928 "minimum": False, 2929 "maximum": False, 2930 "default": False, 2931 } 2932 2933 2934class DataDeletionProperty(Property): 2935 arg_types = {"on": True, "filter_column": False, "retention_period": False} 2936 2937 2938class DefinerProperty(Property): 2939 arg_types = {"this": True} 2940 2941 2942class DistKeyProperty(Property): 2943 arg_types = {"this": True} 2944 2945 2946# https://docs.starrocks.io/docs/sql-reference/sql-statements/data-definition/CREATE_TABLE/#distribution_desc 2947# https://doris.apache.org/docs/sql-manual/sql-statements/Data-Definition-Statements/Create/CREATE-TABLE?_highlight=create&_highlight=table#distribution_desc 2948class DistributedByProperty(Property): 2949 arg_types = {"expressions": False, "kind": True, "buckets": False, "order": False} 2950 2951 2952class DistStyleProperty(Property): 2953 arg_types = {"this": True} 2954 2955 2956class DuplicateKeyProperty(Property): 2957 arg_types = {"expressions": True} 2958 2959 2960class EngineProperty(Property): 2961 arg_types = {"this": True} 2962 2963 2964class HeapProperty(Property): 2965 arg_types = {} 2966 2967 2968class ToTableProperty(Property): 2969 arg_types = {"this": True} 2970 2971 2972class ExecuteAsProperty(Property): 2973 arg_types = {"this": True} 2974 2975 2976class ExternalProperty(Property): 2977 arg_types = {"this": False} 2978 2979 2980class FallbackProperty(Property): 2981 arg_types = {"no": True, "protection": False} 2982 2983 2984# https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table-hiveformat 2985class FileFormatProperty(Property): 2986 arg_types = {"this": False, "expressions": False, "hive_format": False} 2987 2988 2989class CredentialsProperty(Property): 2990 arg_types = {"expressions": True} 2991 2992 2993class FreespaceProperty(Property): 2994 arg_types = {"this": True, "percent": False} 2995 2996 2997class GlobalProperty(Property): 2998 arg_types = {} 2999 3000 3001class IcebergProperty(Property): 3002 arg_types = {} 3003 3004 3005class InheritsProperty(Property): 3006 arg_types = {"expressions": True} 3007 3008 3009class InputModelProperty(Property): 3010 arg_types = {"this": True} 3011 3012 3013class OutputModelProperty(Property): 3014 arg_types = {"this": True} 3015 3016 3017class IsolatedLoadingProperty(Property): 3018 arg_types = {"no": False, "concurrent": False, "target": False} 3019 3020 3021class JournalProperty(Property): 3022 arg_types = { 3023 "no": False, 3024 "dual": False, 3025 "before": False, 3026 "local": False, 3027 "after": False, 3028 } 3029 3030 3031class LanguageProperty(Property): 3032 arg_types = {"this": True} 3033 3034 3035class EnviromentProperty(Property): 3036 arg_types = {"expressions": True} 3037 3038 3039# spark ddl 3040class ClusteredByProperty(Property): 3041 arg_types = {"expressions": True, "sorted_by": False, "buckets": True} 3042 3043 3044class DictProperty(Property): 3045 arg_types = {"this": True, "kind": True, "settings": False} 3046 3047 3048class DictSubProperty(Property): 3049 pass 3050 3051 3052class DictRange(Property): 3053 arg_types = {"this": True, "min": True, "max": True} 3054 3055 3056class DynamicProperty(Property): 3057 arg_types = {} 3058 3059 3060# Clickhouse CREATE ... ON CLUSTER modifier 3061# https://clickhouse.com/docs/en/sql-reference/distributed-ddl 3062class OnCluster(Property): 3063 arg_types = {"this": True} 3064 3065 3066# Clickhouse EMPTY table "property" 3067class EmptyProperty(Property): 3068 arg_types = {} 3069 3070 3071class LikeProperty(Property): 3072 arg_types = {"this": True, "expressions": False} 3073 3074 3075class LocationProperty(Property): 3076 arg_types = {"this": True} 3077 3078 3079class LockProperty(Property): 3080 arg_types = {"this": True} 3081 3082 3083class LockingProperty(Property): 3084 arg_types = { 3085 "this": False, 3086 "kind": True, 3087 "for_or_in": False, 3088 "lock_type": True, 3089 "override": False, 3090 } 3091 3092 3093class LogProperty(Property): 3094 arg_types = {"no": True} 3095 3096 3097class MaterializedProperty(Property): 3098 arg_types = {"this": False} 3099 3100 3101class MergeBlockRatioProperty(Property): 3102 arg_types = {"this": False, "no": False, "default": False, "percent": False} 3103 3104 3105class NoPrimaryIndexProperty(Property): 3106 arg_types = {} 3107 3108 3109class OnProperty(Property): 3110 arg_types = {"this": True} 3111 3112 3113class OnCommitProperty(Property): 3114 arg_types = {"delete": False} 3115 3116 3117class PartitionedByProperty(Property): 3118 arg_types = {"this": True} 3119 3120 3121class PartitionedByBucket(Property): 3122 arg_types = {"this": True, "expression": True} 3123 3124 3125class PartitionByTruncate(Property): 3126 arg_types = {"this": True, "expression": True} 3127 3128 3129# https://docs.starrocks.io/docs/sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE/ 3130class PartitionByRangeProperty(Property): 3131 arg_types = {"partition_expressions": True, "create_expressions": True} 3132 3133 3134# https://docs.starrocks.io/docs/table_design/data_distribution/#range-partitioning 3135class PartitionByRangePropertyDynamic(Expression): 3136 arg_types = {"this": False, "start": True, "end": True, "every": True} 3137 3138 3139# https://docs.starrocks.io/docs/sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE/#rollup-index 3140class RollupProperty(Property): 3141 arg_types = {"expressions": True} 3142 3143 3144# https://docs.starrocks.io/docs/sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE/#rollup-index 3145class RollupIndex(Expression): 3146 arg_types = {"this": True, "expressions": True, "from_index": False, "properties": False} 3147 3148 3149# https://doris.apache.org/docs/table-design/data-partitioning/manual-partitioning 3150class PartitionByListProperty(Property): 3151 arg_types = {"partition_expressions": True, "create_expressions": True} 3152 3153 3154# https://doris.apache.org/docs/table-design/data-partitioning/manual-partitioning 3155class PartitionList(Expression): 3156 arg_types = {"this": True, "expressions": True} 3157 3158 3159# https://doris.apache.org/docs/sql-manual/sql-statements/table-and-view/async-materialized-view/CREATE-ASYNC-MATERIALIZED-VIEW 3160class RefreshTriggerProperty(Property): 3161 arg_types = { 3162 "method": False, 3163 "kind": False, 3164 "every": False, 3165 "unit": False, 3166 "starts": False, 3167 } 3168 3169 3170# https://docs.starrocks.io/docs/sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE/ 3171class UniqueKeyProperty(Property): 3172 arg_types = {"expressions": True} 3173 3174 3175# https://www.postgresql.org/docs/current/sql-createtable.html 3176class PartitionBoundSpec(Expression): 3177 # this -> IN / MODULUS, expression -> REMAINDER, from_expressions -> FROM (...), to_expressions -> TO (...) 3178 arg_types = { 3179 "this": False, 3180 "expression": False, 3181 "from_expressions": False, 3182 "to_expressions": False, 3183 } 3184 3185 3186class PartitionedOfProperty(Property): 3187 # this -> parent_table (schema), expression -> FOR VALUES ... / DEFAULT 3188 arg_types = {"this": True, "expression": True} 3189 3190 3191class StreamingTableProperty(Property): 3192 arg_types = {} 3193 3194 3195class RemoteWithConnectionModelProperty(Property): 3196 arg_types = {"this": True} 3197 3198 3199class ReturnsProperty(Property): 3200 arg_types = {"this": False, "is_table": False, "table": False, "null": False} 3201 3202 3203class StrictProperty(Property): 3204 arg_types = {} 3205 3206 3207class RowFormatProperty(Property): 3208 arg_types = {"this": True} 3209 3210 3211class RowFormatDelimitedProperty(Property): 3212 # https://cwiki.apache.org/confluence/display/hive/languagemanual+dml 3213 arg_types = { 3214 "fields": False, 3215 "escaped": False, 3216 "collection_items": False, 3217 "map_keys": False, 3218 "lines": False, 3219 "null": False, 3220 "serde": False, 3221 } 3222 3223 3224class RowFormatSerdeProperty(Property): 3225 arg_types = {"this": True, "serde_properties": False} 3226 3227 3228# https://spark.apache.org/docs/3.1.2/sql-ref-syntax-qry-select-transform.html 3229class QueryTransform(Expression): 3230 arg_types = { 3231 "expressions": True, 3232 "command_script": True, 3233 "schema": False, 3234 "row_format_before": False, 3235 "record_writer": False, 3236 "row_format_after": False, 3237 "record_reader": False, 3238 } 3239 3240 3241class SampleProperty(Property): 3242 arg_types = {"this": True} 3243 3244 3245# https://prestodb.io/docs/current/sql/create-view.html#synopsis 3246class SecurityProperty(Property): 3247 arg_types = {"this": True} 3248 3249 3250class SchemaCommentProperty(Property): 3251 arg_types = {"this": True} 3252 3253 3254class SemanticView(Expression): 3255 arg_types = { 3256 "this": True, 3257 "metrics": False, 3258 "dimensions": False, 3259 "facts": False, 3260 "where": False, 3261 } 3262 3263 3264class SerdeProperties(Property): 3265 arg_types = {"expressions": True, "with_": False} 3266 3267 3268class SetProperty(Property): 3269 arg_types = {"multi": True} 3270 3271 3272class SharingProperty(Property): 3273 arg_types = {"this": False} 3274 3275 3276class SetConfigProperty(Property): 3277 arg_types = {"this": True} 3278 3279 3280class SettingsProperty(Property): 3281 arg_types = {"expressions": True} 3282 3283 3284class SortKeyProperty(Property): 3285 arg_types = {"this": True, "compound": False} 3286 3287 3288class SqlReadWriteProperty(Property): 3289 arg_types = {"this": True} 3290 3291 3292class SqlSecurityProperty(Property): 3293 arg_types = {"this": True} 3294 3295 3296class StabilityProperty(Property): 3297 arg_types = {"this": True} 3298 3299 3300class StorageHandlerProperty(Property): 3301 arg_types = {"this": True} 3302 3303 3304class TemporaryProperty(Property): 3305 arg_types = {"this": False} 3306 3307 3308class SecureProperty(Property): 3309 arg_types = {} 3310 3311 3312# https://docs.snowflake.com/en/sql-reference/sql/create-table 3313class Tags(ColumnConstraintKind, Property): 3314 arg_types = {"expressions": True} 3315 3316 3317class TransformModelProperty(Property): 3318 arg_types = {"expressions": True} 3319 3320 3321class TransientProperty(Property): 3322 arg_types = {"this": False} 3323 3324 3325class UnloggedProperty(Property): 3326 arg_types = {} 3327 3328 3329# https://docs.snowflake.com/en/sql-reference/sql/create-table#create-table-using-template 3330class UsingTemplateProperty(Property): 3331 arg_types = {"this": True} 3332 3333 3334# https://learn.microsoft.com/en-us/sql/t-sql/statements/create-view-transact-sql?view=sql-server-ver16 3335class ViewAttributeProperty(Property): 3336 arg_types = {"this": True} 3337 3338 3339class VolatileProperty(Property): 3340 arg_types = {"this": False} 3341 3342 3343class WithDataProperty(Property): 3344 arg_types = {"no": True, "statistics": False} 3345 3346 3347class WithJournalTableProperty(Property): 3348 arg_types = {"this": True} 3349 3350 3351class WithSchemaBindingProperty(Property): 3352 arg_types = {"this": True} 3353 3354 3355class WithSystemVersioningProperty(Property): 3356 arg_types = { 3357 "on": False, 3358 "this": False, 3359 "data_consistency": False, 3360 "retention_period": False, 3361 "with_": True, 3362 } 3363 3364 3365class WithProcedureOptions(Property): 3366 arg_types = {"expressions": True} 3367 3368 3369class EncodeProperty(Property): 3370 arg_types = {"this": True, "properties": False, "key": False} 3371 3372 3373class IncludeProperty(Property): 3374 arg_types = {"this": True, "alias": False, "column_def": False} 3375 3376 3377class ForceProperty(Property): 3378 arg_types = {} 3379 3380 3381class Properties(Expression): 3382 arg_types = {"expressions": True} 3383 3384 NAME_TO_PROPERTY = { 3385 "ALGORITHM": AlgorithmProperty, 3386 "AUTO_INCREMENT": AutoIncrementProperty, 3387 "CHARACTER SET": CharacterSetProperty, 3388 "CLUSTERED_BY": ClusteredByProperty, 3389 "COLLATE": CollateProperty, 3390 "COMMENT": SchemaCommentProperty, 3391 "CREDENTIALS": CredentialsProperty, 3392 "DEFINER": DefinerProperty, 3393 "DISTKEY": DistKeyProperty, 3394 "DISTRIBUTED_BY": DistributedByProperty, 3395 "DISTSTYLE": DistStyleProperty, 3396 "ENGINE": EngineProperty, 3397 "EXECUTE AS": ExecuteAsProperty, 3398 "FORMAT": FileFormatProperty, 3399 "LANGUAGE": LanguageProperty, 3400 "LOCATION": LocationProperty, 3401 "LOCK": LockProperty, 3402 "PARTITIONED_BY": PartitionedByProperty, 3403 "RETURNS": ReturnsProperty, 3404 "ROW_FORMAT": RowFormatProperty, 3405 "SORTKEY": SortKeyProperty, 3406 "ENCODE": EncodeProperty, 3407 "INCLUDE": IncludeProperty, 3408 } 3409 3410 PROPERTY_TO_NAME = {v: k for k, v in NAME_TO_PROPERTY.items()} 3411 3412 # CREATE property locations 3413 # Form: schema specified 3414 # create [POST_CREATE] 3415 # table a [POST_NAME] 3416 # (b int) [POST_SCHEMA] 3417 # with ([POST_WITH]) 3418 # index (b) [POST_INDEX] 3419 # 3420 # Form: alias selection 3421 # create [POST_CREATE] 3422 # table a [POST_NAME] 3423 # as [POST_ALIAS] (select * from b) [POST_EXPRESSION] 3424 # index (c) [POST_INDEX] 3425 class Location(AutoName): 3426 POST_CREATE = auto() 3427 POST_NAME = auto() 3428 POST_SCHEMA = auto() 3429 POST_WITH = auto() 3430 POST_ALIAS = auto() 3431 POST_EXPRESSION = auto() 3432 POST_INDEX = auto() 3433 UNSUPPORTED = auto() 3434 3435 @classmethod 3436 def from_dict(cls, properties_dict: t.Dict) -> Properties: 3437 expressions = [] 3438 for key, value in properties_dict.items(): 3439 property_cls = cls.NAME_TO_PROPERTY.get(key.upper()) 3440 if property_cls: 3441 expressions.append(property_cls(this=convert(value))) 3442 else: 3443 expressions.append(Property(this=Literal.string(key), value=convert(value))) 3444 3445 return cls(expressions=expressions) 3446 3447 3448class Qualify(Expression): 3449 pass 3450 3451 3452class InputOutputFormat(Expression): 3453 arg_types = {"input_format": False, "output_format": False} 3454 3455 3456# https://www.ibm.com/docs/en/ias?topic=procedures-return-statement-in-sql 3457class Return(Expression): 3458 pass 3459 3460 3461class Reference(Expression): 3462 arg_types = {"this": True, "expressions": False, "options": False} 3463 3464 3465class Tuple(Expression): 3466 arg_types = {"expressions": False} 3467 3468 def isin( 3469 self, 3470 *expressions: t.Any, 3471 query: t.Optional[ExpOrStr] = None, 3472 unnest: t.Optional[ExpOrStr] | t.Collection[ExpOrStr] = None, 3473 copy: bool = True, 3474 **opts, 3475 ) -> In: 3476 return In( 3477 this=maybe_copy(self, copy), 3478 expressions=[convert(e, copy=copy) for e in expressions], 3479 query=maybe_parse(query, copy=copy, **opts) if query else None, 3480 unnest=( 3481 Unnest( 3482 expressions=[ 3483 maybe_parse(t.cast(ExpOrStr, e), copy=copy, **opts) 3484 for e in ensure_list(unnest) 3485 ] 3486 ) 3487 if unnest 3488 else None 3489 ), 3490 ) 3491 3492 3493QUERY_MODIFIERS = { 3494 "match": False, 3495 "laterals": False, 3496 "joins": False, 3497 "connect": False, 3498 "pivots": False, 3499 "prewhere": False, 3500 "where": False, 3501 "group": False, 3502 "having": False, 3503 "qualify": False, 3504 "windows": False, 3505 "distribute": False, 3506 "sort": False, 3507 "cluster": False, 3508 "order": False, 3509 "limit": False, 3510 "offset": False, 3511 "locks": False, 3512 "sample": False, 3513 "settings": False, 3514 "format": False, 3515 "options": False, 3516} 3517 3518 3519# https://learn.microsoft.com/en-us/sql/t-sql/queries/option-clause-transact-sql?view=sql-server-ver16 3520# https://learn.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-query?view=sql-server-ver16 3521class QueryOption(Expression): 3522 arg_types = {"this": True, "expression": False} 3523 3524 3525# https://learn.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-table?view=sql-server-ver16 3526class WithTableHint(Expression): 3527 arg_types = {"expressions": True} 3528 3529 3530# https://dev.mysql.com/doc/refman/8.0/en/index-hints.html 3531class IndexTableHint(Expression): 3532 arg_types = {"this": True, "expressions": False, "target": False} 3533 3534 3535# https://docs.snowflake.com/en/sql-reference/constructs/at-before 3536class HistoricalData(Expression): 3537 arg_types = {"this": True, "kind": True, "expression": True} 3538 3539 3540# https://docs.snowflake.com/en/sql-reference/sql/put 3541class Put(Expression): 3542 arg_types = {"this": True, "target": True, "properties": False} 3543 3544 3545# https://docs.snowflake.com/en/sql-reference/sql/get 3546class Get(Expression): 3547 arg_types = {"this": True, "target": True, "properties": False} 3548 3549 3550class Table(Expression): 3551 arg_types = { 3552 "this": False, 3553 "alias": False, 3554 "db": False, 3555 "catalog": False, 3556 "laterals": False, 3557 "joins": False, 3558 "pivots": False, 3559 "hints": False, 3560 "system_time": False, 3561 "version": False, 3562 "format": False, 3563 "pattern": False, 3564 "ordinality": False, 3565 "when": False, 3566 "only": False, 3567 "partition": False, 3568 "changes": False, 3569 "rows_from": False, 3570 "sample": False, 3571 "indexed": False, 3572 } 3573 3574 @property 3575 def name(self) -> str: 3576 if not self.this or isinstance(self.this, Func): 3577 return "" 3578 return self.this.name 3579 3580 @property 3581 def db(self) -> str: 3582 return self.text("db") 3583 3584 @property 3585 def catalog(self) -> str: 3586 return self.text("catalog") 3587 3588 @property 3589 def selects(self) -> t.List[Expression]: 3590 return [] 3591 3592 @property 3593 def named_selects(self) -> t.List[str]: 3594 return [] 3595 3596 @property 3597 def parts(self) -> t.List[Expression]: 3598 """Return the parts of a table in order catalog, db, table.""" 3599 parts: t.List[Expression] = [] 3600 3601 for arg in ("catalog", "db", "this"): 3602 part = self.args.get(arg) 3603 3604 if isinstance(part, Dot): 3605 parts.extend(part.flatten()) 3606 elif isinstance(part, Expression): 3607 parts.append(part) 3608 3609 return parts 3610 3611 def to_column(self, copy: bool = True) -> Expression: 3612 parts = self.parts 3613 last_part = parts[-1] 3614 3615 if isinstance(last_part, Identifier): 3616 col: Expression = column(*reversed(parts[0:4]), fields=parts[4:], copy=copy) # type: ignore 3617 else: 3618 # This branch will be reached if a function or array is wrapped in a `Table` 3619 col = last_part 3620 3621 alias = self.args.get("alias") 3622 if alias: 3623 col = alias_(col, alias.this, copy=copy) 3624 3625 return col 3626 3627 3628class SetOperation(Query): 3629 arg_types = { 3630 "with_": False, 3631 "this": True, 3632 "expression": True, 3633 "distinct": False, 3634 "by_name": False, 3635 "side": False, 3636 "kind": False, 3637 "on": False, 3638 **QUERY_MODIFIERS, 3639 } 3640 3641 def select( 3642 self: S, 3643 *expressions: t.Optional[ExpOrStr], 3644 append: bool = True, 3645 dialect: DialectType = None, 3646 copy: bool = True, 3647 **opts, 3648 ) -> S: 3649 this = maybe_copy(self, copy) 3650 this.this.unnest().select(*expressions, append=append, dialect=dialect, copy=False, **opts) 3651 this.expression.unnest().select( 3652 *expressions, append=append, dialect=dialect, copy=False, **opts 3653 ) 3654 return this 3655 3656 @property 3657 def named_selects(self) -> t.List[str]: 3658 expression = self 3659 while isinstance(expression, SetOperation): 3660 expression = expression.this.unnest() 3661 return expression.named_selects 3662 3663 @property 3664 def is_star(self) -> bool: 3665 return self.this.is_star or self.expression.is_star 3666 3667 @property 3668 def selects(self) -> t.List[Expression]: 3669 expression = self 3670 while isinstance(expression, SetOperation): 3671 expression = expression.this.unnest() 3672 return expression.selects 3673 3674 @property 3675 def left(self) -> Query: 3676 return self.this 3677 3678 @property 3679 def right(self) -> Query: 3680 return self.expression 3681 3682 @property 3683 def kind(self) -> str: 3684 return self.text("kind").upper() 3685 3686 @property 3687 def side(self) -> str: 3688 return self.text("side").upper() 3689 3690 3691class Union(SetOperation): 3692 pass 3693 3694 3695class Except(SetOperation): 3696 pass 3697 3698 3699class Intersect(SetOperation): 3700 pass 3701 3702 3703class Update(DML): 3704 arg_types = { 3705 "with_": False, 3706 "this": False, 3707 "expressions": False, 3708 "from_": False, 3709 "where": False, 3710 "returning": False, 3711 "order": False, 3712 "limit": False, 3713 "options": False, 3714 } 3715 3716 def table( 3717 self, expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 3718 ) -> Update: 3719 """ 3720 Set the table to update. 3721 3722 Example: 3723 >>> Update().table("my_table").set_("x = 1").sql() 3724 'UPDATE my_table SET x = 1' 3725 3726 Args: 3727 expression : the SQL code strings to parse. 3728 If a `Table` instance is passed, this is used as-is. 3729 If another `Expression` instance is passed, it will be wrapped in a `Table`. 3730 dialect: the dialect used to parse the input expression. 3731 copy: if `False`, modify this expression instance in-place. 3732 opts: other options to use to parse the input expressions. 3733 3734 Returns: 3735 The modified Update expression. 3736 """ 3737 return _apply_builder( 3738 expression=expression, 3739 instance=self, 3740 arg="this", 3741 into=Table, 3742 prefix=None, 3743 dialect=dialect, 3744 copy=copy, 3745 **opts, 3746 ) 3747 3748 def set_( 3749 self, 3750 *expressions: ExpOrStr, 3751 append: bool = True, 3752 dialect: DialectType = None, 3753 copy: bool = True, 3754 **opts, 3755 ) -> Update: 3756 """ 3757 Append to or set the SET expressions. 3758 3759 Example: 3760 >>> Update().table("my_table").set_("x = 1").sql() 3761 'UPDATE my_table SET x = 1' 3762 3763 Args: 3764 *expressions: the SQL code strings to parse. 3765 If `Expression` instance(s) are passed, they will be used as-is. 3766 Multiple expressions are combined with a comma. 3767 append: if `True`, add the new expressions to any existing SET expressions. 3768 Otherwise, this resets the expressions. 3769 dialect: the dialect used to parse the input expressions. 3770 copy: if `False`, modify this expression instance in-place. 3771 opts: other options to use to parse the input expressions. 3772 """ 3773 return _apply_list_builder( 3774 *expressions, 3775 instance=self, 3776 arg="expressions", 3777 append=append, 3778 into=Expression, 3779 prefix=None, 3780 dialect=dialect, 3781 copy=copy, 3782 **opts, 3783 ) 3784 3785 def where( 3786 self, 3787 *expressions: t.Optional[ExpOrStr], 3788 append: bool = True, 3789 dialect: DialectType = None, 3790 copy: bool = True, 3791 **opts, 3792 ) -> Select: 3793 """ 3794 Append to or set the WHERE expressions. 3795 3796 Example: 3797 >>> Update().table("tbl").set_("x = 1").where("x = 'a' OR x < 'b'").sql() 3798 "UPDATE tbl SET x = 1 WHERE x = 'a' OR x < 'b'" 3799 3800 Args: 3801 *expressions: the SQL code strings to parse. 3802 If an `Expression` instance is passed, it will be used as-is. 3803 Multiple expressions are combined with an AND operator. 3804 append: if `True`, AND the new expressions to any existing expression. 3805 Otherwise, this resets the expression. 3806 dialect: the dialect used to parse the input expressions. 3807 copy: if `False`, modify this expression instance in-place. 3808 opts: other options to use to parse the input expressions. 3809 3810 Returns: 3811 Select: the modified expression. 3812 """ 3813 return _apply_conjunction_builder( 3814 *expressions, 3815 instance=self, 3816 arg="where", 3817 append=append, 3818 into=Where, 3819 dialect=dialect, 3820 copy=copy, 3821 **opts, 3822 ) 3823 3824 def from_( 3825 self, 3826 expression: t.Optional[ExpOrStr] = None, 3827 dialect: DialectType = None, 3828 copy: bool = True, 3829 **opts, 3830 ) -> Update: 3831 """ 3832 Set the FROM expression. 3833 3834 Example: 3835 >>> Update().table("my_table").set_("x = 1").from_("baz").sql() 3836 'UPDATE my_table SET x = 1 FROM baz' 3837 3838 Args: 3839 expression : the SQL code strings to parse. 3840 If a `From` instance is passed, this is used as-is. 3841 If another `Expression` instance is passed, it will be wrapped in a `From`. 3842 If nothing is passed in then a from is not applied to the expression 3843 dialect: the dialect used to parse the input expression. 3844 copy: if `False`, modify this expression instance in-place. 3845 opts: other options to use to parse the input expressions. 3846 3847 Returns: 3848 The modified Update expression. 3849 """ 3850 if not expression: 3851 return maybe_copy(self, copy) 3852 3853 return _apply_builder( 3854 expression=expression, 3855 instance=self, 3856 arg="from_", 3857 into=From, 3858 prefix="FROM", 3859 dialect=dialect, 3860 copy=copy, 3861 **opts, 3862 ) 3863 3864 def with_( 3865 self, 3866 alias: ExpOrStr, 3867 as_: ExpOrStr, 3868 recursive: t.Optional[bool] = None, 3869 materialized: t.Optional[bool] = None, 3870 append: bool = True, 3871 dialect: DialectType = None, 3872 copy: bool = True, 3873 **opts, 3874 ) -> Update: 3875 """ 3876 Append to or set the common table expressions. 3877 3878 Example: 3879 >>> Update().table("my_table").set_("x = 1").from_("baz").with_("baz", "SELECT id FROM foo").sql() 3880 'WITH baz AS (SELECT id FROM foo) UPDATE my_table SET x = 1 FROM baz' 3881 3882 Args: 3883 alias: the SQL code string to parse as the table name. 3884 If an `Expression` instance is passed, this is used as-is. 3885 as_: the SQL code string to parse as the table expression. 3886 If an `Expression` instance is passed, it will be used as-is. 3887 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 3888 materialized: set the MATERIALIZED part of the expression. 3889 append: if `True`, add to any existing expressions. 3890 Otherwise, this resets the expressions. 3891 dialect: the dialect used to parse the input expression. 3892 copy: if `False`, modify this expression instance in-place. 3893 opts: other options to use to parse the input expressions. 3894 3895 Returns: 3896 The modified expression. 3897 """ 3898 return _apply_cte_builder( 3899 self, 3900 alias, 3901 as_, 3902 recursive=recursive, 3903 materialized=materialized, 3904 append=append, 3905 dialect=dialect, 3906 copy=copy, 3907 **opts, 3908 ) 3909 3910 3911# DuckDB supports VALUES followed by https://duckdb.org/docs/stable/sql/query_syntax/limit 3912class Values(UDTF): 3913 arg_types = { 3914 "expressions": True, 3915 "alias": False, 3916 "order": False, 3917 "limit": False, 3918 "offset": False, 3919 } 3920 3921 3922class Var(Expression): 3923 pass 3924 3925 3926class Version(Expression): 3927 """ 3928 Time travel, iceberg, bigquery etc 3929 https://trino.io/docs/current/connector/iceberg.html?highlight=snapshot#using-snapshots 3930 https://www.databricks.com/blog/2019/02/04/introducing-delta-time-travel-for-large-scale-data-lakes.html 3931 https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#for_system_time_as_of 3932 https://learn.microsoft.com/en-us/sql/relational-databases/tables/querying-data-in-a-system-versioned-temporal-table?view=sql-server-ver16 3933 this is either TIMESTAMP or VERSION 3934 kind is ("AS OF", "BETWEEN") 3935 """ 3936 3937 arg_types = {"this": True, "kind": True, "expression": False} 3938 3939 3940class Schema(Expression): 3941 arg_types = {"this": False, "expressions": False} 3942 3943 3944# https://dev.mysql.com/doc/refman/8.0/en/select.html 3945# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SELECT.html 3946class Lock(Expression): 3947 arg_types = {"update": True, "expressions": False, "wait": False, "key": False} 3948 3949 3950class Select(Query): 3951 arg_types = { 3952 "with_": False, 3953 "kind": False, 3954 "expressions": False, 3955 "hint": False, 3956 "distinct": False, 3957 "into": False, 3958 "from_": False, 3959 "operation_modifiers": False, 3960 **QUERY_MODIFIERS, 3961 } 3962 3963 def from_( 3964 self, expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 3965 ) -> Select: 3966 """ 3967 Set the FROM expression. 3968 3969 Example: 3970 >>> Select().from_("tbl").select("x").sql() 3971 'SELECT x FROM tbl' 3972 3973 Args: 3974 expression : the SQL code strings to parse. 3975 If a `From` instance is passed, this is used as-is. 3976 If another `Expression` instance is passed, it will be wrapped in a `From`. 3977 dialect: the dialect used to parse the input expression. 3978 copy: if `False`, modify this expression instance in-place. 3979 opts: other options to use to parse the input expressions. 3980 3981 Returns: 3982 The modified Select expression. 3983 """ 3984 return _apply_builder( 3985 expression=expression, 3986 instance=self, 3987 arg="from_", 3988 into=From, 3989 prefix="FROM", 3990 dialect=dialect, 3991 copy=copy, 3992 **opts, 3993 ) 3994 3995 def group_by( 3996 self, 3997 *expressions: t.Optional[ExpOrStr], 3998 append: bool = True, 3999 dialect: DialectType = None, 4000 copy: bool = True, 4001 **opts, 4002 ) -> Select: 4003 """ 4004 Set the GROUP BY expression. 4005 4006 Example: 4007 >>> Select().from_("tbl").select("x", "COUNT(1)").group_by("x").sql() 4008 'SELECT x, COUNT(1) FROM tbl GROUP BY x' 4009 4010 Args: 4011 *expressions: the SQL code strings to parse. 4012 If a `Group` instance is passed, this is used as-is. 4013 If another `Expression` instance is passed, it will be wrapped in a `Group`. 4014 If nothing is passed in then a group by is not applied to the expression 4015 append: if `True`, add to any existing expressions. 4016 Otherwise, this flattens all the `Group` expression into a single expression. 4017 dialect: the dialect used to parse the input expression. 4018 copy: if `False`, modify this expression instance in-place. 4019 opts: other options to use to parse the input expressions. 4020 4021 Returns: 4022 The modified Select expression. 4023 """ 4024 if not expressions: 4025 return self if not copy else self.copy() 4026 4027 return _apply_child_list_builder( 4028 *expressions, 4029 instance=self, 4030 arg="group", 4031 append=append, 4032 copy=copy, 4033 prefix="GROUP BY", 4034 into=Group, 4035 dialect=dialect, 4036 **opts, 4037 ) 4038 4039 def sort_by( 4040 self, 4041 *expressions: t.Optional[ExpOrStr], 4042 append: bool = True, 4043 dialect: DialectType = None, 4044 copy: bool = True, 4045 **opts, 4046 ) -> Select: 4047 """ 4048 Set the SORT BY expression. 4049 4050 Example: 4051 >>> Select().from_("tbl").select("x").sort_by("x DESC").sql(dialect="hive") 4052 'SELECT x FROM tbl SORT BY x DESC' 4053 4054 Args: 4055 *expressions: the SQL code strings to parse. 4056 If a `Group` instance is passed, this is used as-is. 4057 If another `Expression` instance is passed, it will be wrapped in a `SORT`. 4058 append: if `True`, add to any existing expressions. 4059 Otherwise, this flattens all the `Order` expression into a single expression. 4060 dialect: the dialect used to parse the input expression. 4061 copy: if `False`, modify this expression instance in-place. 4062 opts: other options to use to parse the input expressions. 4063 4064 Returns: 4065 The modified Select expression. 4066 """ 4067 return _apply_child_list_builder( 4068 *expressions, 4069 instance=self, 4070 arg="sort", 4071 append=append, 4072 copy=copy, 4073 prefix="SORT BY", 4074 into=Sort, 4075 dialect=dialect, 4076 **opts, 4077 ) 4078 4079 def cluster_by( 4080 self, 4081 *expressions: t.Optional[ExpOrStr], 4082 append: bool = True, 4083 dialect: DialectType = None, 4084 copy: bool = True, 4085 **opts, 4086 ) -> Select: 4087 """ 4088 Set the CLUSTER BY expression. 4089 4090 Example: 4091 >>> Select().from_("tbl").select("x").cluster_by("x DESC").sql(dialect="hive") 4092 'SELECT x FROM tbl CLUSTER BY x DESC' 4093 4094 Args: 4095 *expressions: the SQL code strings to parse. 4096 If a `Group` instance is passed, this is used as-is. 4097 If another `Expression` instance is passed, it will be wrapped in a `Cluster`. 4098 append: if `True`, add to any existing expressions. 4099 Otherwise, this flattens all the `Order` expression into a single expression. 4100 dialect: the dialect used to parse the input expression. 4101 copy: if `False`, modify this expression instance in-place. 4102 opts: other options to use to parse the input expressions. 4103 4104 Returns: 4105 The modified Select expression. 4106 """ 4107 return _apply_child_list_builder( 4108 *expressions, 4109 instance=self, 4110 arg="cluster", 4111 append=append, 4112 copy=copy, 4113 prefix="CLUSTER BY", 4114 into=Cluster, 4115 dialect=dialect, 4116 **opts, 4117 ) 4118 4119 def select( 4120 self, 4121 *expressions: t.Optional[ExpOrStr], 4122 append: bool = True, 4123 dialect: DialectType = None, 4124 copy: bool = True, 4125 **opts, 4126 ) -> Select: 4127 return _apply_list_builder( 4128 *expressions, 4129 instance=self, 4130 arg="expressions", 4131 append=append, 4132 dialect=dialect, 4133 into=Expression, 4134 copy=copy, 4135 **opts, 4136 ) 4137 4138 def lateral( 4139 self, 4140 *expressions: t.Optional[ExpOrStr], 4141 append: bool = True, 4142 dialect: DialectType = None, 4143 copy: bool = True, 4144 **opts, 4145 ) -> Select: 4146 """ 4147 Append to or set the LATERAL expressions. 4148 4149 Example: 4150 >>> Select().select("x").lateral("OUTER explode(y) tbl2 AS z").from_("tbl").sql() 4151 'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z' 4152 4153 Args: 4154 *expressions: the SQL code strings to parse. 4155 If an `Expression` instance is passed, it will be used as-is. 4156 append: if `True`, add to any existing expressions. 4157 Otherwise, this resets the expressions. 4158 dialect: the dialect used to parse the input expressions. 4159 copy: if `False`, modify this expression instance in-place. 4160 opts: other options to use to parse the input expressions. 4161 4162 Returns: 4163 The modified Select expression. 4164 """ 4165 return _apply_list_builder( 4166 *expressions, 4167 instance=self, 4168 arg="laterals", 4169 append=append, 4170 into=Lateral, 4171 prefix="LATERAL VIEW", 4172 dialect=dialect, 4173 copy=copy, 4174 **opts, 4175 ) 4176 4177 def join( 4178 self, 4179 expression: ExpOrStr, 4180 on: t.Optional[ExpOrStr] = None, 4181 using: t.Optional[ExpOrStr | t.Collection[ExpOrStr]] = None, 4182 append: bool = True, 4183 join_type: t.Optional[str] = None, 4184 join_alias: t.Optional[Identifier | str] = None, 4185 dialect: DialectType = None, 4186 copy: bool = True, 4187 **opts, 4188 ) -> Select: 4189 """ 4190 Append to or set the JOIN expressions. 4191 4192 Example: 4193 >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y").sql() 4194 'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y' 4195 4196 >>> Select().select("1").from_("a").join("b", using=["x", "y", "z"]).sql() 4197 'SELECT 1 FROM a JOIN b USING (x, y, z)' 4198 4199 Use `join_type` to change the type of join: 4200 4201 >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y", join_type="left outer").sql() 4202 'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y' 4203 4204 Args: 4205 expression: the SQL code string to parse. 4206 If an `Expression` instance is passed, it will be used as-is. 4207 on: optionally specify the join "on" criteria as a SQL string. 4208 If an `Expression` instance is passed, it will be used as-is. 4209 using: optionally specify the join "using" criteria as a SQL string. 4210 If an `Expression` instance is passed, it will be used as-is. 4211 append: if `True`, add to any existing expressions. 4212 Otherwise, this resets the expressions. 4213 join_type: if set, alter the parsed join type. 4214 join_alias: an optional alias for the joined source. 4215 dialect: the dialect used to parse the input expressions. 4216 copy: if `False`, modify this expression instance in-place. 4217 opts: other options to use to parse the input expressions. 4218 4219 Returns: 4220 Select: the modified expression. 4221 """ 4222 parse_args: t.Dict[str, t.Any] = {"dialect": dialect, **opts} 4223 4224 try: 4225 expression = maybe_parse(expression, into=Join, prefix="JOIN", **parse_args) 4226 except ParseError: 4227 expression = maybe_parse(expression, into=(Join, Expression), **parse_args) 4228 4229 join = expression if isinstance(expression, Join) else Join(this=expression) 4230 4231 if isinstance(join.this, Select): 4232 join.this.replace(join.this.subquery()) 4233 4234 if join_type: 4235 method: t.Optional[Token] 4236 side: t.Optional[Token] 4237 kind: t.Optional[Token] 4238 4239 method, side, kind = maybe_parse(join_type, into="JOIN_TYPE", **parse_args) # type: ignore 4240 4241 if method: 4242 join.set("method", method.text) 4243 if side: 4244 join.set("side", side.text) 4245 if kind: 4246 join.set("kind", kind.text) 4247 4248 if on: 4249 on = and_(*ensure_list(on), dialect=dialect, copy=copy, **opts) 4250 join.set("on", on) 4251 4252 if using: 4253 join = _apply_list_builder( 4254 *ensure_list(using), 4255 instance=join, 4256 arg="using", 4257 append=append, 4258 copy=copy, 4259 into=Identifier, 4260 **opts, 4261 ) 4262 4263 if join_alias: 4264 join.set("this", alias_(join.this, join_alias, table=True)) 4265 4266 return _apply_list_builder( 4267 join, 4268 instance=self, 4269 arg="joins", 4270 append=append, 4271 copy=copy, 4272 **opts, 4273 ) 4274 4275 def having( 4276 self, 4277 *expressions: t.Optional[ExpOrStr], 4278 append: bool = True, 4279 dialect: DialectType = None, 4280 copy: bool = True, 4281 **opts, 4282 ) -> Select: 4283 """ 4284 Append to or set the HAVING expressions. 4285 4286 Example: 4287 >>> Select().select("x", "COUNT(y)").from_("tbl").group_by("x").having("COUNT(y) > 3").sql() 4288 'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3' 4289 4290 Args: 4291 *expressions: the SQL code strings to parse. 4292 If an `Expression` instance is passed, it will be used as-is. 4293 Multiple expressions are combined with an AND operator. 4294 append: if `True`, AND the new expressions to any existing expression. 4295 Otherwise, this resets the expression. 4296 dialect: the dialect used to parse the input expressions. 4297 copy: if `False`, modify this expression instance in-place. 4298 opts: other options to use to parse the input expressions. 4299 4300 Returns: 4301 The modified Select expression. 4302 """ 4303 return _apply_conjunction_builder( 4304 *expressions, 4305 instance=self, 4306 arg="having", 4307 append=append, 4308 into=Having, 4309 dialect=dialect, 4310 copy=copy, 4311 **opts, 4312 ) 4313 4314 def window( 4315 self, 4316 *expressions: t.Optional[ExpOrStr], 4317 append: bool = True, 4318 dialect: DialectType = None, 4319 copy: bool = True, 4320 **opts, 4321 ) -> Select: 4322 return _apply_list_builder( 4323 *expressions, 4324 instance=self, 4325 arg="windows", 4326 append=append, 4327 into=Window, 4328 dialect=dialect, 4329 copy=copy, 4330 **opts, 4331 ) 4332 4333 def qualify( 4334 self, 4335 *expressions: t.Optional[ExpOrStr], 4336 append: bool = True, 4337 dialect: DialectType = None, 4338 copy: bool = True, 4339 **opts, 4340 ) -> Select: 4341 return _apply_conjunction_builder( 4342 *expressions, 4343 instance=self, 4344 arg="qualify", 4345 append=append, 4346 into=Qualify, 4347 dialect=dialect, 4348 copy=copy, 4349 **opts, 4350 ) 4351 4352 def distinct( 4353 self, *ons: t.Optional[ExpOrStr], distinct: bool = True, copy: bool = True 4354 ) -> Select: 4355 """ 4356 Set the OFFSET expression. 4357 4358 Example: 4359 >>> Select().from_("tbl").select("x").distinct().sql() 4360 'SELECT DISTINCT x FROM tbl' 4361 4362 Args: 4363 ons: the expressions to distinct on 4364 distinct: whether the Select should be distinct 4365 copy: if `False`, modify this expression instance in-place. 4366 4367 Returns: 4368 Select: the modified expression. 4369 """ 4370 instance = maybe_copy(self, copy) 4371 on = Tuple(expressions=[maybe_parse(on, copy=copy) for on in ons if on]) if ons else None 4372 instance.set("distinct", Distinct(on=on) if distinct else None) 4373 return instance 4374 4375 def ctas( 4376 self, 4377 table: ExpOrStr, 4378 properties: t.Optional[t.Dict] = None, 4379 dialect: DialectType = None, 4380 copy: bool = True, 4381 **opts, 4382 ) -> Create: 4383 """ 4384 Convert this expression to a CREATE TABLE AS statement. 4385 4386 Example: 4387 >>> Select().select("*").from_("tbl").ctas("x").sql() 4388 'CREATE TABLE x AS SELECT * FROM tbl' 4389 4390 Args: 4391 table: the SQL code string to parse as the table name. 4392 If another `Expression` instance is passed, it will be used as-is. 4393 properties: an optional mapping of table properties 4394 dialect: the dialect used to parse the input table. 4395 copy: if `False`, modify this expression instance in-place. 4396 opts: other options to use to parse the input table. 4397 4398 Returns: 4399 The new Create expression. 4400 """ 4401 instance = maybe_copy(self, copy) 4402 table_expression = maybe_parse(table, into=Table, dialect=dialect, **opts) 4403 4404 properties_expression = None 4405 if properties: 4406 properties_expression = Properties.from_dict(properties) 4407 4408 return Create( 4409 this=table_expression, 4410 kind="TABLE", 4411 expression=instance, 4412 properties=properties_expression, 4413 ) 4414 4415 def lock(self, update: bool = True, copy: bool = True) -> Select: 4416 """ 4417 Set the locking read mode for this expression. 4418 4419 Examples: 4420 >>> Select().select("x").from_("tbl").where("x = 'a'").lock().sql("mysql") 4421 "SELECT x FROM tbl WHERE x = 'a' FOR UPDATE" 4422 4423 >>> Select().select("x").from_("tbl").where("x = 'a'").lock(update=False).sql("mysql") 4424 "SELECT x FROM tbl WHERE x = 'a' FOR SHARE" 4425 4426 Args: 4427 update: if `True`, the locking type will be `FOR UPDATE`, else it will be `FOR SHARE`. 4428 copy: if `False`, modify this expression instance in-place. 4429 4430 Returns: 4431 The modified expression. 4432 """ 4433 inst = maybe_copy(self, copy) 4434 inst.set("locks", [Lock(update=update)]) 4435 4436 return inst 4437 4438 def hint(self, *hints: ExpOrStr, dialect: DialectType = None, copy: bool = True) -> Select: 4439 """ 4440 Set hints for this expression. 4441 4442 Examples: 4443 >>> Select().select("x").from_("tbl").hint("BROADCAST(y)").sql(dialect="spark") 4444 'SELECT /*+ BROADCAST(y) */ x FROM tbl' 4445 4446 Args: 4447 hints: The SQL code strings to parse as the hints. 4448 If an `Expression` instance is passed, it will be used as-is. 4449 dialect: The dialect used to parse the hints. 4450 copy: If `False`, modify this expression instance in-place. 4451 4452 Returns: 4453 The modified expression. 4454 """ 4455 inst = maybe_copy(self, copy) 4456 inst.set( 4457 "hint", Hint(expressions=[maybe_parse(h, copy=copy, dialect=dialect) for h in hints]) 4458 ) 4459 4460 return inst 4461 4462 @property 4463 def named_selects(self) -> t.List[str]: 4464 selects = [] 4465 4466 for e in self.expressions: 4467 if e.alias_or_name: 4468 selects.append(e.output_name) 4469 elif isinstance(e, Aliases): 4470 selects.extend([a.name for a in e.aliases]) 4471 return selects 4472 4473 @property 4474 def is_star(self) -> bool: 4475 return any(expression.is_star for expression in self.expressions) 4476 4477 @property 4478 def selects(self) -> t.List[Expression]: 4479 return self.expressions 4480 4481 4482UNWRAPPED_QUERIES = (Select, SetOperation) 4483 4484 4485class Subquery(DerivedTable, Query): 4486 arg_types = { 4487 "this": True, 4488 "alias": False, 4489 "with_": False, 4490 **QUERY_MODIFIERS, 4491 } 4492 4493 def unnest(self): 4494 """Returns the first non subquery.""" 4495 expression = self 4496 while isinstance(expression, Subquery): 4497 expression = expression.this 4498 return expression 4499 4500 def unwrap(self) -> Subquery: 4501 expression = self 4502 while expression.same_parent and expression.is_wrapper: 4503 expression = t.cast(Subquery, expression.parent) 4504 return expression 4505 4506 def select( 4507 self, 4508 *expressions: t.Optional[ExpOrStr], 4509 append: bool = True, 4510 dialect: DialectType = None, 4511 copy: bool = True, 4512 **opts, 4513 ) -> Subquery: 4514 this = maybe_copy(self, copy) 4515 this.unnest().select(*expressions, append=append, dialect=dialect, copy=False, **opts) 4516 return this 4517 4518 @property 4519 def is_wrapper(self) -> bool: 4520 """ 4521 Whether this Subquery acts as a simple wrapper around another expression. 4522 4523 SELECT * FROM (((SELECT * FROM t))) 4524 ^ 4525 This corresponds to a "wrapper" Subquery node 4526 """ 4527 return all(v is None for k, v in self.args.items() if k != "this") 4528 4529 @property 4530 def is_star(self) -> bool: 4531 return self.this.is_star 4532 4533 @property 4534 def output_name(self) -> str: 4535 return self.alias 4536 4537 4538class TableSample(Expression): 4539 arg_types = { 4540 "expressions": False, 4541 "method": False, 4542 "bucket_numerator": False, 4543 "bucket_denominator": False, 4544 "bucket_field": False, 4545 "percent": False, 4546 "rows": False, 4547 "size": False, 4548 "seed": False, 4549 } 4550 4551 4552class Tag(Expression): 4553 """Tags are used for generating arbitrary sql like SELECT <span>x</span>.""" 4554 4555 arg_types = { 4556 "this": False, 4557 "prefix": False, 4558 "postfix": False, 4559 } 4560 4561 4562# Represents both the standard SQL PIVOT operator and DuckDB's "simplified" PIVOT syntax 4563# https://duckdb.org/docs/sql/statements/pivot 4564class Pivot(Expression): 4565 arg_types = { 4566 "this": False, 4567 "alias": False, 4568 "expressions": False, 4569 "fields": False, 4570 "unpivot": False, 4571 "using": False, 4572 "group": False, 4573 "columns": False, 4574 "include_nulls": False, 4575 "default_on_null": False, 4576 "into": False, 4577 "with_": False, 4578 } 4579 4580 @property 4581 def unpivot(self) -> bool: 4582 return bool(self.args.get("unpivot")) 4583 4584 @property 4585 def fields(self) -> t.List[Expression]: 4586 return self.args.get("fields", []) 4587 4588 4589# https://duckdb.org/docs/sql/statements/unpivot#simplified-unpivot-syntax 4590# UNPIVOT ... INTO [NAME <col_name> VALUE <col_value>][...,] 4591class UnpivotColumns(Expression): 4592 arg_types = {"this": True, "expressions": True} 4593 4594 4595class Window(Condition): 4596 arg_types = { 4597 "this": True, 4598 "partition_by": False, 4599 "order": False, 4600 "spec": False, 4601 "alias": False, 4602 "over": False, 4603 "first": False, 4604 } 4605 4606 4607class WindowSpec(Expression): 4608 arg_types = { 4609 "kind": False, 4610 "start": False, 4611 "start_side": False, 4612 "end": False, 4613 "end_side": False, 4614 "exclude": False, 4615 } 4616 4617 4618class PreWhere(Expression): 4619 pass 4620 4621 4622class Where(Expression): 4623 pass 4624 4625 4626class Star(Expression): 4627 arg_types = {"except_": False, "replace": False, "rename": False} 4628 4629 @property 4630 def name(self) -> str: 4631 return "*" 4632 4633 @property 4634 def output_name(self) -> str: 4635 return self.name 4636 4637 4638class Parameter(Condition): 4639 arg_types = {"this": True, "expression": False} 4640 4641 4642class SessionParameter(Condition): 4643 arg_types = {"this": True, "kind": False} 4644 4645 4646# https://www.databricks.com/blog/parameterized-queries-pyspark 4647# https://jdbc.postgresql.org/documentation/query/#using-the-statement-or-preparedstatement-interface 4648class Placeholder(Condition): 4649 arg_types = {"this": False, "kind": False, "widget": False, "jdbc": False} 4650 4651 @property 4652 def name(self) -> str: 4653 return self.this or "?" 4654 4655 4656class Null(Condition): 4657 arg_types: t.Dict[str, t.Any] = {} 4658 4659 @property 4660 def name(self) -> str: 4661 return "NULL" 4662 4663 def to_py(self) -> Lit[None]: 4664 return None 4665 4666 4667class Boolean(Condition): 4668 def to_py(self) -> bool: 4669 return self.this 4670 4671 4672class DataTypeParam(Expression): 4673 arg_types = {"this": True, "expression": False} 4674 4675 @property 4676 def name(self) -> str: 4677 return self.this.name 4678 4679 4680# The `nullable` arg is helpful when transpiling types from other dialects to ClickHouse, which 4681# assumes non-nullable types by default. Values `None` and `True` mean the type is nullable. 4682class DataType(Expression): 4683 arg_types = { 4684 "this": True, 4685 "expressions": False, 4686 "nested": False, 4687 "values": False, 4688 "prefix": False, 4689 "kind": False, 4690 "nullable": False, 4691 } 4692 4693 class Type(AutoName): 4694 ARRAY = auto() 4695 AGGREGATEFUNCTION = auto() 4696 SIMPLEAGGREGATEFUNCTION = auto() 4697 BIGDECIMAL = auto() 4698 BIGINT = auto() 4699 BIGNUM = auto() 4700 BIGSERIAL = auto() 4701 BINARY = auto() 4702 BIT = auto() 4703 BLOB = auto() 4704 BOOLEAN = auto() 4705 BPCHAR = auto() 4706 CHAR = auto() 4707 DATE = auto() 4708 DATE32 = auto() 4709 DATEMULTIRANGE = auto() 4710 DATERANGE = auto() 4711 DATETIME = auto() 4712 DATETIME2 = auto() 4713 DATETIME64 = auto() 4714 DECIMAL = auto() 4715 DECIMAL32 = auto() 4716 DECIMAL64 = auto() 4717 DECIMAL128 = auto() 4718 DECIMAL256 = auto() 4719 DECFLOAT = auto() 4720 DOUBLE = auto() 4721 DYNAMIC = auto() 4722 ENUM = auto() 4723 ENUM8 = auto() 4724 ENUM16 = auto() 4725 FILE = auto() 4726 FIXEDSTRING = auto() 4727 FLOAT = auto() 4728 GEOGRAPHY = auto() 4729 GEOGRAPHYPOINT = auto() 4730 GEOMETRY = auto() 4731 POINT = auto() 4732 RING = auto() 4733 LINESTRING = auto() 4734 MULTILINESTRING = auto() 4735 POLYGON = auto() 4736 MULTIPOLYGON = auto() 4737 HLLSKETCH = auto() 4738 HSTORE = auto() 4739 IMAGE = auto() 4740 INET = auto() 4741 INT = auto() 4742 INT128 = auto() 4743 INT256 = auto() 4744 INT4MULTIRANGE = auto() 4745 INT4RANGE = auto() 4746 INT8MULTIRANGE = auto() 4747 INT8RANGE = auto() 4748 INTERVAL = auto() 4749 IPADDRESS = auto() 4750 IPPREFIX = auto() 4751 IPV4 = auto() 4752 IPV6 = auto() 4753 JSON = auto() 4754 JSONB = auto() 4755 LIST = auto() 4756 LONGBLOB = auto() 4757 LONGTEXT = auto() 4758 LOWCARDINALITY = auto() 4759 MAP = auto() 4760 MEDIUMBLOB = auto() 4761 MEDIUMINT = auto() 4762 MEDIUMTEXT = auto() 4763 MONEY = auto() 4764 NAME = auto() 4765 NCHAR = auto() 4766 NESTED = auto() 4767 NOTHING = auto() 4768 NULL = auto() 4769 NUMMULTIRANGE = auto() 4770 NUMRANGE = auto() 4771 NVARCHAR = auto() 4772 OBJECT = auto() 4773 RANGE = auto() 4774 ROWVERSION = auto() 4775 SERIAL = auto() 4776 SET = auto() 4777 SMALLDATETIME = auto() 4778 SMALLINT = auto() 4779 SMALLMONEY = auto() 4780 SMALLSERIAL = auto() 4781 STRUCT = auto() 4782 SUPER = auto() 4783 TEXT = auto() 4784 TINYBLOB = auto() 4785 TINYTEXT = auto() 4786 TIME = auto() 4787 TIMETZ = auto() 4788 TIME_NS = auto() 4789 TIMESTAMP = auto() 4790 TIMESTAMPNTZ = auto() 4791 TIMESTAMPLTZ = auto() 4792 TIMESTAMPTZ = auto() 4793 TIMESTAMP_S = auto() 4794 TIMESTAMP_MS = auto() 4795 TIMESTAMP_NS = auto() 4796 TINYINT = auto() 4797 TSMULTIRANGE = auto() 4798 TSRANGE = auto() 4799 TSTZMULTIRANGE = auto() 4800 TSTZRANGE = auto() 4801 UBIGINT = auto() 4802 UINT = auto() 4803 UINT128 = auto() 4804 UINT256 = auto() 4805 UMEDIUMINT = auto() 4806 UDECIMAL = auto() 4807 UDOUBLE = auto() 4808 UNION = auto() 4809 UNKNOWN = auto() # Sentinel value, useful for type annotation 4810 USERDEFINED = "USER-DEFINED" 4811 USMALLINT = auto() 4812 UTINYINT = auto() 4813 UUID = auto() 4814 VARBINARY = auto() 4815 VARCHAR = auto() 4816 VARIANT = auto() 4817 VECTOR = auto() 4818 XML = auto() 4819 YEAR = auto() 4820 TDIGEST = auto() 4821 4822 STRUCT_TYPES = { 4823 Type.FILE, 4824 Type.NESTED, 4825 Type.OBJECT, 4826 Type.STRUCT, 4827 Type.UNION, 4828 } 4829 4830 ARRAY_TYPES = { 4831 Type.ARRAY, 4832 Type.LIST, 4833 } 4834 4835 NESTED_TYPES = { 4836 *STRUCT_TYPES, 4837 *ARRAY_TYPES, 4838 Type.MAP, 4839 } 4840 4841 TEXT_TYPES = { 4842 Type.CHAR, 4843 Type.NCHAR, 4844 Type.NVARCHAR, 4845 Type.TEXT, 4846 Type.VARCHAR, 4847 Type.NAME, 4848 } 4849 4850 SIGNED_INTEGER_TYPES = { 4851 Type.BIGINT, 4852 Type.INT, 4853 Type.INT128, 4854 Type.INT256, 4855 Type.MEDIUMINT, 4856 Type.SMALLINT, 4857 Type.TINYINT, 4858 } 4859 4860 UNSIGNED_INTEGER_TYPES = { 4861 Type.UBIGINT, 4862 Type.UINT, 4863 Type.UINT128, 4864 Type.UINT256, 4865 Type.UMEDIUMINT, 4866 Type.USMALLINT, 4867 Type.UTINYINT, 4868 } 4869 4870 INTEGER_TYPES = { 4871 *SIGNED_INTEGER_TYPES, 4872 *UNSIGNED_INTEGER_TYPES, 4873 Type.BIT, 4874 } 4875 4876 FLOAT_TYPES = { 4877 Type.DOUBLE, 4878 Type.FLOAT, 4879 } 4880 4881 REAL_TYPES = { 4882 *FLOAT_TYPES, 4883 Type.BIGDECIMAL, 4884 Type.DECIMAL, 4885 Type.DECIMAL32, 4886 Type.DECIMAL64, 4887 Type.DECIMAL128, 4888 Type.DECIMAL256, 4889 Type.DECFLOAT, 4890 Type.MONEY, 4891 Type.SMALLMONEY, 4892 Type.UDECIMAL, 4893 Type.UDOUBLE, 4894 } 4895 4896 NUMERIC_TYPES = { 4897 *INTEGER_TYPES, 4898 *REAL_TYPES, 4899 } 4900 4901 TEMPORAL_TYPES = { 4902 Type.DATE, 4903 Type.DATE32, 4904 Type.DATETIME, 4905 Type.DATETIME2, 4906 Type.DATETIME64, 4907 Type.SMALLDATETIME, 4908 Type.TIME, 4909 Type.TIMESTAMP, 4910 Type.TIMESTAMPNTZ, 4911 Type.TIMESTAMPLTZ, 4912 Type.TIMESTAMPTZ, 4913 Type.TIMESTAMP_MS, 4914 Type.TIMESTAMP_NS, 4915 Type.TIMESTAMP_S, 4916 Type.TIMETZ, 4917 } 4918 4919 @classmethod 4920 def build( 4921 cls, 4922 dtype: DATA_TYPE, 4923 dialect: DialectType = None, 4924 udt: bool = False, 4925 copy: bool = True, 4926 **kwargs, 4927 ) -> DataType: 4928 """ 4929 Constructs a DataType object. 4930 4931 Args: 4932 dtype: the data type of interest. 4933 dialect: the dialect to use for parsing `dtype`, in case it's a string. 4934 udt: when set to True, `dtype` will be used as-is if it can't be parsed into a 4935 DataType, thus creating a user-defined type. 4936 copy: whether to copy the data type. 4937 kwargs: additional arguments to pass in the constructor of DataType. 4938 4939 Returns: 4940 The constructed DataType object. 4941 """ 4942 from sqlglot import parse_one 4943 4944 if isinstance(dtype, str): 4945 if dtype.upper() == "UNKNOWN": 4946 return DataType(this=DataType.Type.UNKNOWN, **kwargs) 4947 4948 try: 4949 data_type_exp = parse_one( 4950 dtype, read=dialect, into=DataType, error_level=ErrorLevel.IGNORE 4951 ) 4952 except ParseError: 4953 if udt: 4954 return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs) 4955 raise 4956 elif isinstance(dtype, (Identifier, Dot)) and udt: 4957 return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs) 4958 elif isinstance(dtype, DataType.Type): 4959 data_type_exp = DataType(this=dtype) 4960 elif isinstance(dtype, DataType): 4961 return maybe_copy(dtype, copy) 4962 else: 4963 raise ValueError(f"Invalid data type: {type(dtype)}. Expected str or DataType.Type") 4964 4965 return DataType(**{**data_type_exp.args, **kwargs}) 4966 4967 def is_type(self, *dtypes: DATA_TYPE, check_nullable: bool = False) -> bool: 4968 """ 4969 Checks whether this DataType matches one of the provided data types. Nested types or precision 4970 will be compared using "structural equivalence" semantics, so e.g. array<int> != array<float>. 4971 4972 Args: 4973 dtypes: the data types to compare this DataType to. 4974 check_nullable: whether to take the NULLABLE type constructor into account for the comparison. 4975 If false, it means that NULLABLE<INT> is equivalent to INT. 4976 4977 Returns: 4978 True, if and only if there is a type in `dtypes` which is equal to this DataType. 4979 """ 4980 self_is_nullable = self.args.get("nullable") 4981 for dtype in dtypes: 4982 other_type = DataType.build(dtype, copy=False, udt=True) 4983 other_is_nullable = other_type.args.get("nullable") 4984 if ( 4985 other_type.expressions 4986 or (check_nullable and (self_is_nullable or other_is_nullable)) 4987 or self.this == DataType.Type.USERDEFINED 4988 or other_type.this == DataType.Type.USERDEFINED 4989 ): 4990 matches = self == other_type 4991 else: 4992 matches = self.this == other_type.this 4993 4994 if matches: 4995 return True 4996 return False 4997 4998 4999# https://www.postgresql.org/docs/15/datatype-pseudo.html 5000class PseudoType(DataType): 5001 arg_types = {"this": True} 5002 5003 5004# https://www.postgresql.org/docs/15/datatype-oid.html 5005class ObjectIdentifier(DataType): 5006 arg_types = {"this": True} 5007 5008 5009# WHERE x <OP> EXISTS|ALL|ANY|SOME(SELECT ...) 5010class SubqueryPredicate(Predicate): 5011 pass 5012 5013 5014class All(SubqueryPredicate): 5015 pass 5016 5017 5018class Any(SubqueryPredicate): 5019 pass 5020 5021 5022# Commands to interact with the databases or engines. For most of the command 5023# expressions we parse whatever comes after the command's name as a string. 5024class Command(Expression): 5025 arg_types = {"this": True, "expression": False} 5026 5027 5028class Transaction(Expression): 5029 arg_types = {"this": False, "modes": False, "mark": False} 5030 5031 5032class Commit(Expression): 5033 arg_types = {"chain": False, "this": False, "durability": False} 5034 5035 5036class Rollback(Expression): 5037 arg_types = {"savepoint": False, "this": False} 5038 5039 5040class Alter(Expression): 5041 arg_types = { 5042 "this": False, 5043 "kind": True, 5044 "actions": True, 5045 "exists": False, 5046 "only": False, 5047 "options": False, 5048 "cluster": False, 5049 "not_valid": False, 5050 "check": False, 5051 "cascade": False, 5052 } 5053 5054 @property 5055 def kind(self) -> t.Optional[str]: 5056 kind = self.args.get("kind") 5057 return kind and kind.upper() 5058 5059 @property 5060 def actions(self) -> t.List[Expression]: 5061 return self.args.get("actions") or [] 5062 5063 5064class AlterSession(Expression): 5065 arg_types = {"expressions": True, "unset": False} 5066 5067 5068class Analyze(Expression): 5069 arg_types = { 5070 "kind": False, 5071 "this": False, 5072 "options": False, 5073 "mode": False, 5074 "partition": False, 5075 "expression": False, 5076 "properties": False, 5077 } 5078 5079 5080class AnalyzeStatistics(Expression): 5081 arg_types = { 5082 "kind": True, 5083 "option": False, 5084 "this": False, 5085 "expressions": False, 5086 } 5087 5088 5089class AnalyzeHistogram(Expression): 5090 arg_types = { 5091 "this": True, 5092 "expressions": True, 5093 "expression": False, 5094 "update_options": False, 5095 } 5096 5097 5098class AnalyzeSample(Expression): 5099 arg_types = {"kind": True, "sample": True} 5100 5101 5102class AnalyzeListChainedRows(Expression): 5103 arg_types = {"expression": False} 5104 5105 5106class AnalyzeDelete(Expression): 5107 arg_types = {"kind": False} 5108 5109 5110class AnalyzeWith(Expression): 5111 arg_types = {"expressions": True} 5112 5113 5114class AnalyzeValidate(Expression): 5115 arg_types = { 5116 "kind": True, 5117 "this": False, 5118 "expression": False, 5119 } 5120 5121 5122class AnalyzeColumns(Expression): 5123 pass 5124 5125 5126class UsingData(Expression): 5127 pass 5128 5129 5130class AddConstraint(Expression): 5131 arg_types = {"expressions": True} 5132 5133 5134class AddPartition(Expression): 5135 arg_types = {"this": True, "exists": False, "location": False} 5136 5137 5138class AttachOption(Expression): 5139 arg_types = {"this": True, "expression": False} 5140 5141 5142class DropPartition(Expression): 5143 arg_types = {"expressions": True, "exists": False} 5144 5145 5146# https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#replace-partition 5147class ReplacePartition(Expression): 5148 arg_types = {"expression": True, "source": True} 5149 5150 5151# Binary expressions like (ADD a b) 5152class Binary(Condition): 5153 arg_types = {"this": True, "expression": True} 5154 5155 @property 5156 def left(self) -> Expression: 5157 return self.this 5158 5159 @property 5160 def right(self) -> Expression: 5161 return self.expression 5162 5163 5164class Add(Binary): 5165 pass 5166 5167 5168class Connector(Binary): 5169 pass 5170 5171 5172class BitwiseAnd(Binary): 5173 arg_types = {"this": True, "expression": True, "padside": False} 5174 5175 5176class BitwiseLeftShift(Binary): 5177 arg_types = {"this": True, "expression": True, "requires_int128": False} 5178 5179 5180class BitwiseOr(Binary): 5181 arg_types = {"this": True, "expression": True, "padside": False} 5182 5183 5184class BitwiseRightShift(Binary): 5185 arg_types = {"this": True, "expression": True, "requires_int128": False} 5186 5187 5188class BitwiseXor(Binary): 5189 arg_types = {"this": True, "expression": True, "padside": False} 5190 5191 5192class Div(Binary): 5193 arg_types = {"this": True, "expression": True, "typed": False, "safe": False} 5194 5195 5196class Overlaps(Binary): 5197 pass 5198 5199 5200class ExtendsLeft(Binary): 5201 pass 5202 5203 5204class ExtendsRight(Binary): 5205 pass 5206 5207 5208class Dot(Binary): 5209 @property 5210 def is_star(self) -> bool: 5211 return self.expression.is_star 5212 5213 @property 5214 def name(self) -> str: 5215 return self.expression.name 5216 5217 @property 5218 def output_name(self) -> str: 5219 return self.name 5220 5221 @classmethod 5222 def build(self, expressions: t.Sequence[Expression]) -> Dot: 5223 """Build a Dot object with a sequence of expressions.""" 5224 if len(expressions) < 2: 5225 raise ValueError("Dot requires >= 2 expressions.") 5226 5227 return t.cast(Dot, reduce(lambda x, y: Dot(this=x, expression=y), expressions)) 5228 5229 @property 5230 def parts(self) -> t.List[Expression]: 5231 """Return the parts of a table / column in order catalog, db, table.""" 5232 this, *parts = self.flatten() 5233 5234 parts.reverse() 5235 5236 for arg in COLUMN_PARTS: 5237 part = this.args.get(arg) 5238 5239 if isinstance(part, Expression): 5240 parts.append(part) 5241 5242 parts.reverse() 5243 return parts 5244 5245 5246DATA_TYPE = t.Union[str, Identifier, Dot, DataType, DataType.Type] 5247 5248 5249class DPipe(Binary): 5250 arg_types = {"this": True, "expression": True, "safe": False} 5251 5252 5253class EQ(Binary, Predicate): 5254 pass 5255 5256 5257class NullSafeEQ(Binary, Predicate): 5258 pass 5259 5260 5261class NullSafeNEQ(Binary, Predicate): 5262 pass 5263 5264 5265# Represents e.g. := in DuckDB which is mostly used for setting parameters 5266class PropertyEQ(Binary): 5267 pass 5268 5269 5270class Distance(Binary): 5271 pass 5272 5273 5274class Escape(Binary): 5275 pass 5276 5277 5278class Glob(Binary, Predicate): 5279 pass 5280 5281 5282class GT(Binary, Predicate): 5283 pass 5284 5285 5286class GTE(Binary, Predicate): 5287 pass 5288 5289 5290class ILike(Binary, Predicate): 5291 pass 5292 5293 5294class IntDiv(Binary): 5295 pass 5296 5297 5298class Is(Binary, Predicate): 5299 pass 5300 5301 5302class Kwarg(Binary): 5303 """Kwarg in special functions like func(kwarg => y).""" 5304 5305 5306class Like(Binary, Predicate): 5307 pass 5308 5309 5310class Match(Binary, Predicate): 5311 pass 5312 5313 5314class LT(Binary, Predicate): 5315 pass 5316 5317 5318class LTE(Binary, Predicate): 5319 pass 5320 5321 5322class Mod(Binary): 5323 pass 5324 5325 5326class Mul(Binary): 5327 pass 5328 5329 5330class NEQ(Binary, Predicate): 5331 pass 5332 5333 5334# https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH 5335class Operator(Binary): 5336 arg_types = {"this": True, "operator": True, "expression": True} 5337 5338 5339class SimilarTo(Binary, Predicate): 5340 pass 5341 5342 5343class Sub(Binary): 5344 pass 5345 5346 5347# https://www.postgresql.org/docs/current/functions-range.html 5348# Represents range adjacency operator: -|- 5349class Adjacent(Binary): 5350 pass 5351 5352 5353# Unary Expressions 5354# (NOT a) 5355class Unary(Condition): 5356 pass 5357 5358 5359class BitwiseNot(Unary): 5360 pass 5361 5362 5363class Not(Unary): 5364 pass 5365 5366 5367class Paren(Unary): 5368 @property 5369 def output_name(self) -> str: 5370 return self.this.name 5371 5372 5373class Neg(Unary): 5374 def to_py(self) -> int | Decimal: 5375 if self.is_number: 5376 return self.this.to_py() * -1 5377 return super().to_py() 5378 5379 5380class Alias(Expression): 5381 arg_types = {"this": True, "alias": False} 5382 5383 @property 5384 def output_name(self) -> str: 5385 return self.alias 5386 5387 5388# BigQuery requires the UNPIVOT column list aliases to be either strings or ints, but 5389# other dialects require identifiers. This enables us to transpile between them easily. 5390class PivotAlias(Alias): 5391 pass 5392 5393 5394# Represents Snowflake's ANY [ ORDER BY ... ] syntax 5395# https://docs.snowflake.com/en/sql-reference/constructs/pivot 5396class PivotAny(Expression): 5397 arg_types = {"this": False} 5398 5399 5400class Aliases(Expression): 5401 arg_types = {"this": True, "expressions": True} 5402 5403 @property 5404 def aliases(self): 5405 return self.expressions 5406 5407 5408# https://docs.aws.amazon.com/redshift/latest/dg/query-super.html 5409class AtIndex(Expression): 5410 arg_types = {"this": True, "expression": True} 5411 5412 5413class AtTimeZone(Expression): 5414 arg_types = {"this": True, "zone": True} 5415 5416 5417class FromTimeZone(Expression): 5418 arg_types = {"this": True, "zone": True} 5419 5420 5421class FormatPhrase(Expression): 5422 """Format override for a column in Teradata. 5423 Can be expanded to additional dialects as needed 5424 5425 https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/SQL-Data-Types-and-Literals/Data-Type-Formats-and-Format-Phrases/FORMAT 5426 """ 5427 5428 arg_types = {"this": True, "format": True} 5429 5430 5431class Between(Predicate): 5432 arg_types = {"this": True, "low": True, "high": True, "symmetric": False} 5433 5434 5435class Bracket(Condition): 5436 # https://cloud.google.com/bigquery/docs/reference/standard-sql/operators#array_subscript_operator 5437 arg_types = { 5438 "this": True, 5439 "expressions": True, 5440 "offset": False, 5441 "safe": False, 5442 "returns_list_for_maps": False, 5443 } 5444 5445 @property 5446 def output_name(self) -> str: 5447 if len(self.expressions) == 1: 5448 return self.expressions[0].output_name 5449 5450 return super().output_name 5451 5452 5453class Distinct(Expression): 5454 arg_types = {"expressions": False, "on": False} 5455 5456 5457class In(Predicate): 5458 arg_types = { 5459 "this": True, 5460 "expressions": False, 5461 "query": False, 5462 "unnest": False, 5463 "field": False, 5464 "is_global": False, 5465 } 5466 5467 5468# https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#for-in 5469class ForIn(Expression): 5470 arg_types = {"this": True, "expression": True} 5471 5472 5473class TimeUnit(Expression): 5474 """Automatically converts unit arg into a var.""" 5475 5476 arg_types = {"unit": False} 5477 5478 UNABBREVIATED_UNIT_NAME = { 5479 "D": "DAY", 5480 "H": "HOUR", 5481 "M": "MINUTE", 5482 "MS": "MILLISECOND", 5483 "NS": "NANOSECOND", 5484 "Q": "QUARTER", 5485 "S": "SECOND", 5486 "US": "MICROSECOND", 5487 "W": "WEEK", 5488 "Y": "YEAR", 5489 } 5490 5491 VAR_LIKE = (Column, Literal, Var) 5492 5493 def __init__(self, **args): 5494 unit = args.get("unit") 5495 if type(unit) in self.VAR_LIKE and not (isinstance(unit, Column) and len(unit.parts) != 1): 5496 args["unit"] = Var( 5497 this=(self.UNABBREVIATED_UNIT_NAME.get(unit.name) or unit.name).upper() 5498 ) 5499 elif isinstance(unit, Week): 5500 unit.set("this", Var(this=unit.this.name.upper())) 5501 5502 super().__init__(**args) 5503 5504 @property 5505 def unit(self) -> t.Optional[Var | IntervalSpan]: 5506 return self.args.get("unit") 5507 5508 5509class IntervalOp(TimeUnit): 5510 arg_types = {"unit": False, "expression": True} 5511 5512 def interval(self): 5513 return Interval( 5514 this=self.expression.copy(), 5515 unit=self.unit.copy() if self.unit else None, 5516 ) 5517 5518 5519# https://www.oracletutorial.com/oracle-basics/oracle-interval/ 5520# https://trino.io/docs/current/language/types.html#interval-day-to-second 5521# https://docs.databricks.com/en/sql/language-manual/data-types/interval-type.html 5522class IntervalSpan(DataType): 5523 arg_types = {"this": True, "expression": True} 5524 5525 5526class Interval(TimeUnit): 5527 arg_types = {"this": False, "unit": False} 5528 5529 5530class IgnoreNulls(Expression): 5531 pass 5532 5533 5534class RespectNulls(Expression): 5535 pass 5536 5537 5538# https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate-function-calls#max_min_clause 5539class HavingMax(Expression): 5540 arg_types = {"this": True, "expression": True, "max": True} 5541 5542 5543# Functions 5544class Func(Condition): 5545 """ 5546 The base class for all function expressions. 5547 5548 Attributes: 5549 is_var_len_args (bool): if set to True the last argument defined in arg_types will be 5550 treated as a variable length argument and the argument's value will be stored as a list. 5551 _sql_names (list): the SQL name (1st item in the list) and aliases (subsequent items) for this 5552 function expression. These values are used to map this node to a name during parsing as 5553 well as to provide the function's name during SQL string generation. By default the SQL 5554 name is set to the expression's class name transformed to snake case. 5555 """ 5556 5557 is_var_len_args = False 5558 5559 @classmethod 5560 def from_arg_list(cls, args): 5561 if cls.is_var_len_args: 5562 all_arg_keys = list(cls.arg_types) 5563 # If this function supports variable length argument treat the last argument as such. 5564 non_var_len_arg_keys = all_arg_keys[:-1] if cls.is_var_len_args else all_arg_keys 5565 num_non_var = len(non_var_len_arg_keys) 5566 5567 args_dict = {arg_key: arg for arg, arg_key in zip(args, non_var_len_arg_keys)} 5568 args_dict[all_arg_keys[-1]] = args[num_non_var:] 5569 else: 5570 args_dict = {arg_key: arg for arg, arg_key in zip(args, cls.arg_types)} 5571 5572 return cls(**args_dict) 5573 5574 @classmethod 5575 def sql_names(cls): 5576 if cls is Func: 5577 raise NotImplementedError( 5578 "SQL name is only supported by concrete function implementations" 5579 ) 5580 if "_sql_names" not in cls.__dict__: 5581 cls._sql_names = [camel_to_snake_case(cls.__name__)] 5582 return cls._sql_names 5583 5584 @classmethod 5585 def sql_name(cls): 5586 sql_names = cls.sql_names() 5587 assert sql_names, f"Expected non-empty 'sql_names' for Func: {cls.__name__}." 5588 return sql_names[0] 5589 5590 @classmethod 5591 def default_parser_mappings(cls): 5592 return {name: cls.from_arg_list for name in cls.sql_names()} 5593 5594 5595# Function returns NULL instead of error 5596# https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/functions-reference#safe_prefix 5597class SafeFunc(Func): 5598 pass 5599 5600 5601class Typeof(Func): 5602 pass 5603 5604 5605class Acos(Func): 5606 pass 5607 5608 5609class Acosh(Func): 5610 pass 5611 5612 5613class Asin(Func): 5614 pass 5615 5616 5617class Asinh(Func): 5618 pass 5619 5620 5621class Atan(Func): 5622 arg_types = {"this": True, "expression": False} 5623 5624 5625class Atanh(Func): 5626 pass 5627 5628 5629class Atan2(Func): 5630 arg_types = {"this": True, "expression": True} 5631 5632 5633class Cot(Func): 5634 pass 5635 5636 5637class Coth(Func): 5638 pass 5639 5640 5641class Cos(Func): 5642 pass 5643 5644 5645class Csc(Func): 5646 pass 5647 5648 5649class Csch(Func): 5650 pass 5651 5652 5653class Sec(Func): 5654 pass 5655 5656 5657class Sech(Func): 5658 pass 5659 5660 5661class Sin(Func): 5662 pass 5663 5664 5665class Sinh(Func): 5666 pass 5667 5668 5669class Tan(Func): 5670 pass 5671 5672 5673class Tanh(Func): 5674 pass 5675 5676 5677class Degrees(Func): 5678 pass 5679 5680 5681class Cosh(Func): 5682 pass 5683 5684 5685class CosineDistance(Func): 5686 arg_types = {"this": True, "expression": True} 5687 5688 5689class DotProduct(Func): 5690 arg_types = {"this": True, "expression": True} 5691 5692 5693class EuclideanDistance(Func): 5694 arg_types = {"this": True, "expression": True} 5695 5696 5697class ManhattanDistance(Func): 5698 arg_types = {"this": True, "expression": True} 5699 5700 5701class JarowinklerSimilarity(Func): 5702 arg_types = {"this": True, "expression": True} 5703 5704 5705class AggFunc(Func): 5706 pass 5707 5708 5709class BitwiseAndAgg(AggFunc): 5710 pass 5711 5712 5713class BitwiseOrAgg(AggFunc): 5714 pass 5715 5716 5717class BitwiseXorAgg(AggFunc): 5718 pass 5719 5720 5721class BoolxorAgg(AggFunc): 5722 pass 5723 5724 5725class BitwiseCount(Func): 5726 pass 5727 5728 5729class BitmapBucketNumber(Func): 5730 pass 5731 5732 5733class BitmapCount(Func): 5734 pass 5735 5736 5737class BitmapBitPosition(Func): 5738 pass 5739 5740 5741class BitmapConstructAgg(AggFunc): 5742 pass 5743 5744 5745class BitmapOrAgg(AggFunc): 5746 pass 5747 5748 5749class ByteLength(Func): 5750 pass 5751 5752 5753class Boolnot(Func): 5754 arg_types = {"this": True, "round_input": False} 5755 5756 5757class Booland(Func): 5758 arg_types = {"this": True, "expression": True, "round_input": False} 5759 5760 5761class Boolor(Func): 5762 arg_types = {"this": True, "expression": True, "round_input": False} 5763 5764 5765# https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#bool_for_json 5766class JSONBool(Func): 5767 pass 5768 5769 5770class ArrayRemove(Func): 5771 arg_types = {"this": True, "expression": True, "null_propagation": False} 5772 5773 5774class ParameterizedAgg(AggFunc): 5775 arg_types = {"this": True, "expressions": True, "params": True} 5776 5777 5778class Abs(Func): 5779 pass 5780 5781 5782class ArgMax(AggFunc): 5783 arg_types = {"this": True, "expression": True, "count": False} 5784 _sql_names = ["ARG_MAX", "ARGMAX", "MAX_BY"] 5785 5786 5787class ArgMin(AggFunc): 5788 arg_types = {"this": True, "expression": True, "count": False} 5789 _sql_names = ["ARG_MIN", "ARGMIN", "MIN_BY"] 5790 5791 5792class ApproxTopK(AggFunc): 5793 arg_types = {"this": True, "expression": False, "counters": False} 5794 5795 5796# https://docs.snowflake.com/en/sql-reference/functions/approx_top_k_accumulate 5797# https://spark.apache.org/docs/preview/api/sql/index.html#approx_top_k_accumulate 5798class ApproxTopKAccumulate(AggFunc): 5799 arg_types = {"this": True, "expression": False} 5800 5801 5802# https://docs.snowflake.com/en/sql-reference/functions/approx_top_k_combine 5803class ApproxTopKCombine(AggFunc): 5804 arg_types = {"this": True, "expression": False} 5805 5806 5807class ApproxTopKEstimate(Func): 5808 arg_types = {"this": True, "expression": False} 5809 5810 5811class ApproxTopSum(AggFunc): 5812 arg_types = {"this": True, "expression": True, "count": True} 5813 5814 5815class ApproxQuantiles(AggFunc): 5816 arg_types = {"this": True, "expression": False} 5817 5818 5819# https://docs.snowflake.com/en/sql-reference/functions/approx_percentile_combine 5820class ApproxPercentileCombine(AggFunc): 5821 pass 5822 5823 5824# https://docs.snowflake.com/en/sql-reference/functions/minhash 5825class Minhash(AggFunc): 5826 arg_types = {"this": True, "expressions": True} 5827 is_var_len_args = True 5828 5829 5830# https://docs.snowflake.com/en/sql-reference/functions/minhash_combine 5831class MinhashCombine(AggFunc): 5832 pass 5833 5834 5835# https://docs.snowflake.com/en/sql-reference/functions/approximate_similarity 5836class ApproximateSimilarity(AggFunc): 5837 _sql_names = ["APPROXIMATE_SIMILARITY", "APPROXIMATE_JACCARD_INDEX"] 5838 5839 5840class FarmFingerprint(Func): 5841 arg_types = {"expressions": True} 5842 is_var_len_args = True 5843 _sql_names = ["FARM_FINGERPRINT", "FARMFINGERPRINT64"] 5844 5845 5846class Flatten(Func): 5847 pass 5848 5849 5850class Float64(Func): 5851 arg_types = {"this": True, "expression": False} 5852 5853 5854# https://spark.apache.org/docs/latest/api/sql/index.html#transform 5855class Transform(Func): 5856 arg_types = {"this": True, "expression": True} 5857 5858 5859class Translate(Func): 5860 arg_types = {"this": True, "from_": True, "to": True} 5861 5862 5863class Grouping(AggFunc): 5864 arg_types = {"expressions": True} 5865 is_var_len_args = True 5866 5867 5868class GroupingId(AggFunc): 5869 arg_types = {"expressions": False} 5870 is_var_len_args = True 5871 5872 5873class Anonymous(Func): 5874 arg_types = {"this": True, "expressions": False} 5875 is_var_len_args = True 5876 5877 @property 5878 def name(self) -> str: 5879 return self.this if isinstance(self.this, str) else self.this.name 5880 5881 5882class AnonymousAggFunc(AggFunc): 5883 arg_types = {"this": True, "expressions": False} 5884 is_var_len_args = True 5885 5886 5887# https://clickhouse.com/docs/en/sql-reference/aggregate-functions/combinators 5888class CombinedAggFunc(AnonymousAggFunc): 5889 arg_types = {"this": True, "expressions": False} 5890 5891 5892class CombinedParameterizedAgg(ParameterizedAgg): 5893 arg_types = {"this": True, "expressions": True, "params": True} 5894 5895 5896# https://docs.snowflake.com/en/sql-reference/functions/hash_agg 5897class HashAgg(AggFunc): 5898 arg_types = {"this": True, "expressions": False} 5899 is_var_len_args = True 5900 5901 5902# https://docs.snowflake.com/en/sql-reference/functions/hll 5903# https://docs.aws.amazon.com/redshift/latest/dg/r_HLL_function.html 5904class Hll(AggFunc): 5905 arg_types = {"this": True, "expressions": False} 5906 is_var_len_args = True 5907 5908 5909class ApproxDistinct(AggFunc): 5910 arg_types = {"this": True, "accuracy": False} 5911 _sql_names = ["APPROX_DISTINCT", "APPROX_COUNT_DISTINCT"] 5912 5913 5914class Apply(Func): 5915 arg_types = {"this": True, "expression": True} 5916 5917 5918class Array(Func): 5919 arg_types = { 5920 "expressions": False, 5921 "bracket_notation": False, 5922 "struct_name_inheritance": False, 5923 } 5924 is_var_len_args = True 5925 5926 5927class Ascii(Func): 5928 pass 5929 5930 5931# https://docs.snowflake.com/en/sql-reference/functions/to_array 5932class ToArray(Func): 5933 pass 5934 5935 5936class ToBoolean(Func): 5937 arg_types = {"this": True, "safe": False} 5938 5939 5940# https://materialize.com/docs/sql/types/list/ 5941class List(Func): 5942 arg_types = {"expressions": False} 5943 is_var_len_args = True 5944 5945 5946# String pad, kind True -> LPAD, False -> RPAD 5947class Pad(Func): 5948 arg_types = {"this": True, "expression": True, "fill_pattern": False, "is_left": True} 5949 5950 5951# https://docs.snowflake.com/en/sql-reference/functions/to_char 5952# https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/TO_CHAR-number.html 5953class ToChar(Func): 5954 arg_types = { 5955 "this": True, 5956 "format": False, 5957 "nlsparam": False, 5958 "is_numeric": False, 5959 } 5960 5961 5962class ToCodePoints(Func): 5963 pass 5964 5965 5966# https://docs.snowflake.com/en/sql-reference/functions/to_decimal 5967# https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/TO_NUMBER.html 5968class ToNumber(Func): 5969 arg_types = { 5970 "this": True, 5971 "format": False, 5972 "nlsparam": False, 5973 "precision": False, 5974 "scale": False, 5975 "safe": False, 5976 "safe_name": False, 5977 } 5978 5979 5980# https://docs.snowflake.com/en/sql-reference/functions/to_double 5981class ToDouble(Func): 5982 arg_types = { 5983 "this": True, 5984 "format": False, 5985 "safe": False, 5986 } 5987 5988 5989# https://docs.snowflake.com/en/sql-reference/functions/to_decfloat 5990class ToDecfloat(Func): 5991 arg_types = { 5992 "this": True, 5993 "format": False, 5994 } 5995 5996 5997# https://docs.snowflake.com/en/sql-reference/functions/try_to_decfloat 5998class TryToDecfloat(Func): 5999 arg_types = { 6000 "this": True, 6001 "format": False, 6002 } 6003 6004 6005# https://docs.snowflake.com/en/sql-reference/functions/to_file 6006class ToFile(Func): 6007 arg_types = { 6008 "this": True, 6009 "path": False, 6010 "safe": False, 6011 } 6012 6013 6014class CodePointsToBytes(Func): 6015 pass 6016 6017 6018class Columns(Func): 6019 arg_types = {"this": True, "unpack": False} 6020 6021 6022# https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver16#syntax 6023class Convert(Func): 6024 arg_types = {"this": True, "expression": True, "style": False, "safe": False} 6025 6026 6027# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CONVERT.html 6028class ConvertToCharset(Func): 6029 arg_types = {"this": True, "dest": True, "source": False} 6030 6031 6032class ConvertTimezone(Func): 6033 arg_types = { 6034 "source_tz": False, 6035 "target_tz": True, 6036 "timestamp": True, 6037 "options": False, 6038 } 6039 6040 6041class CodePointsToString(Func): 6042 pass 6043 6044 6045class GenerateSeries(Func): 6046 arg_types = {"start": True, "end": True, "step": False, "is_end_exclusive": False} 6047 6048 6049# Postgres' GENERATE_SERIES function returns a row set, i.e. it implicitly explodes when it's 6050# used in a projection, so this expression is a helper that facilitates transpilation to other 6051# dialects. For example, we'd generate UNNEST(GENERATE_SERIES(...)) in DuckDB 6052class ExplodingGenerateSeries(GenerateSeries): 6053 pass 6054 6055 6056# https://docs.snowflake.com/en/sql-reference/functions/generator 6057class Generator(Func, UDTF): 6058 arg_types = {"rowcount": False, "timelimit": False} 6059 6060 6061class ArrayAgg(AggFunc): 6062 arg_types = {"this": True, "nulls_excluded": False} 6063 6064 6065class ArrayUniqueAgg(AggFunc): 6066 pass 6067 6068 6069class AIAgg(AggFunc): 6070 arg_types = {"this": True, "expression": True} 6071 _sql_names = ["AI_AGG"] 6072 6073 6074class AISummarizeAgg(AggFunc): 6075 _sql_names = ["AI_SUMMARIZE_AGG"] 6076 6077 6078class AIClassify(Func): 6079 arg_types = {"this": True, "categories": True, "config": False} 6080 _sql_names = ["AI_CLASSIFY"] 6081 6082 6083class ArrayAll(Func): 6084 arg_types = {"this": True, "expression": True} 6085 6086 6087# Represents Python's `any(f(x) for x in array)`, where `array` is `this` and `f` is `expression` 6088class ArrayAny(Func): 6089 arg_types = {"this": True, "expression": True} 6090 6091 6092class ArrayAppend(Func): 6093 arg_types = {"this": True, "expression": True, "null_propagation": False} 6094 6095 6096class ArrayPrepend(Func): 6097 arg_types = {"this": True, "expression": True, "null_propagation": False} 6098 6099 6100class ArrayConcat(Func): 6101 _sql_names = ["ARRAY_CONCAT", "ARRAY_CAT"] 6102 arg_types = {"this": True, "expressions": False, "null_propagation": False} 6103 is_var_len_args = True 6104 6105 6106class ArrayConcatAgg(AggFunc): 6107 pass 6108 6109 6110class ArrayCompact(Func): 6111 pass 6112 6113 6114class ArrayInsert(Func): 6115 arg_types = {"this": True, "position": True, "expression": True, "offset": False} 6116 6117 6118class ArrayConstructCompact(Func): 6119 arg_types = {"expressions": False} 6120 is_var_len_args = True 6121 6122 6123class ArrayContains(Binary, Func): 6124 arg_types = {"this": True, "expression": True, "ensure_variant": False} 6125 _sql_names = ["ARRAY_CONTAINS", "ARRAY_HAS"] 6126 6127 6128class ArrayContainsAll(Binary, Func): 6129 _sql_names = ["ARRAY_CONTAINS_ALL", "ARRAY_HAS_ALL"] 6130 6131 6132class ArrayFilter(Func): 6133 arg_types = {"this": True, "expression": True} 6134 _sql_names = ["FILTER", "ARRAY_FILTER"] 6135 6136 6137class ArrayFirst(Func): 6138 pass 6139 6140 6141class ArrayLast(Func): 6142 pass 6143 6144 6145class ArrayReverse(Func): 6146 pass 6147 6148 6149class ArraySlice(Func): 6150 arg_types = {"this": True, "start": True, "end": False, "step": False} 6151 6152 6153class ArrayToString(Func): 6154 arg_types = {"this": True, "expression": True, "null": False} 6155 _sql_names = ["ARRAY_TO_STRING", "ARRAY_JOIN"] 6156 6157 6158class ArrayIntersect(Func): 6159 arg_types = {"expressions": True} 6160 is_var_len_args = True 6161 _sql_names = ["ARRAY_INTERSECT", "ARRAY_INTERSECTION"] 6162 6163 6164class StPoint(Func): 6165 arg_types = {"this": True, "expression": True, "null": False} 6166 _sql_names = ["ST_POINT", "ST_MAKEPOINT"] 6167 6168 6169class StDistance(Func): 6170 arg_types = {"this": True, "expression": True, "use_spheroid": False} 6171 6172 6173# https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#string 6174class String(Func): 6175 arg_types = {"this": True, "zone": False} 6176 6177 6178class StringToArray(Func): 6179 arg_types = {"this": True, "expression": False, "null": False} 6180 _sql_names = ["STRING_TO_ARRAY", "SPLIT_BY_STRING", "STRTOK_TO_ARRAY"] 6181 6182 6183class ArrayOverlaps(Binary, Func): 6184 pass 6185 6186 6187class ArraySize(Func): 6188 arg_types = {"this": True, "expression": False} 6189 _sql_names = ["ARRAY_SIZE", "ARRAY_LENGTH"] 6190 6191 6192class ArraySort(Func): 6193 arg_types = {"this": True, "expression": False} 6194 6195 6196class ArraySum(Func): 6197 arg_types = {"this": True, "expression": False} 6198 6199 6200class ArrayUnionAgg(AggFunc): 6201 pass 6202 6203 6204class ArraysZip(Func): 6205 arg_types = {"expressions": False} 6206 is_var_len_args = True 6207 6208 6209class Avg(AggFunc): 6210 pass 6211 6212 6213class AnyValue(AggFunc): 6214 pass 6215 6216 6217class Lag(AggFunc): 6218 arg_types = {"this": True, "offset": False, "default": False} 6219 6220 6221class Lead(AggFunc): 6222 arg_types = {"this": True, "offset": False, "default": False} 6223 6224 6225# some dialects have a distinction between first and first_value, usually first is an aggregate func 6226# and first_value is a window func 6227class First(AggFunc): 6228 arg_types = {"this": True, "expression": False} 6229 6230 6231class Last(AggFunc): 6232 arg_types = {"this": True, "expression": False} 6233 6234 6235class FirstValue(AggFunc): 6236 pass 6237 6238 6239class LastValue(AggFunc): 6240 pass 6241 6242 6243class NthValue(AggFunc): 6244 arg_types = {"this": True, "offset": True} 6245 6246 6247class ObjectAgg(AggFunc): 6248 arg_types = {"this": True, "expression": True} 6249 6250 6251class Case(Func): 6252 arg_types = {"this": False, "ifs": True, "default": False} 6253 6254 def when(self, condition: ExpOrStr, then: ExpOrStr, copy: bool = True, **opts) -> Case: 6255 instance = maybe_copy(self, copy) 6256 instance.append( 6257 "ifs", 6258 If( 6259 this=maybe_parse(condition, copy=copy, **opts), 6260 true=maybe_parse(then, copy=copy, **opts), 6261 ), 6262 ) 6263 return instance 6264 6265 def else_(self, condition: ExpOrStr, copy: bool = True, **opts) -> Case: 6266 instance = maybe_copy(self, copy) 6267 instance.set("default", maybe_parse(condition, copy=copy, **opts)) 6268 return instance 6269 6270 6271class Cast(Func): 6272 arg_types = { 6273 "this": True, 6274 "to": True, 6275 "format": False, 6276 "safe": False, 6277 "action": False, 6278 "default": False, 6279 } 6280 6281 @property 6282 def name(self) -> str: 6283 return self.this.name 6284 6285 @property 6286 def to(self) -> DataType: 6287 return self.args["to"] 6288 6289 @property 6290 def output_name(self) -> str: 6291 return self.name 6292 6293 def is_type(self, *dtypes: DATA_TYPE) -> bool: 6294 """ 6295 Checks whether this Cast's DataType matches one of the provided data types. Nested types 6296 like arrays or structs will be compared using "structural equivalence" semantics, so e.g. 6297 array<int> != array<float>. 6298 6299 Args: 6300 dtypes: the data types to compare this Cast's DataType to. 6301 6302 Returns: 6303 True, if and only if there is a type in `dtypes` which is equal to this Cast's DataType. 6304 """ 6305 return self.to.is_type(*dtypes) 6306 6307 6308class TryCast(Cast): 6309 arg_types = {**Cast.arg_types, "requires_string": False} 6310 6311 6312# https://clickhouse.com/docs/sql-reference/data-types/newjson#reading-json-paths-as-sub-columns 6313class JSONCast(Cast): 6314 pass 6315 6316 6317class JustifyDays(Func): 6318 pass 6319 6320 6321class JustifyHours(Func): 6322 pass 6323 6324 6325class JustifyInterval(Func): 6326 pass 6327 6328 6329class Try(Func): 6330 pass 6331 6332 6333class CastToStrType(Func): 6334 arg_types = {"this": True, "to": True} 6335 6336 6337class CheckJson(Func): 6338 arg_types = {"this": True} 6339 6340 6341class CheckXml(Func): 6342 arg_types = {"this": True, "disable_auto_convert": False} 6343 6344 6345# https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/SQL-Functions-Expressions-and-Predicates/String-Operators-and-Functions/TRANSLATE/TRANSLATE-Function-Syntax 6346class TranslateCharacters(Expression): 6347 arg_types = {"this": True, "expression": True, "with_error": False} 6348 6349 6350class Collate(Binary, Func): 6351 pass 6352 6353 6354class Collation(Func): 6355 pass 6356 6357 6358class Ceil(Func): 6359 arg_types = {"this": True, "decimals": False, "to": False} 6360 _sql_names = ["CEIL", "CEILING"] 6361 6362 6363class Coalesce(Func): 6364 arg_types = {"this": True, "expressions": False, "is_nvl": False, "is_null": False} 6365 is_var_len_args = True 6366 _sql_names = ["COALESCE", "IFNULL", "NVL"] 6367 6368 6369class Chr(Func): 6370 arg_types = {"expressions": True, "charset": False} 6371 is_var_len_args = True 6372 _sql_names = ["CHR", "CHAR"] 6373 6374 6375class Concat(Func): 6376 arg_types = {"expressions": True, "safe": False, "coalesce": False} 6377 is_var_len_args = True 6378 6379 6380class ConcatWs(Concat): 6381 _sql_names = ["CONCAT_WS"] 6382 6383 6384# https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#contains_substr 6385class Contains(Func): 6386 arg_types = {"this": True, "expression": True, "json_scope": False} 6387 6388 6389# https://docs.oracle.com/cd/B13789_01/server.101/b10759/operators004.htm#i1035022 6390class ConnectByRoot(Func): 6391 pass 6392 6393 6394class Count(AggFunc): 6395 arg_types = {"this": False, "expressions": False, "big_int": False} 6396 is_var_len_args = True 6397 6398 6399class CountIf(AggFunc): 6400 _sql_names = ["COUNT_IF", "COUNTIF"] 6401 6402 6403# cube root 6404class Cbrt(Func): 6405 pass 6406 6407 6408class CurrentAccount(Func): 6409 arg_types = {} 6410 6411 6412class CurrentAccountName(Func): 6413 arg_types = {} 6414 6415 6416class CurrentAvailableRoles(Func): 6417 arg_types = {} 6418 6419 6420class CurrentClient(Func): 6421 arg_types = {} 6422 6423 6424class CurrentIpAddress(Func): 6425 arg_types = {} 6426 6427 6428class CurrentDatabase(Func): 6429 arg_types = {} 6430 6431 6432class CurrentSchemas(Func): 6433 arg_types = {"this": False} 6434 6435 6436class CurrentSecondaryRoles(Func): 6437 arg_types = {} 6438 6439 6440class CurrentSession(Func): 6441 arg_types = {} 6442 6443 6444class CurrentStatement(Func): 6445 arg_types = {} 6446 6447 6448class CurrentVersion(Func): 6449 arg_types = {} 6450 6451 6452class CurrentTransaction(Func): 6453 arg_types = {} 6454 6455 6456class CurrentWarehouse(Func): 6457 arg_types = {} 6458 6459 6460class CurrentDate(Func): 6461 arg_types = {"this": False} 6462 6463 6464class CurrentDatetime(Func): 6465 arg_types = {"this": False} 6466 6467 6468class CurrentTime(Func): 6469 arg_types = {"this": False} 6470 6471 6472# https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT 6473# In Postgres, the difference between CURRENT_TIME vs LOCALTIME etc is that the latter does not have tz 6474class Localtime(Func): 6475 arg_types = {"this": False} 6476 6477 6478class Localtimestamp(Func): 6479 arg_types = {"this": False} 6480 6481 6482class Systimestamp(Func): 6483 arg_types = {"this": False} 6484 6485 6486class CurrentTimestamp(Func): 6487 arg_types = {"this": False, "sysdate": False} 6488 6489 6490class CurrentTimestampLTZ(Func): 6491 arg_types = {} 6492 6493 6494class CurrentTimezone(Func): 6495 arg_types = {} 6496 6497 6498class CurrentOrganizationName(Func): 6499 arg_types = {} 6500 6501 6502class CurrentSchema(Func): 6503 arg_types = {"this": False} 6504 6505 6506class CurrentUser(Func): 6507 arg_types = {"this": False} 6508 6509 6510class CurrentCatalog(Func): 6511 arg_types = {} 6512 6513 6514class CurrentRegion(Func): 6515 arg_types = {} 6516 6517 6518class CurrentRole(Func): 6519 arg_types = {} 6520 6521 6522class CurrentRoleType(Func): 6523 arg_types = {} 6524 6525 6526class CurrentOrganizationUser(Func): 6527 arg_types = {} 6528 6529 6530class SessionUser(Func): 6531 arg_types = {} 6532 6533 6534class UtcDate(Func): 6535 arg_types = {} 6536 6537 6538class UtcTime(Func): 6539 arg_types = {"this": False} 6540 6541 6542class UtcTimestamp(Func): 6543 arg_types = {"this": False} 6544 6545 6546class DateAdd(Func, IntervalOp): 6547 arg_types = {"this": True, "expression": True, "unit": False} 6548 6549 6550class DateBin(Func, IntervalOp): 6551 arg_types = {"this": True, "expression": True, "unit": False, "zone": False, "origin": False} 6552 6553 6554class DateSub(Func, IntervalOp): 6555 arg_types = {"this": True, "expression": True, "unit": False} 6556 6557 6558class DateDiff(Func, TimeUnit): 6559 _sql_names = ["DATEDIFF", "DATE_DIFF"] 6560 arg_types = { 6561 "this": True, 6562 "expression": True, 6563 "unit": False, 6564 "zone": False, 6565 "big_int": False, 6566 "date_part_boundary": False, 6567 } 6568 6569 6570class DateTrunc(Func): 6571 arg_types = {"unit": True, "this": True, "zone": False, "input_type_preserved": False} 6572 6573 def __init__(self, **args): 6574 # Across most dialects it's safe to unabbreviate the unit (e.g. 'Q' -> 'QUARTER') except Oracle 6575 # https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/ROUND-and-TRUNC-Date-Functions.html 6576 unabbreviate = args.pop("unabbreviate", True) 6577 6578 unit = args.get("unit") 6579 if isinstance(unit, TimeUnit.VAR_LIKE) and not ( 6580 isinstance(unit, Column) and len(unit.parts) != 1 6581 ): 6582 unit_name = unit.name.upper() 6583 if unabbreviate and unit_name in TimeUnit.UNABBREVIATED_UNIT_NAME: 6584 unit_name = TimeUnit.UNABBREVIATED_UNIT_NAME[unit_name] 6585 6586 args["unit"] = Literal.string(unit_name) 6587 6588 super().__init__(**args) 6589 6590 @property 6591 def unit(self) -> Expression: 6592 return self.args["unit"] 6593 6594 6595# https://cloud.google.com/bigquery/docs/reference/standard-sql/datetime_functions#datetime 6596# expression can either be time_expr or time_zone 6597class Datetime(Func): 6598 arg_types = {"this": True, "expression": False} 6599 6600 6601class DatetimeAdd(Func, IntervalOp): 6602 arg_types = {"this": True, "expression": True, "unit": False} 6603 6604 6605class DatetimeSub(Func, IntervalOp): 6606 arg_types = {"this": True, "expression": True, "unit": False} 6607 6608 6609class DatetimeDiff(Func, TimeUnit): 6610 arg_types = {"this": True, "expression": True, "unit": False} 6611 6612 6613class DatetimeTrunc(Func, TimeUnit): 6614 arg_types = {"this": True, "unit": True, "zone": False} 6615 6616 6617class DateFromUnixDate(Func): 6618 pass 6619 6620 6621class DayOfWeek(Func): 6622 _sql_names = ["DAY_OF_WEEK", "DAYOFWEEK"] 6623 6624 6625# https://duckdb.org/docs/sql/functions/datepart.html#part-specifiers-only-usable-as-date-part-specifiers 6626# ISO day of week function in duckdb is ISODOW 6627class DayOfWeekIso(Func): 6628 _sql_names = ["DAYOFWEEK_ISO", "ISODOW"] 6629 6630 6631class DayOfMonth(Func): 6632 _sql_names = ["DAY_OF_MONTH", "DAYOFMONTH"] 6633 6634 6635class DayOfYear(Func): 6636 _sql_names = ["DAY_OF_YEAR", "DAYOFYEAR"] 6637 6638 6639class Dayname(Func): 6640 arg_types = {"this": True, "abbreviated": False} 6641 6642 6643class ToDays(Func): 6644 pass 6645 6646 6647class WeekOfYear(Func): 6648 _sql_names = ["WEEK_OF_YEAR", "WEEKOFYEAR"] 6649 6650 6651class YearOfWeek(Func): 6652 _sql_names = ["YEAR_OF_WEEK", "YEAROFWEEK"] 6653 6654 6655class YearOfWeekIso(Func): 6656 _sql_names = ["YEAR_OF_WEEK_ISO", "YEAROFWEEKISO"] 6657 6658 6659class MonthsBetween(Func): 6660 arg_types = {"this": True, "expression": True, "roundoff": False} 6661 6662 6663class MakeInterval(Func): 6664 arg_types = { 6665 "year": False, 6666 "month": False, 6667 "week": False, 6668 "day": False, 6669 "hour": False, 6670 "minute": False, 6671 "second": False, 6672 } 6673 6674 6675class LastDay(Func, TimeUnit): 6676 _sql_names = ["LAST_DAY", "LAST_DAY_OF_MONTH"] 6677 arg_types = {"this": True, "unit": False} 6678 6679 6680class PreviousDay(Func): 6681 arg_types = {"this": True, "expression": True} 6682 6683 6684class LaxBool(Func): 6685 pass 6686 6687 6688class LaxFloat64(Func): 6689 pass 6690 6691 6692class LaxInt64(Func): 6693 pass 6694 6695 6696class LaxString(Func): 6697 pass 6698 6699 6700class Extract(Func): 6701 arg_types = {"this": True, "expression": True} 6702 6703 6704class Exists(Func, SubqueryPredicate): 6705 arg_types = {"this": True, "expression": False} 6706 6707 6708class Elt(Func): 6709 arg_types = {"this": True, "expressions": True} 6710 is_var_len_args = True 6711 6712 6713class Timestamp(Func): 6714 arg_types = {"this": False, "zone": False, "with_tz": False} 6715 6716 6717class TimestampAdd(Func, TimeUnit): 6718 arg_types = {"this": True, "expression": True, "unit": False} 6719 6720 6721class TimestampSub(Func, TimeUnit): 6722 arg_types = {"this": True, "expression": True, "unit": False} 6723 6724 6725class TimestampDiff(Func, TimeUnit): 6726 _sql_names = ["TIMESTAMPDIFF", "TIMESTAMP_DIFF"] 6727 arg_types = {"this": True, "expression": True, "unit": False} 6728 6729 6730class TimestampTrunc(Func, TimeUnit): 6731 arg_types = {"this": True, "unit": True, "zone": False, "input_type_preserved": False} 6732 6733 6734class TimeSlice(Func, TimeUnit): 6735 arg_types = {"this": True, "expression": True, "unit": True, "kind": False} 6736 6737 6738class TimeAdd(Func, TimeUnit): 6739 arg_types = {"this": True, "expression": True, "unit": False} 6740 6741 6742class TimeSub(Func, TimeUnit): 6743 arg_types = {"this": True, "expression": True, "unit": False} 6744 6745 6746class TimeDiff(Func, TimeUnit): 6747 arg_types = {"this": True, "expression": True, "unit": False} 6748 6749 6750class TimeTrunc(Func, TimeUnit): 6751 arg_types = {"this": True, "unit": True, "zone": False} 6752 6753 6754class DateFromParts(Func): 6755 _sql_names = ["DATE_FROM_PARTS", "DATEFROMPARTS"] 6756 arg_types = {"year": True, "month": False, "day": False, "allow_overflow": False} 6757 6758 6759class TimeFromParts(Func): 6760 _sql_names = ["TIME_FROM_PARTS", "TIMEFROMPARTS"] 6761 arg_types = { 6762 "hour": True, 6763 "min": True, 6764 "sec": True, 6765 "nano": False, 6766 "fractions": False, 6767 "precision": False, 6768 "overflow": False, 6769 } 6770 6771 6772class DateStrToDate(Func): 6773 pass 6774 6775 6776class DateToDateStr(Func): 6777 pass 6778 6779 6780class DateToDi(Func): 6781 pass 6782 6783 6784# https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date 6785class Date(Func): 6786 arg_types = {"this": False, "zone": False, "expressions": False} 6787 is_var_len_args = True 6788 6789 6790class Day(Func): 6791 pass 6792 6793 6794class Decode(Func): 6795 arg_types = {"this": True, "charset": True, "replace": False} 6796 6797 6798class DecodeCase(Func): 6799 arg_types = {"expressions": True} 6800 is_var_len_args = True 6801 6802 6803# https://docs.snowflake.com/en/sql-reference/functions/decrypt 6804class Decrypt(Func): 6805 arg_types = { 6806 "this": True, 6807 "passphrase": True, 6808 "aad": False, 6809 "encryption_method": False, 6810 "safe": False, 6811 } 6812 6813 6814# https://docs.snowflake.com/en/sql-reference/functions/decrypt_raw 6815class DecryptRaw(Func): 6816 arg_types = { 6817 "this": True, 6818 "key": True, 6819 "iv": True, 6820 "aad": False, 6821 "encryption_method": False, 6822 "aead": False, 6823 "safe": False, 6824 } 6825 6826 6827class DenseRank(AggFunc): 6828 arg_types = {"expressions": False} 6829 is_var_len_args = True 6830 6831 6832class DiToDate(Func): 6833 pass 6834 6835 6836class Encode(Func): 6837 arg_types = {"this": True, "charset": True} 6838 6839 6840# https://docs.snowflake.com/en/sql-reference/functions/encrypt 6841class Encrypt(Func): 6842 arg_types = {"this": True, "passphrase": True, "aad": False, "encryption_method": False} 6843 6844 6845# https://docs.snowflake.com/en/sql-reference/functions/encrypt_raw 6846class EncryptRaw(Func): 6847 arg_types = {"this": True, "key": True, "iv": True, "aad": False, "encryption_method": False} 6848 6849 6850class EqualNull(Func): 6851 arg_types = {"this": True, "expression": True} 6852 6853 6854class Exp(Func): 6855 pass 6856 6857 6858class Factorial(Func): 6859 pass 6860 6861 6862# https://docs.snowflake.com/en/sql-reference/functions/flatten 6863class Explode(Func, UDTF): 6864 arg_types = {"this": True, "expressions": False} 6865 is_var_len_args = True 6866 6867 6868# https://spark.apache.org/docs/latest/api/sql/#inline 6869class Inline(Func): 6870 pass 6871 6872 6873class ExplodeOuter(Explode): 6874 pass 6875 6876 6877class Posexplode(Explode): 6878 pass 6879 6880 6881class PosexplodeOuter(Posexplode, ExplodeOuter): 6882 pass 6883 6884 6885class PositionalColumn(Expression): 6886 pass 6887 6888 6889class Unnest(Func, UDTF): 6890 arg_types = { 6891 "expressions": True, 6892 "alias": False, 6893 "offset": False, 6894 "explode_array": False, 6895 } 6896 6897 @property 6898 def selects(self) -> t.List[Expression]: 6899 columns = super().selects 6900 offset = self.args.get("offset") 6901 if offset: 6902 columns = columns + [to_identifier("offset") if offset is True else offset] 6903 return columns 6904 6905 6906class Floor(Func): 6907 arg_types = {"this": True, "decimals": False, "to": False} 6908 6909 6910class FromBase32(Func): 6911 pass 6912 6913 6914class FromBase64(Func): 6915 pass 6916 6917 6918class ToBase32(Func): 6919 pass 6920 6921 6922class ToBase64(Func): 6923 pass 6924 6925 6926class ToBinary(Func): 6927 arg_types = {"this": True, "format": False, "safe": False} 6928 6929 6930# https://docs.snowflake.com/en/sql-reference/functions/base64_decode_binary 6931class Base64DecodeBinary(Func): 6932 arg_types = {"this": True, "alphabet": False} 6933 6934 6935# https://docs.snowflake.com/en/sql-reference/functions/base64_decode_string 6936class Base64DecodeString(Func): 6937 arg_types = {"this": True, "alphabet": False} 6938 6939 6940# https://docs.snowflake.com/en/sql-reference/functions/base64_encode 6941class Base64Encode(Func): 6942 arg_types = {"this": True, "max_line_length": False, "alphabet": False} 6943 6944 6945# https://docs.snowflake.com/en/sql-reference/functions/try_base64_decode_binary 6946class TryBase64DecodeBinary(Func): 6947 arg_types = {"this": True, "alphabet": False} 6948 6949 6950# https://docs.snowflake.com/en/sql-reference/functions/try_base64_decode_string 6951class TryBase64DecodeString(Func): 6952 arg_types = {"this": True, "alphabet": False} 6953 6954 6955# https://docs.snowflake.com/en/sql-reference/functions/try_hex_decode_binary 6956class TryHexDecodeBinary(Func): 6957 pass 6958 6959 6960# https://docs.snowflake.com/en/sql-reference/functions/try_hex_decode_string 6961class TryHexDecodeString(Func): 6962 pass 6963 6964 6965# https://trino.io/docs/current/functions/datetime.html#from_iso8601_timestamp 6966class FromISO8601Timestamp(Func): 6967 _sql_names = ["FROM_ISO8601_TIMESTAMP"] 6968 6969 6970class GapFill(Func): 6971 arg_types = { 6972 "this": True, 6973 "ts_column": True, 6974 "bucket_width": True, 6975 "partitioning_columns": False, 6976 "value_columns": False, 6977 "origin": False, 6978 "ignore_nulls": False, 6979 } 6980 6981 6982# https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions#generate_date_array 6983class GenerateDateArray(Func): 6984 arg_types = {"start": True, "end": True, "step": False} 6985 6986 6987# https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions#generate_timestamp_array 6988class GenerateTimestampArray(Func): 6989 arg_types = {"start": True, "end": True, "step": True} 6990 6991 6992# https://docs.snowflake.com/en/sql-reference/functions/get 6993class GetExtract(Func): 6994 arg_types = {"this": True, "expression": True} 6995 6996 6997class Getbit(Func): 6998 _sql_names = ["GETBIT", "GET_BIT"] 6999 # zero_is_msb means the most significant bit is indexed 0 7000 arg_types = {"this": True, "expression": True, "zero_is_msb": False} 7001 7002 7003class Greatest(Func): 7004 arg_types = {"this": True, "expressions": False, "ignore_nulls": True} 7005 is_var_len_args = True 7006 7007 7008# Trino's `ON OVERFLOW TRUNCATE [filler_string] {WITH | WITHOUT} COUNT` 7009# https://trino.io/docs/current/functions/aggregate.html#listagg 7010class OverflowTruncateBehavior(Expression): 7011 arg_types = {"this": False, "with_count": True} 7012 7013 7014class GroupConcat(AggFunc): 7015 arg_types = {"this": True, "separator": False, "on_overflow": False} 7016 7017 7018class Hex(Func): 7019 pass 7020 7021 7022# https://docs.snowflake.com/en/sql-reference/functions/hex_decode_string 7023class HexDecodeString(Func): 7024 pass 7025 7026 7027# https://docs.snowflake.com/en/sql-reference/functions/hex_encode 7028class HexEncode(Func): 7029 arg_types = {"this": True, "case": False} 7030 7031 7032class Hour(Func): 7033 pass 7034 7035 7036class Minute(Func): 7037 pass 7038 7039 7040class Second(Func): 7041 pass 7042 7043 7044# T-SQL: https://learn.microsoft.com/en-us/sql/t-sql/functions/compress-transact-sql?view=sql-server-ver17 7045# Snowflake: https://docs.snowflake.com/en/sql-reference/functions/compress 7046class Compress(Func): 7047 arg_types = {"this": True, "method": False} 7048 7049 7050# Snowflake: https://docs.snowflake.com/en/sql-reference/functions/decompress_binary 7051class DecompressBinary(Func): 7052 arg_types = {"this": True, "method": True} 7053 7054 7055# Snowflake: https://docs.snowflake.com/en/sql-reference/functions/decompress_string 7056class DecompressString(Func): 7057 arg_types = {"this": True, "method": True} 7058 7059 7060class LowerHex(Hex): 7061 pass 7062 7063 7064class And(Connector, Func): 7065 pass 7066 7067 7068class Or(Connector, Func): 7069 pass 7070 7071 7072class Xor(Connector, Func): 7073 arg_types = {"this": False, "expression": False, "expressions": False, "round_input": False} 7074 is_var_len_args = True 7075 7076 7077class If(Func): 7078 arg_types = {"this": True, "true": True, "false": False} 7079 _sql_names = ["IF", "IIF"] 7080 7081 7082class Nullif(Func): 7083 arg_types = {"this": True, "expression": True} 7084 7085 7086class Initcap(Func): 7087 arg_types = {"this": True, "expression": False} 7088 7089 7090class IsAscii(Func): 7091 pass 7092 7093 7094class IsNan(Func): 7095 _sql_names = ["IS_NAN", "ISNAN"] 7096 7097 7098# https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#int64_for_json 7099class Int64(Func): 7100 pass 7101 7102 7103class IsInf(Func): 7104 _sql_names = ["IS_INF", "ISINF"] 7105 7106 7107class IsNullValue(Func): 7108 pass 7109 7110 7111class IsArray(Func): 7112 pass 7113 7114 7115# https://www.postgresql.org/docs/current/functions-json.html 7116class JSON(Expression): 7117 arg_types = {"this": False, "with_": False, "unique": False} 7118 7119 7120class JSONPath(Expression): 7121 arg_types = {"expressions": True, "escape": False} 7122 7123 @property 7124 def output_name(self) -> str: 7125 last_segment = self.expressions[-1].this 7126 return last_segment if isinstance(last_segment, str) else "" 7127 7128 7129class JSONPathPart(Expression): 7130 arg_types = {} 7131 7132 7133class JSONPathFilter(JSONPathPart): 7134 arg_types = {"this": True} 7135 7136 7137class JSONPathKey(JSONPathPart): 7138 arg_types = {"this": True} 7139 7140 7141class JSONPathRecursive(JSONPathPart): 7142 arg_types = {"this": False} 7143 7144 7145class JSONPathRoot(JSONPathPart): 7146 pass 7147 7148 7149class JSONPathScript(JSONPathPart): 7150 arg_types = {"this": True} 7151 7152 7153class JSONPathSlice(JSONPathPart): 7154 arg_types = {"start": False, "end": False, "step": False} 7155 7156 7157class JSONPathSelector(JSONPathPart): 7158 arg_types = {"this": True} 7159 7160 7161class JSONPathSubscript(JSONPathPart): 7162 arg_types = {"this": True} 7163 7164 7165class JSONPathUnion(JSONPathPart): 7166 arg_types = {"expressions": True} 7167 7168 7169class JSONPathWildcard(JSONPathPart): 7170 pass 7171 7172 7173class FormatJson(Expression): 7174 pass 7175 7176 7177class Format(Func): 7178 arg_types = {"this": True, "expressions": False} 7179 is_var_len_args = True 7180 7181 7182class JSONKeys(Func): 7183 arg_types = {"this": True, "expression": False, "expressions": False} 7184 is_var_len_args = True 7185 _sql_names = ["JSON_KEYS"] 7186 7187 7188class JSONKeyValue(Expression): 7189 arg_types = {"this": True, "expression": True} 7190 7191 7192# https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_keys 7193class JSONKeysAtDepth(Func): 7194 arg_types = {"this": True, "expression": False, "mode": False} 7195 7196 7197class JSONObject(Func): 7198 arg_types = { 7199 "expressions": False, 7200 "null_handling": False, 7201 "unique_keys": False, 7202 "return_type": False, 7203 "encoding": False, 7204 } 7205 7206 7207class JSONObjectAgg(AggFunc): 7208 arg_types = { 7209 "expressions": False, 7210 "null_handling": False, 7211 "unique_keys": False, 7212 "return_type": False, 7213 "encoding": False, 7214 } 7215 7216 7217# https://www.postgresql.org/docs/9.5/functions-aggregate.html 7218class JSONBObjectAgg(AggFunc): 7219 arg_types = {"this": True, "expression": True} 7220 7221 7222# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_ARRAY.html 7223class JSONArray(Func): 7224 arg_types = { 7225 "expressions": False, 7226 "null_handling": False, 7227 "return_type": False, 7228 "strict": False, 7229 } 7230 7231 7232# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_ARRAYAGG.html 7233class JSONArrayAgg(AggFunc): 7234 arg_types = { 7235 "this": True, 7236 "order": False, 7237 "null_handling": False, 7238 "return_type": False, 7239 "strict": False, 7240 } 7241 7242 7243class JSONExists(Func): 7244 arg_types = { 7245 "this": True, 7246 "path": True, 7247 "passing": False, 7248 "on_condition": False, 7249 "from_dcolonqmark": False, 7250 } 7251 7252 7253# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_TABLE.html 7254# Note: parsing of JSON column definitions is currently incomplete. 7255class JSONColumnDef(Expression): 7256 arg_types = { 7257 "this": False, 7258 "kind": False, 7259 "path": False, 7260 "nested_schema": False, 7261 "ordinality": False, 7262 } 7263 7264 7265class JSONSchema(Expression): 7266 arg_types = {"expressions": True} 7267 7268 7269class JSONSet(Func): 7270 arg_types = {"this": True, "expressions": True} 7271 is_var_len_args = True 7272 _sql_names = ["JSON_SET"] 7273 7274 7275# https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_strip_nulls 7276class JSONStripNulls(Func): 7277 arg_types = { 7278 "this": True, 7279 "expression": False, 7280 "include_arrays": False, 7281 "remove_empty": False, 7282 } 7283 _sql_names = ["JSON_STRIP_NULLS"] 7284 7285 7286# https://dev.mysql.com/doc/refman/8.4/en/json-search-functions.html#function_json-value 7287class JSONValue(Expression): 7288 arg_types = { 7289 "this": True, 7290 "path": True, 7291 "returning": False, 7292 "on_condition": False, 7293 } 7294 7295 7296class JSONValueArray(Func): 7297 arg_types = {"this": True, "expression": False} 7298 7299 7300class JSONRemove(Func): 7301 arg_types = {"this": True, "expressions": True} 7302 is_var_len_args = True 7303 _sql_names = ["JSON_REMOVE"] 7304 7305 7306# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_TABLE.html 7307class JSONTable(Func): 7308 arg_types = { 7309 "this": True, 7310 "schema": True, 7311 "path": False, 7312 "error_handling": False, 7313 "empty_handling": False, 7314 } 7315 7316 7317# https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_type 7318# https://doris.apache.org/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-type#description 7319class JSONType(Func): 7320 arg_types = {"this": True, "expression": False} 7321 _sql_names = ["JSON_TYPE"] 7322 7323 7324# https://docs.snowflake.com/en/sql-reference/functions/object_insert 7325class ObjectInsert(Func): 7326 arg_types = { 7327 "this": True, 7328 "key": True, 7329 "value": True, 7330 "update_flag": False, 7331 } 7332 7333 7334class OpenJSONColumnDef(Expression): 7335 arg_types = {"this": True, "kind": True, "path": False, "as_json": False} 7336 7337 7338class OpenJSON(Func): 7339 arg_types = {"this": True, "path": False, "expressions": False} 7340 7341 7342class JSONBContains(Binary, Func): 7343 _sql_names = ["JSONB_CONTAINS"] 7344 7345 7346# https://www.postgresql.org/docs/9.5/functions-json.html 7347class JSONBContainsAnyTopKeys(Binary, Func): 7348 pass 7349 7350 7351# https://www.postgresql.org/docs/9.5/functions-json.html 7352class JSONBContainsAllTopKeys(Binary, Func): 7353 pass 7354 7355 7356class JSONBExists(Func): 7357 arg_types = {"this": True, "path": True} 7358 _sql_names = ["JSONB_EXISTS"] 7359 7360 7361# https://www.postgresql.org/docs/9.5/functions-json.html 7362class JSONBDeleteAtPath(Binary, Func): 7363 pass 7364 7365 7366class JSONExtract(Binary, Func): 7367 arg_types = { 7368 "this": True, 7369 "expression": True, 7370 "only_json_types": False, 7371 "expressions": False, 7372 "variant_extract": False, 7373 "json_query": False, 7374 "option": False, 7375 "quote": False, 7376 "on_condition": False, 7377 "requires_json": False, 7378 } 7379 _sql_names = ["JSON_EXTRACT"] 7380 is_var_len_args = True 7381 7382 @property 7383 def output_name(self) -> str: 7384 return self.expression.output_name if not self.expressions else "" 7385 7386 7387# https://trino.io/docs/current/functions/json.html#json-query 7388class JSONExtractQuote(Expression): 7389 arg_types = { 7390 "option": True, 7391 "scalar": False, 7392 } 7393 7394 7395class JSONExtractArray(Func): 7396 arg_types = {"this": True, "expression": False} 7397 _sql_names = ["JSON_EXTRACT_ARRAY"] 7398 7399 7400class JSONExtractScalar(Binary, Func): 7401 arg_types = { 7402 "this": True, 7403 "expression": True, 7404 "only_json_types": False, 7405 "expressions": False, 7406 "json_type": False, 7407 "scalar_only": False, 7408 } 7409 _sql_names = ["JSON_EXTRACT_SCALAR"] 7410 is_var_len_args = True 7411 7412 @property 7413 def output_name(self) -> str: 7414 return self.expression.output_name 7415 7416 7417class JSONBExtract(Binary, Func): 7418 _sql_names = ["JSONB_EXTRACT"] 7419 7420 7421class JSONBExtractScalar(Binary, Func): 7422 arg_types = {"this": True, "expression": True, "json_type": False} 7423 _sql_names = ["JSONB_EXTRACT_SCALAR"] 7424 7425 7426class JSONFormat(Func): 7427 arg_types = {"this": False, "options": False, "is_json": False, "to_json": False} 7428 _sql_names = ["JSON_FORMAT"] 7429 7430 7431class JSONArrayAppend(Func): 7432 arg_types = {"this": True, "expressions": True} 7433 is_var_len_args = True 7434 _sql_names = ["JSON_ARRAY_APPEND"] 7435 7436 7437# https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#operator_member-of 7438class JSONArrayContains(Binary, Predicate, Func): 7439 arg_types = {"this": True, "expression": True, "json_type": False} 7440 _sql_names = ["JSON_ARRAY_CONTAINS"] 7441 7442 7443class JSONArrayInsert(Func): 7444 arg_types = {"this": True, "expressions": True} 7445 is_var_len_args = True 7446 _sql_names = ["JSON_ARRAY_INSERT"] 7447 7448 7449class ParseBignumeric(Func): 7450 pass 7451 7452 7453class ParseNumeric(Func): 7454 pass 7455 7456 7457class ParseJSON(Func): 7458 # BigQuery, Snowflake have PARSE_JSON, Presto has JSON_PARSE 7459 # Snowflake also has TRY_PARSE_JSON, which is represented using `safe` 7460 _sql_names = ["PARSE_JSON", "JSON_PARSE"] 7461 arg_types = {"this": True, "expression": False, "safe": False} 7462 7463 7464# Snowflake: https://docs.snowflake.com/en/sql-reference/functions/parse_url 7465# Databricks: https://docs.databricks.com/aws/en/sql/language-manual/functions/parse_url 7466class ParseUrl(Func): 7467 arg_types = {"this": True, "part_to_extract": False, "key": False, "permissive": False} 7468 7469 7470class ParseIp(Func): 7471 arg_types = {"this": True, "type": True, "permissive": False} 7472 7473 7474class ParseTime(Func): 7475 arg_types = {"this": True, "format": True} 7476 7477 7478class ParseDatetime(Func): 7479 arg_types = {"this": True, "format": False, "zone": False} 7480 7481 7482class Least(Func): 7483 arg_types = {"this": True, "expressions": False, "ignore_nulls": True} 7484 is_var_len_args = True 7485 7486 7487class Left(Func): 7488 arg_types = {"this": True, "expression": True} 7489 7490 7491class Right(Func): 7492 arg_types = {"this": True, "expression": True} 7493 7494 7495class Reverse(Func): 7496 pass 7497 7498 7499class Length(Func): 7500 arg_types = {"this": True, "binary": False, "encoding": False} 7501 _sql_names = ["LENGTH", "LEN", "CHAR_LENGTH", "CHARACTER_LENGTH"] 7502 7503 7504class RtrimmedLength(Func): 7505 pass 7506 7507 7508class BitLength(Func): 7509 pass 7510 7511 7512class Levenshtein(Func): 7513 arg_types = { 7514 "this": True, 7515 "expression": False, 7516 "ins_cost": False, 7517 "del_cost": False, 7518 "sub_cost": False, 7519 "max_dist": False, 7520 } 7521 7522 7523class Ln(Func): 7524 pass 7525 7526 7527class Log(Func): 7528 arg_types = {"this": True, "expression": False} 7529 7530 7531class LogicalOr(AggFunc): 7532 _sql_names = ["LOGICAL_OR", "BOOL_OR", "BOOLOR_AGG"] 7533 7534 7535class LogicalAnd(AggFunc): 7536 _sql_names = ["LOGICAL_AND", "BOOL_AND", "BOOLAND_AGG"] 7537 7538 7539class Lower(Func): 7540 _sql_names = ["LOWER", "LCASE"] 7541 7542 7543class Map(Func): 7544 arg_types = {"keys": False, "values": False} 7545 7546 @property 7547 def keys(self) -> t.List[Expression]: 7548 keys = self.args.get("keys") 7549 return keys.expressions if keys else [] 7550 7551 @property 7552 def values(self) -> t.List[Expression]: 7553 values = self.args.get("values") 7554 return values.expressions if values else [] 7555 7556 7557# Represents the MAP {...} syntax in DuckDB - basically convert a struct to a MAP 7558class ToMap(Func): 7559 pass 7560 7561 7562class MapFromEntries(Func): 7563 pass 7564 7565 7566class MapCat(Func): 7567 arg_types = {"this": True, "expression": True} 7568 7569 7570class MapContainsKey(Func): 7571 arg_types = {"this": True, "key": True} 7572 7573 7574class MapDelete(Func): 7575 arg_types = {"this": True, "expressions": True} 7576 is_var_len_args = True 7577 7578 7579class MapInsert(Func): 7580 arg_types = {"this": True, "key": False, "value": True, "update_flag": False} 7581 7582 7583class MapKeys(Func): 7584 pass 7585 7586 7587class MapPick(Func): 7588 arg_types = {"this": True, "expressions": True} 7589 is_var_len_args = True 7590 7591 7592class MapSize(Func): 7593 pass 7594 7595 7596# https://learn.microsoft.com/en-us/sql/t-sql/language-elements/scope-resolution-operator-transact-sql?view=sql-server-ver16 7597class ScopeResolution(Expression): 7598 arg_types = {"this": False, "expression": True} 7599 7600 7601class Slice(Expression): 7602 arg_types = {"this": False, "expression": False, "step": False} 7603 7604 7605class Stream(Expression): 7606 pass 7607 7608 7609class StarMap(Func): 7610 pass 7611 7612 7613class VarMap(Func): 7614 arg_types = {"keys": True, "values": True} 7615 is_var_len_args = True 7616 7617 @property 7618 def keys(self) -> t.List[Expression]: 7619 return self.args["keys"].expressions 7620 7621 @property 7622 def values(self) -> t.List[Expression]: 7623 return self.args["values"].expressions 7624 7625 7626# https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html 7627class MatchAgainst(Func): 7628 arg_types = {"this": True, "expressions": True, "modifier": False} 7629 7630 7631class Max(AggFunc): 7632 arg_types = {"this": True, "expressions": False} 7633 is_var_len_args = True 7634 7635 7636class MD5(Func): 7637 _sql_names = ["MD5"] 7638 7639 7640# Represents the variant of the MD5 function that returns a binary value 7641# Var len args due to Exasol: 7642# https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hashtype_md5.htm 7643class MD5Digest(Func): 7644 arg_types = {"this": True, "expressions": False} 7645 is_var_len_args = True 7646 _sql_names = ["MD5_DIGEST"] 7647 7648 7649# https://docs.snowflake.com/en/sql-reference/functions/md5_number_lower64 7650class MD5NumberLower64(Func): 7651 pass 7652 7653 7654# https://docs.snowflake.com/en/sql-reference/functions/md5_number_upper64 7655class MD5NumberUpper64(Func): 7656 pass 7657 7658 7659class Median(AggFunc): 7660 pass 7661 7662 7663class Mode(AggFunc): 7664 arg_types = {"this": False, "deterministic": False} 7665 7666 7667class Min(AggFunc): 7668 arg_types = {"this": True, "expressions": False} 7669 is_var_len_args = True 7670 7671 7672class Month(Func): 7673 pass 7674 7675 7676class Monthname(Func): 7677 arg_types = {"this": True, "abbreviated": False} 7678 7679 7680class AddMonths(Func): 7681 arg_types = {"this": True, "expression": True, "preserve_end_of_month": False} 7682 7683 7684class Nvl2(Func): 7685 arg_types = {"this": True, "true": True, "false": False} 7686 7687 7688class Ntile(AggFunc): 7689 arg_types = {"this": False} 7690 7691 7692class Normalize(Func): 7693 arg_types = {"this": True, "form": False, "is_casefold": False} 7694 7695 7696class Normal(Func): 7697 arg_types = {"this": True, "stddev": True, "gen": True} 7698 7699 7700# https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/net_functions 7701class NetFunc(Func): 7702 pass 7703 7704 7705# https://cloud.google.com/bigquery/docs/reference/standard-sql/net_functions#nethost 7706class Host(Func): 7707 pass 7708 7709 7710# https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/net_functions#netreg_domain 7711class RegDomain(Func): 7712 pass 7713 7714 7715class Overlay(Func): 7716 arg_types = {"this": True, "expression": True, "from_": True, "for_": False} 7717 7718 7719# https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict#mlpredict_function 7720class Predict(Func): 7721 arg_types = {"this": True, "expression": True, "params_struct": False} 7722 7723 7724# https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-translate#mltranslate_function 7725class MLTranslate(Func): 7726 arg_types = {"this": True, "expression": True, "params_struct": True} 7727 7728 7729# https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-feature-time 7730class FeaturesAtTime(Func): 7731 arg_types = {"this": True, "time": False, "num_rows": False, "ignore_feature_nulls": False} 7732 7733 7734# https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-generate-embedding 7735class GenerateEmbedding(Func): 7736 arg_types = {"this": True, "expression": True, "params_struct": False, "is_text": False} 7737 7738 7739class MLForecast(Func): 7740 arg_types = {"this": True, "expression": False, "params_struct": False} 7741 7742 7743# Represents Snowflake's <model>!<attribute> syntax. For example: SELECT model!PREDICT(INPUT_DATA => {*}) 7744# See: https://docs.snowflake.com/en/guides-overview-ml-functions 7745class ModelAttribute(Expression): 7746 arg_types = {"this": True, "expression": True} 7747 7748 7749# https://cloud.google.com/bigquery/docs/reference/standard-sql/search_functions#vector_search 7750class VectorSearch(Func): 7751 arg_types = { 7752 "this": True, 7753 "column_to_search": True, 7754 "query_table": True, 7755 "query_column_to_search": False, 7756 "top_k": False, 7757 "distance_type": False, 7758 "options": False, 7759 } 7760 7761 7762class Pi(Func): 7763 arg_types = {} 7764 7765 7766class Pow(Binary, Func): 7767 _sql_names = ["POWER", "POW"] 7768 7769 7770class PercentileCont(AggFunc): 7771 arg_types = {"this": True, "expression": False} 7772 7773 7774class PercentileDisc(AggFunc): 7775 arg_types = {"this": True, "expression": False} 7776 7777 7778class PercentRank(AggFunc): 7779 arg_types = {"expressions": False} 7780 is_var_len_args = True 7781 7782 7783class Quantile(AggFunc): 7784 arg_types = {"this": True, "quantile": True} 7785 7786 7787class ApproxQuantile(Quantile): 7788 arg_types = { 7789 "this": True, 7790 "quantile": True, 7791 "accuracy": False, 7792 "weight": False, 7793 "error_tolerance": False, 7794 } 7795 7796 7797# https://docs.snowflake.com/en/sql-reference/functions/approx_percentile_accumulate 7798class ApproxPercentileAccumulate(AggFunc): 7799 pass 7800 7801 7802# https://docs.snowflake.com/en/sql-reference/functions/approx_percentile_estimate 7803class ApproxPercentileEstimate(Func): 7804 arg_types = {"this": True, "percentile": True} 7805 7806 7807class Quarter(Func): 7808 pass 7809 7810 7811# https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/SQL-Functions-Expressions-and-Predicates/Arithmetic-Trigonometric-Hyperbolic-Operators/Functions/RANDOM/RANDOM-Function-Syntax 7812# teradata lower and upper bounds 7813class Rand(Func): 7814 _sql_names = ["RAND", "RANDOM"] 7815 arg_types = {"this": False, "lower": False, "upper": False} 7816 7817 7818class Randn(Func): 7819 arg_types = {"this": False} 7820 7821 7822class Randstr(Func): 7823 arg_types = {"this": True, "generator": False} 7824 7825 7826class RangeN(Func): 7827 arg_types = {"this": True, "expressions": True, "each": False} 7828 7829 7830class RangeBucket(Func): 7831 arg_types = {"this": True, "expression": True} 7832 7833 7834class Rank(AggFunc): 7835 arg_types = {"expressions": False} 7836 is_var_len_args = True 7837 7838 7839class ReadCSV(Func): 7840 _sql_names = ["READ_CSV"] 7841 is_var_len_args = True 7842 arg_types = {"this": True, "expressions": False} 7843 7844 7845class ReadParquet(Func): 7846 is_var_len_args = True 7847 arg_types = {"expressions": True} 7848 7849 7850class Reduce(Func): 7851 arg_types = {"this": True, "initial": True, "merge": True, "finish": False} 7852 7853 7854class RegexpExtract(Func): 7855 arg_types = { 7856 "this": True, 7857 "expression": True, 7858 "position": False, 7859 "occurrence": False, 7860 "parameters": False, 7861 "group": False, 7862 "null_if_pos_overflow": False, # for transpilation target behavior 7863 } 7864 7865 7866class RegexpExtractAll(Func): 7867 arg_types = { 7868 "this": True, 7869 "expression": True, 7870 "group": False, 7871 "parameters": False, 7872 "position": False, 7873 "occurrence": False, 7874 } 7875 7876 7877class RegexpReplace(Func): 7878 arg_types = { 7879 "this": True, 7880 "expression": True, 7881 "replacement": False, 7882 "position": False, 7883 "occurrence": False, 7884 "modifiers": False, 7885 "single_replace": False, 7886 } 7887 7888 7889class RegexpLike(Binary, Func): 7890 arg_types = {"this": True, "expression": True, "flag": False} 7891 7892 7893class RegexpILike(Binary, Func): 7894 arg_types = {"this": True, "expression": True, "flag": False} 7895 7896 7897class RegexpFullMatch(Binary, Func): 7898 arg_types = {"this": True, "expression": True, "options": False} 7899 7900 7901class RegexpInstr(Func): 7902 arg_types = { 7903 "this": True, 7904 "expression": True, 7905 "position": False, 7906 "occurrence": False, 7907 "option": False, 7908 "parameters": False, 7909 "group": False, 7910 } 7911 7912 7913# https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.split.html 7914# limit is the number of times a pattern is applied 7915class RegexpSplit(Func): 7916 arg_types = {"this": True, "expression": True, "limit": False} 7917 7918 7919class RegexpCount(Func): 7920 arg_types = { 7921 "this": True, 7922 "expression": True, 7923 "position": False, 7924 "parameters": False, 7925 } 7926 7927 7928class RegrValx(AggFunc): 7929 arg_types = {"this": True, "expression": True} 7930 7931 7932class RegrValy(AggFunc): 7933 arg_types = {"this": True, "expression": True} 7934 7935 7936class RegrAvgy(AggFunc): 7937 arg_types = {"this": True, "expression": True} 7938 7939 7940class RegrAvgx(AggFunc): 7941 arg_types = {"this": True, "expression": True} 7942 7943 7944class RegrCount(AggFunc): 7945 arg_types = {"this": True, "expression": True} 7946 7947 7948class RegrIntercept(AggFunc): 7949 arg_types = {"this": True, "expression": True} 7950 7951 7952class RegrR2(AggFunc): 7953 arg_types = {"this": True, "expression": True} 7954 7955 7956class RegrSxx(AggFunc): 7957 arg_types = {"this": True, "expression": True} 7958 7959 7960class RegrSxy(AggFunc): 7961 arg_types = {"this": True, "expression": True} 7962 7963 7964class RegrSyy(AggFunc): 7965 arg_types = {"this": True, "expression": True} 7966 7967 7968class RegrSlope(AggFunc): 7969 arg_types = {"this": True, "expression": True} 7970 7971 7972class Repeat(Func): 7973 arg_types = {"this": True, "times": True} 7974 7975 7976# Some dialects like Snowflake support two argument replace 7977class Replace(Func): 7978 arg_types = {"this": True, "expression": True, "replacement": False} 7979 7980 7981class Radians(Func): 7982 pass 7983 7984 7985# https://learn.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql?view=sql-server-ver16 7986# tsql third argument function == trunctaion if not 0 7987class Round(Func): 7988 arg_types = { 7989 "this": True, 7990 "decimals": False, 7991 "truncate": False, 7992 "casts_non_integer_decimals": False, 7993 } 7994 7995 7996class RowNumber(Func): 7997 arg_types = {"this": False} 7998 7999 8000class Seq1(Func): 8001 arg_types = {"this": False} 8002 8003 8004class Seq2(Func): 8005 arg_types = {"this": False} 8006 8007 8008class Seq4(Func): 8009 arg_types = {"this": False} 8010 8011 8012class Seq8(Func): 8013 arg_types = {"this": False} 8014 8015 8016class SafeAdd(Func): 8017 arg_types = {"this": True, "expression": True} 8018 8019 8020class SafeDivide(Func): 8021 arg_types = {"this": True, "expression": True} 8022 8023 8024class SafeMultiply(Func): 8025 arg_types = {"this": True, "expression": True} 8026 8027 8028class SafeNegate(Func): 8029 pass 8030 8031 8032class SafeSubtract(Func): 8033 arg_types = {"this": True, "expression": True} 8034 8035 8036class SafeConvertBytesToString(Func): 8037 pass 8038 8039 8040class SHA(Func): 8041 _sql_names = ["SHA", "SHA1"] 8042 8043 8044class SHA2(Func): 8045 _sql_names = ["SHA2"] 8046 arg_types = {"this": True, "length": False} 8047 8048 8049# Represents the variant of the SHA1 function that returns a binary value 8050class SHA1Digest(Func): 8051 pass 8052 8053 8054# Represents the variant of the SHA2 function that returns a binary value 8055class SHA2Digest(Func): 8056 arg_types = {"this": True, "length": False} 8057 8058 8059class Sign(Func): 8060 _sql_names = ["SIGN", "SIGNUM"] 8061 8062 8063class SortArray(Func): 8064 arg_types = {"this": True, "asc": False, "nulls_first": False} 8065 8066 8067class Soundex(Func): 8068 pass 8069 8070 8071# https://docs.snowflake.com/en/sql-reference/functions/soundex_p123 8072class SoundexP123(Func): 8073 pass 8074 8075 8076class Split(Func): 8077 arg_types = {"this": True, "expression": True, "limit": False} 8078 8079 8080# https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.split_part.html 8081# https://docs.snowflake.com/en/sql-reference/functions/split_part 8082# https://docs.snowflake.com/en/sql-reference/functions/strtok 8083class SplitPart(Func): 8084 arg_types = {"this": True, "delimiter": False, "part_index": False} 8085 8086 8087# Start may be omitted in the case of postgres 8088# https://www.postgresql.org/docs/9.1/functions-string.html @ Table 9-6 8089class Substring(Func): 8090 _sql_names = ["SUBSTRING", "SUBSTR"] 8091 arg_types = {"this": True, "start": False, "length": False} 8092 8093 8094class SubstringIndex(Func): 8095 """ 8096 SUBSTRING_INDEX(str, delim, count) 8097 8098 *count* > 0 → left slice before the *count*-th delimiter 8099 *count* < 0 → right slice after the |count|-th delimiter 8100 """ 8101 8102 arg_types = {"this": True, "delimiter": True, "count": True} 8103 8104 8105class StandardHash(Func): 8106 arg_types = {"this": True, "expression": False} 8107 8108 8109class StartsWith(Func): 8110 _sql_names = ["STARTS_WITH", "STARTSWITH"] 8111 arg_types = {"this": True, "expression": True} 8112 8113 8114class EndsWith(Func): 8115 _sql_names = ["ENDS_WITH", "ENDSWITH"] 8116 arg_types = {"this": True, "expression": True} 8117 8118 8119class StrPosition(Func): 8120 arg_types = { 8121 "this": True, 8122 "substr": True, 8123 "position": False, 8124 "occurrence": False, 8125 } 8126 8127 8128# Snowflake: https://docs.snowflake.com/en/sql-reference/functions/search 8129# BigQuery: https://cloud.google.com/bigquery/docs/reference/standard-sql/search_functions#search 8130class Search(Func): 8131 arg_types = { 8132 "this": True, # data_to_search / search_data 8133 "expression": True, # search_query / search_string 8134 "json_scope": False, # BigQuery: JSON_VALUES | JSON_KEYS | JSON_KEYS_AND_VALUES 8135 "analyzer": False, # Both: analyzer / ANALYZER 8136 "analyzer_options": False, # BigQuery: analyzer_options_values 8137 "search_mode": False, # Snowflake: OR | AND 8138 } 8139 8140 8141# Snowflake: https://docs.snowflake.com/en/sql-reference/functions/search_ip 8142class SearchIp(Func): 8143 arg_types = {"this": True, "expression": True} 8144 8145 8146class StrToDate(Func): 8147 arg_types = {"this": True, "format": False, "safe": False} 8148 8149 8150class StrToTime(Func): 8151 arg_types = {"this": True, "format": True, "zone": False, "safe": False, "target_type": False} 8152 8153 8154# Spark allows unix_timestamp() 8155# https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.unix_timestamp.html 8156class StrToUnix(Func): 8157 arg_types = {"this": False, "format": False} 8158 8159 8160# https://prestodb.io/docs/current/functions/string.html 8161# https://spark.apache.org/docs/latest/api/sql/index.html#str_to_map 8162class StrToMap(Func): 8163 arg_types = { 8164 "this": True, 8165 "pair_delim": False, 8166 "key_value_delim": False, 8167 "duplicate_resolution_callback": False, 8168 } 8169 8170 8171class NumberToStr(Func): 8172 arg_types = {"this": True, "format": True, "culture": False} 8173 8174 8175class FromBase(Func): 8176 arg_types = {"this": True, "expression": True} 8177 8178 8179class Space(Func): 8180 """ 8181 SPACE(n) → string consisting of n blank characters 8182 """ 8183 8184 pass 8185 8186 8187class Struct(Func): 8188 arg_types = {"expressions": False} 8189 is_var_len_args = True 8190 8191 8192class StructExtract(Func): 8193 arg_types = {"this": True, "expression": True} 8194 8195 8196# https://learn.microsoft.com/en-us/sql/t-sql/functions/stuff-transact-sql?view=sql-server-ver16 8197# https://docs.snowflake.com/en/sql-reference/functions/insert 8198class Stuff(Func): 8199 _sql_names = ["STUFF", "INSERT"] 8200 arg_types = {"this": True, "start": True, "length": True, "expression": True} 8201 8202 8203class Sum(AggFunc): 8204 pass 8205 8206 8207class Sqrt(Func): 8208 pass 8209 8210 8211class Stddev(AggFunc): 8212 _sql_names = ["STDDEV", "STDEV"] 8213 8214 8215class StddevPop(AggFunc): 8216 pass 8217 8218 8219class StddevSamp(AggFunc): 8220 pass 8221 8222 8223# https://cloud.google.com/bigquery/docs/reference/standard-sql/time_functions#time 8224class Time(Func): 8225 arg_types = {"this": False, "zone": False} 8226 8227 8228class TimeToStr(Func): 8229 arg_types = {"this": True, "format": True, "culture": False, "zone": False} 8230 8231 8232class TimeToTimeStr(Func): 8233 pass 8234 8235 8236class TimeToUnix(Func): 8237 pass 8238 8239 8240class TimeStrToDate(Func): 8241 pass 8242 8243 8244class TimeStrToTime(Func): 8245 arg_types = {"this": True, "zone": False} 8246 8247 8248class TimeStrToUnix(Func): 8249 pass 8250 8251 8252class Trim(Func): 8253 arg_types = { 8254 "this": True, 8255 "expression": False, 8256 "position": False, 8257 "collation": False, 8258 } 8259 8260 8261class TsOrDsAdd(Func, TimeUnit): 8262 # return_type is used to correctly cast the arguments of this expression when transpiling it 8263 arg_types = {"this": True, "expression": True, "unit": False, "return_type": False} 8264 8265 @property 8266 def return_type(self) -> DataType: 8267 return DataType.build(self.args.get("return_type") or DataType.Type.DATE) 8268 8269 8270class TsOrDsDiff(Func, TimeUnit): 8271 arg_types = {"this": True, "expression": True, "unit": False} 8272 8273 8274class TsOrDsToDateStr(Func): 8275 pass 8276 8277 8278class TsOrDsToDate(Func): 8279 arg_types = {"this": True, "format": False, "safe": False} 8280 8281 8282class TsOrDsToDatetime(Func): 8283 pass 8284 8285 8286class TsOrDsToTime(Func): 8287 arg_types = {"this": True, "format": False, "safe": False} 8288 8289 8290class TsOrDsToTimestamp(Func): 8291 pass 8292 8293 8294class TsOrDiToDi(Func): 8295 pass 8296 8297 8298class Unhex(Func): 8299 arg_types = {"this": True, "expression": False} 8300 8301 8302class Unicode(Func): 8303 pass 8304 8305 8306class Uniform(Func): 8307 arg_types = {"this": True, "expression": True, "gen": False, "seed": False} 8308 8309 8310# https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#unix_date 8311class UnixDate(Func): 8312 pass 8313 8314 8315class UnixToStr(Func): 8316 arg_types = {"this": True, "format": False} 8317 8318 8319# https://prestodb.io/docs/current/functions/datetime.html 8320# presto has weird zone/hours/minutes 8321class UnixToTime(Func): 8322 arg_types = { 8323 "this": True, 8324 "scale": False, 8325 "zone": False, 8326 "hours": False, 8327 "minutes": False, 8328 "format": False, 8329 "target_type": False, 8330 } 8331 8332 SECONDS = Literal.number(0) 8333 DECIS = Literal.number(1) 8334 CENTIS = Literal.number(2) 8335 MILLIS = Literal.number(3) 8336 DECIMILLIS = Literal.number(4) 8337 CENTIMILLIS = Literal.number(5) 8338 MICROS = Literal.number(6) 8339 DECIMICROS = Literal.number(7) 8340 CENTIMICROS = Literal.number(8) 8341 NANOS = Literal.number(9) 8342 8343 8344class UnixToTimeStr(Func): 8345 pass 8346 8347 8348class UnixSeconds(Func): 8349 pass 8350 8351 8352class UnixMicros(Func): 8353 pass 8354 8355 8356class UnixMillis(Func): 8357 pass 8358 8359 8360class Uuid(Func): 8361 _sql_names = ["UUID", "GEN_RANDOM_UUID", "GENERATE_UUID", "UUID_STRING"] 8362 8363 arg_types = {"this": False, "name": False, "is_string": False} 8364 8365 8366TIMESTAMP_PARTS = { 8367 "year": False, 8368 "month": False, 8369 "day": False, 8370 "hour": False, 8371 "min": False, 8372 "sec": False, 8373 "nano": False, 8374} 8375 8376 8377class TimestampFromParts(Func): 8378 _sql_names = ["TIMESTAMP_FROM_PARTS", "TIMESTAMPFROMPARTS"] 8379 arg_types = { 8380 **TIMESTAMP_PARTS, 8381 "zone": False, 8382 "milli": False, 8383 "this": False, 8384 "expression": False, 8385 } 8386 8387 8388class TimestampLtzFromParts(Func): 8389 _sql_names = ["TIMESTAMP_LTZ_FROM_PARTS", "TIMESTAMPLTZFROMPARTS"] 8390 arg_types = TIMESTAMP_PARTS.copy() 8391 8392 8393class TimestampTzFromParts(Func): 8394 _sql_names = ["TIMESTAMP_TZ_FROM_PARTS", "TIMESTAMPTZFROMPARTS"] 8395 arg_types = { 8396 **TIMESTAMP_PARTS, 8397 "zone": False, 8398 } 8399 8400 8401class Upper(Func): 8402 _sql_names = ["UPPER", "UCASE"] 8403 8404 8405class Corr(Binary, AggFunc): 8406 # Correlation divides by variance(column). If a column has 0 variance, the denominator 8407 # is 0 - some dialects return NaN (DuckDB) while others return NULL (Snowflake). 8408 # `null_on_zero_variance` is set to True at parse time for dialects that return NULL. 8409 arg_types = {"this": True, "expression": True, "null_on_zero_variance": False} 8410 8411 8412# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CUME_DIST.html 8413class CumeDist(AggFunc): 8414 arg_types = {"expressions": False} 8415 is_var_len_args = True 8416 8417 8418class Variance(AggFunc): 8419 _sql_names = ["VARIANCE", "VARIANCE_SAMP", "VAR_SAMP"] 8420 8421 8422class VariancePop(AggFunc): 8423 _sql_names = ["VARIANCE_POP", "VAR_POP"] 8424 8425 8426class Kurtosis(AggFunc): 8427 pass 8428 8429 8430class Skewness(AggFunc): 8431 pass 8432 8433 8434class WidthBucket(Func): 8435 arg_types = { 8436 "this": True, 8437 "min_value": False, 8438 "max_value": False, 8439 "num_buckets": False, 8440 "threshold": False, 8441 } 8442 8443 8444class CovarSamp(AggFunc): 8445 arg_types = {"this": True, "expression": True} 8446 8447 8448class CovarPop(AggFunc): 8449 arg_types = {"this": True, "expression": True} 8450 8451 8452class Week(Func): 8453 arg_types = {"this": True, "mode": False} 8454 8455 8456class WeekStart(Expression): 8457 pass 8458 8459 8460class NextDay(Func): 8461 arg_types = {"this": True, "expression": True} 8462 8463 8464class XMLElement(Func): 8465 _sql_names = ["XMLELEMENT"] 8466 arg_types = {"this": True, "expressions": False, "evalname": False} 8467 8468 8469class XMLGet(Func): 8470 _sql_names = ["XMLGET"] 8471 arg_types = {"this": True, "expression": True, "instance": False} 8472 8473 8474class XMLTable(Func): 8475 arg_types = { 8476 "this": True, 8477 "namespaces": False, 8478 "passing": False, 8479 "columns": False, 8480 "by_ref": False, 8481 } 8482 8483 8484class XMLNamespace(Expression): 8485 pass 8486 8487 8488# https://learn.microsoft.com/en-us/sql/t-sql/queries/select-for-clause-transact-sql?view=sql-server-ver17#syntax 8489class XMLKeyValueOption(Expression): 8490 arg_types = {"this": True, "expression": False} 8491 8492 8493class Year(Func): 8494 pass 8495 8496 8497class Zipf(Func): 8498 arg_types = {"this": True, "elementcount": True, "gen": True} 8499 8500 8501class Use(Expression): 8502 arg_types = {"this": False, "expressions": False, "kind": False} 8503 8504 8505class Merge(DML): 8506 arg_types = { 8507 "this": True, 8508 "using": True, 8509 "on": False, 8510 "using_cond": False, 8511 "whens": True, 8512 "with_": False, 8513 "returning": False, 8514 } 8515 8516 8517class When(Expression): 8518 arg_types = {"matched": True, "source": False, "condition": False, "then": True} 8519 8520 8521class Whens(Expression): 8522 """Wraps around one or more WHEN [NOT] MATCHED [...] clauses.""" 8523 8524 arg_types = {"expressions": True} 8525 8526 8527# https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqljnextvaluefor.html 8528# https://learn.microsoft.com/en-us/sql/t-sql/functions/next-value-for-transact-sql?view=sql-server-ver16 8529class NextValueFor(Func): 8530 arg_types = {"this": True, "order": False} 8531 8532 8533# Refers to a trailing semi-colon. This is only used to preserve trailing comments 8534# select 1; -- my comment 8535class Semicolon(Expression): 8536 arg_types = {} 8537 8538 8539# BigQuery allows SELECT t FROM t and treats the projection as a struct value. This expression 8540# type is intended to be constructed by qualify so that we can properly annotate its type later 8541class TableColumn(Expression): 8542 pass 8543 8544 8545# https://www.postgresql.org/docs/current/typeconv-func.html 8546# https://www.postgresql.org/docs/current/xfunc-sql.html 8547class Variadic(Expression): 8548 pass 8549 8550 8551ALL_FUNCTIONS = subclasses(__name__, Func, {AggFunc, Anonymous, Func}) 8552FUNCTION_BY_NAME = {name: func for func in ALL_FUNCTIONS for name in func.sql_names()} 8553 8554JSON_PATH_PARTS = subclasses(__name__, JSONPathPart, {JSONPathPart}) 8555 8556PERCENTILES = (PercentileCont, PercentileDisc) 8557 8558 8559# Helpers 8560@t.overload 8561def maybe_parse( 8562 sql_or_expression: ExpOrStr, 8563 *, 8564 into: t.Type[E], 8565 dialect: DialectType = None, 8566 prefix: t.Optional[str] = None, 8567 copy: bool = False, 8568 **opts, 8569) -> E: ... 8570 8571 8572@t.overload 8573def maybe_parse( 8574 sql_or_expression: str | E, 8575 *, 8576 into: t.Optional[IntoType] = None, 8577 dialect: DialectType = None, 8578 prefix: t.Optional[str] = None, 8579 copy: bool = False, 8580 **opts, 8581) -> E: ... 8582 8583 8584def maybe_parse( 8585 sql_or_expression: ExpOrStr, 8586 *, 8587 into: t.Optional[IntoType] = None, 8588 dialect: DialectType = None, 8589 prefix: t.Optional[str] = None, 8590 copy: bool = False, 8591 **opts, 8592) -> Expression: 8593 """Gracefully handle a possible string or expression. 8594 8595 Example: 8596 >>> maybe_parse("1") 8597 Literal(this=1, is_string=False) 8598 >>> maybe_parse(to_identifier("x")) 8599 Identifier(this=x, quoted=False) 8600 8601 Args: 8602 sql_or_expression: the SQL code string or an expression 8603 into: the SQLGlot Expression to parse into 8604 dialect: the dialect used to parse the input expressions (in the case that an 8605 input expression is a SQL string). 8606 prefix: a string to prefix the sql with before it gets parsed 8607 (automatically includes a space) 8608 copy: whether to copy the expression. 8609 **opts: other options to use to parse the input expressions (again, in the case 8610 that an input expression is a SQL string). 8611 8612 Returns: 8613 Expression: the parsed or given expression. 8614 """ 8615 if isinstance(sql_or_expression, Expression): 8616 if copy: 8617 return sql_or_expression.copy() 8618 return sql_or_expression 8619 8620 if sql_or_expression is None: 8621 raise ParseError("SQL cannot be None") 8622 8623 import sqlglot 8624 8625 sql = str(sql_or_expression) 8626 if prefix: 8627 sql = f"{prefix} {sql}" 8628 8629 return sqlglot.parse_one(sql, read=dialect, into=into, **opts) 8630 8631 8632@t.overload 8633def maybe_copy(instance: None, copy: bool = True) -> None: ... 8634 8635 8636@t.overload 8637def maybe_copy(instance: E, copy: bool = True) -> E: ... 8638 8639 8640def maybe_copy(instance, copy=True): 8641 return instance.copy() if copy and instance else instance 8642 8643 8644def _to_s(node: t.Any, verbose: bool = False, level: int = 0, repr_str: bool = False) -> str: 8645 """Generate a textual representation of an Expression tree""" 8646 indent = "\n" + (" " * (level + 1)) 8647 delim = f",{indent}" 8648 8649 if isinstance(node, Expression): 8650 args = {k: v for k, v in node.args.items() if (v is not None and v != []) or verbose} 8651 8652 if (node.type or verbose) and not isinstance(node, DataType): 8653 args["_type"] = node.type 8654 if node.comments or verbose: 8655 args["_comments"] = node.comments 8656 8657 if verbose: 8658 args["_id"] = id(node) 8659 8660 # Inline leaves for a more compact representation 8661 if node.is_leaf(): 8662 indent = "" 8663 delim = ", " 8664 8665 repr_str = node.is_string or (isinstance(node, Identifier) and node.quoted) 8666 items = delim.join( 8667 [f"{k}={_to_s(v, verbose, level + 1, repr_str=repr_str)}" for k, v in args.items()] 8668 ) 8669 return f"{node.__class__.__name__}({indent}{items})" 8670 8671 if isinstance(node, list): 8672 items = delim.join(_to_s(i, verbose, level + 1) for i in node) 8673 items = f"{indent}{items}" if items else "" 8674 return f"[{items}]" 8675 8676 # We use the representation of the string to avoid stripping out important whitespace 8677 if repr_str and isinstance(node, str): 8678 node = repr(node) 8679 8680 # Indent multiline strings to match the current level 8681 return indent.join(textwrap.dedent(str(node).strip("\n")).splitlines()) 8682 8683 8684def _is_wrong_expression(expression, into): 8685 return isinstance(expression, Expression) and not isinstance(expression, into) 8686 8687 8688def _apply_builder( 8689 expression, 8690 instance, 8691 arg, 8692 copy=True, 8693 prefix=None, 8694 into=None, 8695 dialect=None, 8696 into_arg="this", 8697 **opts, 8698): 8699 if _is_wrong_expression(expression, into): 8700 expression = into(**{into_arg: expression}) 8701 instance = maybe_copy(instance, copy) 8702 expression = maybe_parse( 8703 sql_or_expression=expression, 8704 prefix=prefix, 8705 into=into, 8706 dialect=dialect, 8707 **opts, 8708 ) 8709 instance.set(arg, expression) 8710 return instance 8711 8712 8713def _apply_child_list_builder( 8714 *expressions, 8715 instance, 8716 arg, 8717 append=True, 8718 copy=True, 8719 prefix=None, 8720 into=None, 8721 dialect=None, 8722 properties=None, 8723 **opts, 8724): 8725 instance = maybe_copy(instance, copy) 8726 parsed = [] 8727 properties = {} if properties is None else properties 8728 8729 for expression in expressions: 8730 if expression is not None: 8731 if _is_wrong_expression(expression, into): 8732 expression = into(expressions=[expression]) 8733 8734 expression = maybe_parse( 8735 expression, 8736 into=into, 8737 dialect=dialect, 8738 prefix=prefix, 8739 **opts, 8740 ) 8741 for k, v in expression.args.items(): 8742 if k == "expressions": 8743 parsed.extend(v) 8744 else: 8745 properties[k] = v 8746 8747 existing = instance.args.get(arg) 8748 if append and existing: 8749 parsed = existing.expressions + parsed 8750 8751 child = into(expressions=parsed) 8752 for k, v in properties.items(): 8753 child.set(k, v) 8754 instance.set(arg, child) 8755 8756 return instance 8757 8758 8759def _apply_list_builder( 8760 *expressions, 8761 instance, 8762 arg, 8763 append=True, 8764 copy=True, 8765 prefix=None, 8766 into=None, 8767 dialect=None, 8768 **opts, 8769): 8770 inst = maybe_copy(instance, copy) 8771 8772 expressions = [ 8773 maybe_parse( 8774 sql_or_expression=expression, 8775 into=into, 8776 prefix=prefix, 8777 dialect=dialect, 8778 **opts, 8779 ) 8780 for expression in expressions 8781 if expression is not None 8782 ] 8783 8784 existing_expressions = inst.args.get(arg) 8785 if append and existing_expressions: 8786 expressions = existing_expressions + expressions 8787 8788 inst.set(arg, expressions) 8789 return inst 8790 8791 8792def _apply_conjunction_builder( 8793 *expressions, 8794 instance, 8795 arg, 8796 into=None, 8797 append=True, 8798 copy=True, 8799 dialect=None, 8800 **opts, 8801): 8802 expressions = [exp for exp in expressions if exp is not None and exp != ""] 8803 if not expressions: 8804 return instance 8805 8806 inst = maybe_copy(instance, copy) 8807 8808 existing = inst.args.get(arg) 8809 if append and existing is not None: 8810 expressions = [existing.this if into else existing] + list(expressions) 8811 8812 node = and_(*expressions, dialect=dialect, copy=copy, **opts) 8813 8814 inst.set(arg, into(this=node) if into else node) 8815 return inst 8816 8817 8818def _apply_cte_builder( 8819 instance: E, 8820 alias: ExpOrStr, 8821 as_: ExpOrStr, 8822 recursive: t.Optional[bool] = None, 8823 materialized: t.Optional[bool] = None, 8824 append: bool = True, 8825 dialect: DialectType = None, 8826 copy: bool = True, 8827 scalar: t.Optional[bool] = None, 8828 **opts, 8829) -> E: 8830 alias_expression = maybe_parse(alias, dialect=dialect, into=TableAlias, **opts) 8831 as_expression = maybe_parse(as_, dialect=dialect, copy=copy, **opts) 8832 if scalar and not isinstance(as_expression, Subquery): 8833 # scalar CTE must be wrapped in a subquery 8834 as_expression = Subquery(this=as_expression) 8835 cte = CTE(this=as_expression, alias=alias_expression, materialized=materialized, scalar=scalar) 8836 return _apply_child_list_builder( 8837 cte, 8838 instance=instance, 8839 arg="with_", 8840 append=append, 8841 copy=copy, 8842 into=With, 8843 properties={"recursive": recursive} if recursive else {}, 8844 ) 8845 8846 8847def _combine( 8848 expressions: t.Sequence[t.Optional[ExpOrStr]], 8849 operator: t.Type[Connector], 8850 dialect: DialectType = None, 8851 copy: bool = True, 8852 wrap: bool = True, 8853 **opts, 8854) -> Expression: 8855 conditions = [ 8856 condition(expression, dialect=dialect, copy=copy, **opts) 8857 for expression in expressions 8858 if expression is not None 8859 ] 8860 8861 this, *rest = conditions 8862 if rest and wrap: 8863 this = _wrap(this, Connector) 8864 for expression in rest: 8865 this = operator(this=this, expression=_wrap(expression, Connector) if wrap else expression) 8866 8867 return this 8868 8869 8870@t.overload 8871def _wrap(expression: None, kind: t.Type[Expression]) -> None: ... 8872 8873 8874@t.overload 8875def _wrap(expression: E, kind: t.Type[Expression]) -> E | Paren: ... 8876 8877 8878def _wrap(expression: t.Optional[E], kind: t.Type[Expression]) -> t.Optional[E] | Paren: 8879 return Paren(this=expression) if isinstance(expression, kind) else expression 8880 8881 8882def _apply_set_operation( 8883 *expressions: ExpOrStr, 8884 set_operation: t.Type[S], 8885 distinct: bool = True, 8886 dialect: DialectType = None, 8887 copy: bool = True, 8888 **opts, 8889) -> S: 8890 return reduce( 8891 lambda x, y: set_operation(this=x, expression=y, distinct=distinct, **opts), 8892 (maybe_parse(e, dialect=dialect, copy=copy, **opts) for e in expressions), 8893 ) 8894 8895 8896def union( 8897 *expressions: ExpOrStr, 8898 distinct: bool = True, 8899 dialect: DialectType = None, 8900 copy: bool = True, 8901 **opts, 8902) -> Union: 8903 """ 8904 Initializes a syntax tree for the `UNION` operation. 8905 8906 Example: 8907 >>> union("SELECT * FROM foo", "SELECT * FROM bla").sql() 8908 'SELECT * FROM foo UNION SELECT * FROM bla' 8909 8910 Args: 8911 expressions: the SQL code strings, corresponding to the `UNION`'s operands. 8912 If `Expression` instances are passed, they will be used as-is. 8913 distinct: set the DISTINCT flag if and only if this is true. 8914 dialect: the dialect used to parse the input expression. 8915 copy: whether to copy the expression. 8916 opts: other options to use to parse the input expressions. 8917 8918 Returns: 8919 The new Union instance. 8920 """ 8921 assert len(expressions) >= 2, "At least two expressions are required by `union`." 8922 return _apply_set_operation( 8923 *expressions, set_operation=Union, distinct=distinct, dialect=dialect, copy=copy, **opts 8924 ) 8925 8926 8927def intersect( 8928 *expressions: ExpOrStr, 8929 distinct: bool = True, 8930 dialect: DialectType = None, 8931 copy: bool = True, 8932 **opts, 8933) -> Intersect: 8934 """ 8935 Initializes a syntax tree for the `INTERSECT` operation. 8936 8937 Example: 8938 >>> intersect("SELECT * FROM foo", "SELECT * FROM bla").sql() 8939 'SELECT * FROM foo INTERSECT SELECT * FROM bla' 8940 8941 Args: 8942 expressions: the SQL code strings, corresponding to the `INTERSECT`'s operands. 8943 If `Expression` instances are passed, they will be used as-is. 8944 distinct: set the DISTINCT flag if and only if this is true. 8945 dialect: the dialect used to parse the input expression. 8946 copy: whether to copy the expression. 8947 opts: other options to use to parse the input expressions. 8948 8949 Returns: 8950 The new Intersect instance. 8951 """ 8952 assert len(expressions) >= 2, "At least two expressions are required by `intersect`." 8953 return _apply_set_operation( 8954 *expressions, set_operation=Intersect, distinct=distinct, dialect=dialect, copy=copy, **opts 8955 ) 8956 8957 8958def except_( 8959 *expressions: ExpOrStr, 8960 distinct: bool = True, 8961 dialect: DialectType = None, 8962 copy: bool = True, 8963 **opts, 8964) -> Except: 8965 """ 8966 Initializes a syntax tree for the `EXCEPT` operation. 8967 8968 Example: 8969 >>> except_("SELECT * FROM foo", "SELECT * FROM bla").sql() 8970 'SELECT * FROM foo EXCEPT SELECT * FROM bla' 8971 8972 Args: 8973 expressions: the SQL code strings, corresponding to the `EXCEPT`'s operands. 8974 If `Expression` instances are passed, they will be used as-is. 8975 distinct: set the DISTINCT flag if and only if this is true. 8976 dialect: the dialect used to parse the input expression. 8977 copy: whether to copy the expression. 8978 opts: other options to use to parse the input expressions. 8979 8980 Returns: 8981 The new Except instance. 8982 """ 8983 assert len(expressions) >= 2, "At least two expressions are required by `except_`." 8984 return _apply_set_operation( 8985 *expressions, set_operation=Except, distinct=distinct, dialect=dialect, copy=copy, **opts 8986 ) 8987 8988 8989def select(*expressions: ExpOrStr, dialect: DialectType = None, **opts) -> Select: 8990 """ 8991 Initializes a syntax tree from one or multiple SELECT expressions. 8992 8993 Example: 8994 >>> select("col1", "col2").from_("tbl").sql() 8995 'SELECT col1, col2 FROM tbl' 8996 8997 Args: 8998 *expressions: the SQL code string to parse as the expressions of a 8999 SELECT statement. If an Expression instance is passed, this is used as-is. 9000 dialect: the dialect used to parse the input expressions (in the case that an 9001 input expression is a SQL string). 9002 **opts: other options to use to parse the input expressions (again, in the case 9003 that an input expression is a SQL string). 9004 9005 Returns: 9006 Select: the syntax tree for the SELECT statement. 9007 """ 9008 return Select().select(*expressions, dialect=dialect, **opts) 9009 9010 9011def from_(expression: ExpOrStr, dialect: DialectType = None, **opts) -> Select: 9012 """ 9013 Initializes a syntax tree from a FROM expression. 9014 9015 Example: 9016 >>> from_("tbl").select("col1", "col2").sql() 9017 'SELECT col1, col2 FROM tbl' 9018 9019 Args: 9020 *expression: the SQL code string to parse as the FROM expressions of a 9021 SELECT statement. If an Expression instance is passed, this is used as-is. 9022 dialect: the dialect used to parse the input expression (in the case that the 9023 input expression is a SQL string). 9024 **opts: other options to use to parse the input expressions (again, in the case 9025 that the input expression is a SQL string). 9026 9027 Returns: 9028 Select: the syntax tree for the SELECT statement. 9029 """ 9030 return Select().from_(expression, dialect=dialect, **opts) 9031 9032 9033def update( 9034 table: str | Table, 9035 properties: t.Optional[dict] = None, 9036 where: t.Optional[ExpOrStr] = None, 9037 from_: t.Optional[ExpOrStr] = None, 9038 with_: t.Optional[t.Dict[str, ExpOrStr]] = None, 9039 dialect: DialectType = None, 9040 **opts, 9041) -> Update: 9042 """ 9043 Creates an update statement. 9044 9045 Example: 9046 >>> update("my_table", {"x": 1, "y": "2", "z": None}, from_="baz_cte", where="baz_cte.id > 1 and my_table.id = baz_cte.id", with_={"baz_cte": "SELECT id FROM foo"}).sql() 9047 "WITH baz_cte AS (SELECT id FROM foo) UPDATE my_table SET x = 1, y = '2', z = NULL FROM baz_cte WHERE baz_cte.id > 1 AND my_table.id = baz_cte.id" 9048 9049 Args: 9050 properties: dictionary of properties to SET which are 9051 auto converted to sql objects eg None -> NULL 9052 where: sql conditional parsed into a WHERE statement 9053 from_: sql statement parsed into a FROM statement 9054 with_: dictionary of CTE aliases / select statements to include in a WITH clause. 9055 dialect: the dialect used to parse the input expressions. 9056 **opts: other options to use to parse the input expressions. 9057 9058 Returns: 9059 Update: the syntax tree for the UPDATE statement. 9060 """ 9061 update_expr = Update(this=maybe_parse(table, into=Table, dialect=dialect)) 9062 if properties: 9063 update_expr.set( 9064 "expressions", 9065 [ 9066 EQ(this=maybe_parse(k, dialect=dialect, **opts), expression=convert(v)) 9067 for k, v in properties.items() 9068 ], 9069 ) 9070 if from_: 9071 update_expr.set( 9072 "from_", 9073 maybe_parse(from_, into=From, dialect=dialect, prefix="FROM", **opts), 9074 ) 9075 if isinstance(where, Condition): 9076 where = Where(this=where) 9077 if where: 9078 update_expr.set( 9079 "where", 9080 maybe_parse(where, into=Where, dialect=dialect, prefix="WHERE", **opts), 9081 ) 9082 if with_: 9083 cte_list = [ 9084 alias_(CTE(this=maybe_parse(qry, dialect=dialect, **opts)), alias, table=True) 9085 for alias, qry in with_.items() 9086 ] 9087 update_expr.set( 9088 "with_", 9089 With(expressions=cte_list), 9090 ) 9091 return update_expr 9092 9093 9094def delete( 9095 table: ExpOrStr, 9096 where: t.Optional[ExpOrStr] = None, 9097 returning: t.Optional[ExpOrStr] = None, 9098 dialect: DialectType = None, 9099 **opts, 9100) -> Delete: 9101 """ 9102 Builds a delete statement. 9103 9104 Example: 9105 >>> delete("my_table", where="id > 1").sql() 9106 'DELETE FROM my_table WHERE id > 1' 9107 9108 Args: 9109 where: sql conditional parsed into a WHERE statement 9110 returning: sql conditional parsed into a RETURNING statement 9111 dialect: the dialect used to parse the input expressions. 9112 **opts: other options to use to parse the input expressions. 9113 9114 Returns: 9115 Delete: the syntax tree for the DELETE statement. 9116 """ 9117 delete_expr = Delete().delete(table, dialect=dialect, copy=False, **opts) 9118 if where: 9119 delete_expr = delete_expr.where(where, dialect=dialect, copy=False, **opts) 9120 if returning: 9121 delete_expr = delete_expr.returning(returning, dialect=dialect, copy=False, **opts) 9122 return delete_expr 9123 9124 9125def insert( 9126 expression: ExpOrStr, 9127 into: ExpOrStr, 9128 columns: t.Optional[t.Sequence[str | Identifier]] = None, 9129 overwrite: t.Optional[bool] = None, 9130 returning: t.Optional[ExpOrStr] = None, 9131 dialect: DialectType = None, 9132 copy: bool = True, 9133 **opts, 9134) -> Insert: 9135 """ 9136 Builds an INSERT statement. 9137 9138 Example: 9139 >>> insert("VALUES (1, 2, 3)", "tbl").sql() 9140 'INSERT INTO tbl VALUES (1, 2, 3)' 9141 9142 Args: 9143 expression: the sql string or expression of the INSERT statement 9144 into: the tbl to insert data to. 9145 columns: optionally the table's column names. 9146 overwrite: whether to INSERT OVERWRITE or not. 9147 returning: sql conditional parsed into a RETURNING statement 9148 dialect: the dialect used to parse the input expressions. 9149 copy: whether to copy the expression. 9150 **opts: other options to use to parse the input expressions. 9151 9152 Returns: 9153 Insert: the syntax tree for the INSERT statement. 9154 """ 9155 expr = maybe_parse(expression, dialect=dialect, copy=copy, **opts) 9156 this: Table | Schema = maybe_parse(into, into=Table, dialect=dialect, copy=copy, **opts) 9157 9158 if columns: 9159 this = Schema(this=this, expressions=[to_identifier(c, copy=copy) for c in columns]) 9160 9161 insert = Insert(this=this, expression=expr, overwrite=overwrite) 9162 9163 if returning: 9164 insert = insert.returning(returning, dialect=dialect, copy=False, **opts) 9165 9166 return insert 9167 9168 9169def merge( 9170 *when_exprs: ExpOrStr, 9171 into: ExpOrStr, 9172 using: ExpOrStr, 9173 on: ExpOrStr, 9174 returning: t.Optional[ExpOrStr] = None, 9175 dialect: DialectType = None, 9176 copy: bool = True, 9177 **opts, 9178) -> Merge: 9179 """ 9180 Builds a MERGE statement. 9181 9182 Example: 9183 >>> merge("WHEN MATCHED THEN UPDATE SET col1 = source_table.col1", 9184 ... "WHEN NOT MATCHED THEN INSERT (col1) VALUES (source_table.col1)", 9185 ... into="my_table", 9186 ... using="source_table", 9187 ... on="my_table.id = source_table.id").sql() 9188 'MERGE INTO my_table USING source_table ON my_table.id = source_table.id WHEN MATCHED THEN UPDATE SET col1 = source_table.col1 WHEN NOT MATCHED THEN INSERT (col1) VALUES (source_table.col1)' 9189 9190 Args: 9191 *when_exprs: The WHEN clauses specifying actions for matched and unmatched rows. 9192 into: The target table to merge data into. 9193 using: The source table to merge data from. 9194 on: The join condition for the merge. 9195 returning: The columns to return from the merge. 9196 dialect: The dialect used to parse the input expressions. 9197 copy: Whether to copy the expression. 9198 **opts: Other options to use to parse the input expressions. 9199 9200 Returns: 9201 Merge: The syntax tree for the MERGE statement. 9202 """ 9203 expressions: t.List[Expression] = [] 9204 for when_expr in when_exprs: 9205 expression = maybe_parse(when_expr, dialect=dialect, copy=copy, into=Whens, **opts) 9206 expressions.extend([expression] if isinstance(expression, When) else expression.expressions) 9207 9208 merge = Merge( 9209 this=maybe_parse(into, dialect=dialect, copy=copy, **opts), 9210 using=maybe_parse(using, dialect=dialect, copy=copy, **opts), 9211 on=maybe_parse(on, dialect=dialect, copy=copy, **opts), 9212 whens=Whens(expressions=expressions), 9213 ) 9214 if returning: 9215 merge = merge.returning(returning, dialect=dialect, copy=False, **opts) 9216 9217 if isinstance(using_clause := merge.args.get("using"), Alias): 9218 using_clause.replace(alias_(using_clause.this, using_clause.args["alias"], table=True)) 9219 9220 return merge 9221 9222 9223def condition( 9224 expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 9225) -> Condition: 9226 """ 9227 Initialize a logical condition expression. 9228 9229 Example: 9230 >>> condition("x=1").sql() 9231 'x = 1' 9232 9233 This is helpful for composing larger logical syntax trees: 9234 >>> where = condition("x=1") 9235 >>> where = where.and_("y=1") 9236 >>> Select().from_("tbl").select("*").where(where).sql() 9237 'SELECT * FROM tbl WHERE x = 1 AND y = 1' 9238 9239 Args: 9240 *expression: the SQL code string to parse. 9241 If an Expression instance is passed, this is used as-is. 9242 dialect: the dialect used to parse the input expression (in the case that the 9243 input expression is a SQL string). 9244 copy: Whether to copy `expression` (only applies to expressions). 9245 **opts: other options to use to parse the input expressions (again, in the case 9246 that the input expression is a SQL string). 9247 9248 Returns: 9249 The new Condition instance 9250 """ 9251 return maybe_parse( 9252 expression, 9253 into=Condition, 9254 dialect=dialect, 9255 copy=copy, 9256 **opts, 9257 ) 9258 9259 9260def and_( 9261 *expressions: t.Optional[ExpOrStr], 9262 dialect: DialectType = None, 9263 copy: bool = True, 9264 wrap: bool = True, 9265 **opts, 9266) -> Condition: 9267 """ 9268 Combine multiple conditions with an AND logical operator. 9269 9270 Example: 9271 >>> and_("x=1", and_("y=1", "z=1")).sql() 9272 'x = 1 AND (y = 1 AND z = 1)' 9273 9274 Args: 9275 *expressions: the SQL code strings to parse. 9276 If an Expression instance is passed, this is used as-is. 9277 dialect: the dialect used to parse the input expression. 9278 copy: whether to copy `expressions` (only applies to Expressions). 9279 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 9280 precedence issues, but can be turned off when the produced AST is too deep and 9281 causes recursion-related issues. 9282 **opts: other options to use to parse the input expressions. 9283 9284 Returns: 9285 The new condition 9286 """ 9287 return t.cast(Condition, _combine(expressions, And, dialect, copy=copy, wrap=wrap, **opts)) 9288 9289 9290def or_( 9291 *expressions: t.Optional[ExpOrStr], 9292 dialect: DialectType = None, 9293 copy: bool = True, 9294 wrap: bool = True, 9295 **opts, 9296) -> Condition: 9297 """ 9298 Combine multiple conditions with an OR logical operator. 9299 9300 Example: 9301 >>> or_("x=1", or_("y=1", "z=1")).sql() 9302 'x = 1 OR (y = 1 OR z = 1)' 9303 9304 Args: 9305 *expressions: the SQL code strings to parse. 9306 If an Expression instance is passed, this is used as-is. 9307 dialect: the dialect used to parse the input expression. 9308 copy: whether to copy `expressions` (only applies to Expressions). 9309 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 9310 precedence issues, but can be turned off when the produced AST is too deep and 9311 causes recursion-related issues. 9312 **opts: other options to use to parse the input expressions. 9313 9314 Returns: 9315 The new condition 9316 """ 9317 return t.cast(Condition, _combine(expressions, Or, dialect, copy=copy, wrap=wrap, **opts)) 9318 9319 9320def xor( 9321 *expressions: t.Optional[ExpOrStr], 9322 dialect: DialectType = None, 9323 copy: bool = True, 9324 wrap: bool = True, 9325 **opts, 9326) -> Condition: 9327 """ 9328 Combine multiple conditions with an XOR logical operator. 9329 9330 Example: 9331 >>> xor("x=1", xor("y=1", "z=1")).sql() 9332 'x = 1 XOR (y = 1 XOR z = 1)' 9333 9334 Args: 9335 *expressions: the SQL code strings to parse. 9336 If an Expression instance is passed, this is used as-is. 9337 dialect: the dialect used to parse the input expression. 9338 copy: whether to copy `expressions` (only applies to Expressions). 9339 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 9340 precedence issues, but can be turned off when the produced AST is too deep and 9341 causes recursion-related issues. 9342 **opts: other options to use to parse the input expressions. 9343 9344 Returns: 9345 The new condition 9346 """ 9347 return t.cast(Condition, _combine(expressions, Xor, dialect, copy=copy, wrap=wrap, **opts)) 9348 9349 9350def not_(expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts) -> Not: 9351 """ 9352 Wrap a condition with a NOT operator. 9353 9354 Example: 9355 >>> not_("this_suit='black'").sql() 9356 "NOT this_suit = 'black'" 9357 9358 Args: 9359 expression: the SQL code string to parse. 9360 If an Expression instance is passed, this is used as-is. 9361 dialect: the dialect used to parse the input expression. 9362 copy: whether to copy the expression or not. 9363 **opts: other options to use to parse the input expressions. 9364 9365 Returns: 9366 The new condition. 9367 """ 9368 this = condition( 9369 expression, 9370 dialect=dialect, 9371 copy=copy, 9372 **opts, 9373 ) 9374 return Not(this=_wrap(this, Connector)) 9375 9376 9377def paren(expression: ExpOrStr, copy: bool = True) -> Paren: 9378 """ 9379 Wrap an expression in parentheses. 9380 9381 Example: 9382 >>> paren("5 + 3").sql() 9383 '(5 + 3)' 9384 9385 Args: 9386 expression: the SQL code string to parse. 9387 If an Expression instance is passed, this is used as-is. 9388 copy: whether to copy the expression or not. 9389 9390 Returns: 9391 The wrapped expression. 9392 """ 9393 return Paren(this=maybe_parse(expression, copy=copy)) 9394 9395 9396SAFE_IDENTIFIER_RE: t.Pattern[str] = re.compile(r"^[_a-zA-Z][\w]*$") 9397 9398 9399@t.overload 9400def to_identifier(name: None, quoted: t.Optional[bool] = None, copy: bool = True) -> None: ... 9401 9402 9403@t.overload 9404def to_identifier( 9405 name: str | Identifier, quoted: t.Optional[bool] = None, copy: bool = True 9406) -> Identifier: ... 9407 9408 9409def to_identifier(name, quoted=None, copy=True): 9410 """Builds an identifier. 9411 9412 Args: 9413 name: The name to turn into an identifier. 9414 quoted: Whether to force quote the identifier. 9415 copy: Whether to copy name if it's an Identifier. 9416 9417 Returns: 9418 The identifier ast node. 9419 """ 9420 9421 if name is None: 9422 return None 9423 9424 if isinstance(name, Identifier): 9425 identifier = maybe_copy(name, copy) 9426 elif isinstance(name, str): 9427 identifier = Identifier( 9428 this=name, 9429 quoted=not SAFE_IDENTIFIER_RE.match(name) if quoted is None else quoted, 9430 ) 9431 else: 9432 raise ValueError(f"Name needs to be a string or an Identifier, got: {name.__class__}") 9433 return identifier 9434 9435 9436def parse_identifier(name: str | Identifier, dialect: DialectType = None) -> Identifier: 9437 """ 9438 Parses a given string into an identifier. 9439 9440 Args: 9441 name: The name to parse into an identifier. 9442 dialect: The dialect to parse against. 9443 9444 Returns: 9445 The identifier ast node. 9446 """ 9447 try: 9448 expression = maybe_parse(name, dialect=dialect, into=Identifier) 9449 except (ParseError, TokenError): 9450 expression = to_identifier(name) 9451 9452 return expression 9453 9454 9455INTERVAL_STRING_RE = re.compile(r"\s*(-?[0-9]+(?:\.[0-9]+)?)\s*([a-zA-Z]+)\s*") 9456 9457# Matches day-time interval strings that contain 9458# - A number of days (possibly negative or with decimals) 9459# - At least one space 9460# - Portions of a time-like signature, potentially negative 9461# - Standard format [-]h+:m+:s+[.f+] 9462# - Just minutes/seconds/frac seconds [-]m+:s+.f+ 9463# - Just hours, minutes, maybe colon [-]h+:m+[:] 9464# - Just hours, maybe colon [-]h+[:] 9465# - Just colon : 9466INTERVAL_DAY_TIME_RE = re.compile( 9467 r"\s*-?\s*\d+(?:\.\d+)?\s+(?:-?(?:\d+:)?\d+:\d+(?:\.\d+)?|-?(?:\d+:){1,2}|:)\s*" 9468) 9469 9470 9471def to_interval(interval: str | Literal) -> Interval: 9472 """Builds an interval expression from a string like '1 day' or '5 months'.""" 9473 if isinstance(interval, Literal): 9474 if not interval.is_string: 9475 raise ValueError("Invalid interval string.") 9476 9477 interval = interval.this 9478 9479 interval = maybe_parse(f"INTERVAL {interval}") 9480 assert isinstance(interval, Interval) 9481 return interval 9482 9483 9484def to_table( 9485 sql_path: str | Table, dialect: DialectType = None, copy: bool = True, **kwargs 9486) -> Table: 9487 """ 9488 Create a table expression from a `[catalog].[schema].[table]` sql path. Catalog and schema are optional. 9489 If a table is passed in then that table is returned. 9490 9491 Args: 9492 sql_path: a `[catalog].[schema].[table]` string. 9493 dialect: the source dialect according to which the table name will be parsed. 9494 copy: Whether to copy a table if it is passed in. 9495 kwargs: the kwargs to instantiate the resulting `Table` expression with. 9496 9497 Returns: 9498 A table expression. 9499 """ 9500 if isinstance(sql_path, Table): 9501 return maybe_copy(sql_path, copy=copy) 9502 9503 try: 9504 table = maybe_parse(sql_path, into=Table, dialect=dialect) 9505 except ParseError: 9506 catalog, db, this = split_num_words(sql_path, ".", 3) 9507 9508 if not this: 9509 raise 9510 9511 table = table_(this, db=db, catalog=catalog) 9512 9513 for k, v in kwargs.items(): 9514 table.set(k, v) 9515 9516 return table 9517 9518 9519def to_column( 9520 sql_path: str | Column, 9521 quoted: t.Optional[bool] = None, 9522 dialect: DialectType = None, 9523 copy: bool = True, 9524 **kwargs, 9525) -> Column: 9526 """ 9527 Create a column from a `[table].[column]` sql path. Table is optional. 9528 If a column is passed in then that column is returned. 9529 9530 Args: 9531 sql_path: a `[table].[column]` string. 9532 quoted: Whether or not to force quote identifiers. 9533 dialect: the source dialect according to which the column name will be parsed. 9534 copy: Whether to copy a column if it is passed in. 9535 kwargs: the kwargs to instantiate the resulting `Column` expression with. 9536 9537 Returns: 9538 A column expression. 9539 """ 9540 if isinstance(sql_path, Column): 9541 return maybe_copy(sql_path, copy=copy) 9542 9543 try: 9544 col = maybe_parse(sql_path, into=Column, dialect=dialect) 9545 except ParseError: 9546 return column(*reversed(sql_path.split(".")), quoted=quoted, **kwargs) 9547 9548 for k, v in kwargs.items(): 9549 col.set(k, v) 9550 9551 if quoted: 9552 for i in col.find_all(Identifier): 9553 i.set("quoted", True) 9554 9555 return col 9556 9557 9558def alias_( 9559 expression: ExpOrStr, 9560 alias: t.Optional[str | Identifier], 9561 table: bool | t.Sequence[str | Identifier] = False, 9562 quoted: t.Optional[bool] = None, 9563 dialect: DialectType = None, 9564 copy: bool = True, 9565 **opts, 9566): 9567 """Create an Alias expression. 9568 9569 Example: 9570 >>> alias_('foo', 'bar').sql() 9571 'foo AS bar' 9572 9573 >>> alias_('(select 1, 2)', 'bar', table=['a', 'b']).sql() 9574 '(SELECT 1, 2) AS bar(a, b)' 9575 9576 Args: 9577 expression: the SQL code strings to parse. 9578 If an Expression instance is passed, this is used as-is. 9579 alias: the alias name to use. If the name has 9580 special characters it is quoted. 9581 table: Whether to create a table alias, can also be a list of columns. 9582 quoted: whether to quote the alias 9583 dialect: the dialect used to parse the input expression. 9584 copy: Whether to copy the expression. 9585 **opts: other options to use to parse the input expressions. 9586 9587 Returns: 9588 Alias: the aliased expression 9589 """ 9590 exp = maybe_parse(expression, dialect=dialect, copy=copy, **opts) 9591 alias = to_identifier(alias, quoted=quoted) 9592 9593 if table: 9594 table_alias = TableAlias(this=alias) 9595 exp.set("alias", table_alias) 9596 9597 if not isinstance(table, bool): 9598 for column in table: 9599 table_alias.append("columns", to_identifier(column, quoted=quoted)) 9600 9601 return exp 9602 9603 # We don't set the "alias" arg for Window expressions, because that would add an IDENTIFIER node in 9604 # the AST, representing a "named_window" [1] construct (eg. bigquery). What we want is an ALIAS node 9605 # for the complete Window expression. 9606 # 9607 # [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls 9608 9609 if "alias" in exp.arg_types and not isinstance(exp, Window): 9610 exp.set("alias", alias) 9611 return exp 9612 return Alias(this=exp, alias=alias) 9613 9614 9615def subquery( 9616 expression: ExpOrStr, 9617 alias: t.Optional[Identifier | str] = None, 9618 dialect: DialectType = None, 9619 **opts, 9620) -> Select: 9621 """ 9622 Build a subquery expression that's selected from. 9623 9624 Example: 9625 >>> subquery('select x from tbl', 'bar').select('x').sql() 9626 'SELECT x FROM (SELECT x FROM tbl) AS bar' 9627 9628 Args: 9629 expression: the SQL code strings to parse. 9630 If an Expression instance is passed, this is used as-is. 9631 alias: the alias name to use. 9632 dialect: the dialect used to parse the input expression. 9633 **opts: other options to use to parse the input expressions. 9634 9635 Returns: 9636 A new Select instance with the subquery expression included. 9637 """ 9638 9639 expression = maybe_parse(expression, dialect=dialect, **opts).subquery(alias, **opts) 9640 return Select().from_(expression, dialect=dialect, **opts) 9641 9642 9643@t.overload 9644def column( 9645 col: str | Identifier, 9646 table: t.Optional[str | Identifier] = None, 9647 db: t.Optional[str | Identifier] = None, 9648 catalog: t.Optional[str | Identifier] = None, 9649 *, 9650 fields: t.Collection[t.Union[str, Identifier]], 9651 quoted: t.Optional[bool] = None, 9652 copy: bool = True, 9653) -> Dot: 9654 pass 9655 9656 9657@t.overload 9658def column( 9659 col: str | Identifier | Star, 9660 table: t.Optional[str | Identifier] = None, 9661 db: t.Optional[str | Identifier] = None, 9662 catalog: t.Optional[str | Identifier] = None, 9663 *, 9664 fields: Lit[None] = None, 9665 quoted: t.Optional[bool] = None, 9666 copy: bool = True, 9667) -> Column: 9668 pass 9669 9670 9671def column( 9672 col, 9673 table=None, 9674 db=None, 9675 catalog=None, 9676 *, 9677 fields=None, 9678 quoted=None, 9679 copy=True, 9680): 9681 """ 9682 Build a Column. 9683 9684 Args: 9685 col: Column name. 9686 table: Table name. 9687 db: Database name. 9688 catalog: Catalog name. 9689 fields: Additional fields using dots. 9690 quoted: Whether to force quotes on the column's identifiers. 9691 copy: Whether to copy identifiers if passed in. 9692 9693 Returns: 9694 The new Column instance. 9695 """ 9696 if not isinstance(col, Star): 9697 col = to_identifier(col, quoted=quoted, copy=copy) 9698 9699 this = Column( 9700 this=col, 9701 table=to_identifier(table, quoted=quoted, copy=copy), 9702 db=to_identifier(db, quoted=quoted, copy=copy), 9703 catalog=to_identifier(catalog, quoted=quoted, copy=copy), 9704 ) 9705 9706 if fields: 9707 this = Dot.build( 9708 (this, *(to_identifier(field, quoted=quoted, copy=copy) for field in fields)) 9709 ) 9710 return this 9711 9712 9713def cast( 9714 expression: ExpOrStr, to: DATA_TYPE, copy: bool = True, dialect: DialectType = None, **opts 9715) -> Cast: 9716 """Cast an expression to a data type. 9717 9718 Example: 9719 >>> cast('x + 1', 'int').sql() 9720 'CAST(x + 1 AS INT)' 9721 9722 Args: 9723 expression: The expression to cast. 9724 to: The datatype to cast to. 9725 copy: Whether to copy the supplied expressions. 9726 dialect: The target dialect. This is used to prevent a re-cast in the following scenario: 9727 - The expression to be cast is already a exp.Cast expression 9728 - The existing cast is to a type that is logically equivalent to new type 9729 9730 For example, if :expression='CAST(x as DATETIME)' and :to=Type.TIMESTAMP, 9731 but in the target dialect DATETIME is mapped to TIMESTAMP, then we will NOT return `CAST(x (as DATETIME) as TIMESTAMP)` 9732 and instead just return the original expression `CAST(x as DATETIME)`. 9733 9734 This is to prevent it being output as a double cast `CAST(x (as TIMESTAMP) as TIMESTAMP)` once the DATETIME -> TIMESTAMP 9735 mapping is applied in the target dialect generator. 9736 9737 Returns: 9738 The new Cast instance. 9739 """ 9740 expr = maybe_parse(expression, copy=copy, dialect=dialect, **opts) 9741 data_type = DataType.build(to, copy=copy, dialect=dialect, **opts) 9742 9743 # dont re-cast if the expression is already a cast to the correct type 9744 if isinstance(expr, Cast): 9745 from sqlglot.dialects.dialect import Dialect 9746 9747 target_dialect = Dialect.get_or_raise(dialect) 9748 type_mapping = target_dialect.generator_class.TYPE_MAPPING 9749 9750 existing_cast_type: DataType.Type = expr.to.this 9751 new_cast_type: DataType.Type = data_type.this 9752 types_are_equivalent = type_mapping.get( 9753 existing_cast_type, existing_cast_type.value 9754 ) == type_mapping.get(new_cast_type, new_cast_type.value) 9755 9756 if expr.is_type(data_type) or types_are_equivalent: 9757 return expr 9758 9759 expr = Cast(this=expr, to=data_type) 9760 expr.type = data_type 9761 9762 return expr 9763 9764 9765def table_( 9766 table: Identifier | str, 9767 db: t.Optional[Identifier | str] = None, 9768 catalog: t.Optional[Identifier | str] = None, 9769 quoted: t.Optional[bool] = None, 9770 alias: t.Optional[Identifier | str] = None, 9771) -> Table: 9772 """Build a Table. 9773 9774 Args: 9775 table: Table name. 9776 db: Database name. 9777 catalog: Catalog name. 9778 quote: Whether to force quotes on the table's identifiers. 9779 alias: Table's alias. 9780 9781 Returns: 9782 The new Table instance. 9783 """ 9784 return Table( 9785 this=to_identifier(table, quoted=quoted) if table else None, 9786 db=to_identifier(db, quoted=quoted) if db else None, 9787 catalog=to_identifier(catalog, quoted=quoted) if catalog else None, 9788 alias=TableAlias(this=to_identifier(alias)) if alias else None, 9789 ) 9790 9791 9792def values( 9793 values: t.Iterable[t.Tuple[t.Any, ...]], 9794 alias: t.Optional[str] = None, 9795 columns: t.Optional[t.Iterable[str] | t.Dict[str, DataType]] = None, 9796) -> Values: 9797 """Build VALUES statement. 9798 9799 Example: 9800 >>> values([(1, '2')]).sql() 9801 "VALUES (1, '2')" 9802 9803 Args: 9804 values: values statements that will be converted to SQL 9805 alias: optional alias 9806 columns: Optional list of ordered column names or ordered dictionary of column names to types. 9807 If either are provided then an alias is also required. 9808 9809 Returns: 9810 Values: the Values expression object 9811 """ 9812 if columns and not alias: 9813 raise ValueError("Alias is required when providing columns") 9814 9815 return Values( 9816 expressions=[convert(tup) for tup in values], 9817 alias=( 9818 TableAlias(this=to_identifier(alias), columns=[to_identifier(x) for x in columns]) 9819 if columns 9820 else (TableAlias(this=to_identifier(alias)) if alias else None) 9821 ), 9822 ) 9823 9824 9825def var(name: t.Optional[ExpOrStr]) -> Var: 9826 """Build a SQL variable. 9827 9828 Example: 9829 >>> repr(var('x')) 9830 'Var(this=x)' 9831 9832 >>> repr(var(column('x', table='y'))) 9833 'Var(this=x)' 9834 9835 Args: 9836 name: The name of the var or an expression who's name will become the var. 9837 9838 Returns: 9839 The new variable node. 9840 """ 9841 if not name: 9842 raise ValueError("Cannot convert empty name into var.") 9843 9844 if isinstance(name, Expression): 9845 name = name.name 9846 return Var(this=name) 9847 9848 9849def rename_table( 9850 old_name: str | Table, 9851 new_name: str | Table, 9852 dialect: DialectType = None, 9853) -> Alter: 9854 """Build ALTER TABLE... RENAME... expression 9855 9856 Args: 9857 old_name: The old name of the table 9858 new_name: The new name of the table 9859 dialect: The dialect to parse the table. 9860 9861 Returns: 9862 Alter table expression 9863 """ 9864 old_table = to_table(old_name, dialect=dialect) 9865 new_table = to_table(new_name, dialect=dialect) 9866 return Alter( 9867 this=old_table, 9868 kind="TABLE", 9869 actions=[ 9870 AlterRename(this=new_table), 9871 ], 9872 ) 9873 9874 9875def rename_column( 9876 table_name: str | Table, 9877 old_column_name: str | Column, 9878 new_column_name: str | Column, 9879 exists: t.Optional[bool] = None, 9880 dialect: DialectType = None, 9881) -> Alter: 9882 """Build ALTER TABLE... RENAME COLUMN... expression 9883 9884 Args: 9885 table_name: Name of the table 9886 old_column: The old name of the column 9887 new_column: The new name of the column 9888 exists: Whether to add the `IF EXISTS` clause 9889 dialect: The dialect to parse the table/column. 9890 9891 Returns: 9892 Alter table expression 9893 """ 9894 table = to_table(table_name, dialect=dialect) 9895 old_column = to_column(old_column_name, dialect=dialect) 9896 new_column = to_column(new_column_name, dialect=dialect) 9897 return Alter( 9898 this=table, 9899 kind="TABLE", 9900 actions=[ 9901 RenameColumn(this=old_column, to=new_column, exists=exists), 9902 ], 9903 ) 9904 9905 9906def convert(value: t.Any, copy: bool = False) -> Expression: 9907 """Convert a python value into an expression object. 9908 9909 Raises an error if a conversion is not possible. 9910 9911 Args: 9912 value: A python object. 9913 copy: Whether to copy `value` (only applies to Expressions and collections). 9914 9915 Returns: 9916 The equivalent expression object. 9917 """ 9918 if isinstance(value, Expression): 9919 return maybe_copy(value, copy) 9920 if isinstance(value, str): 9921 return Literal.string(value) 9922 if isinstance(value, bool): 9923 return Boolean(this=value) 9924 if value is None or (isinstance(value, float) and math.isnan(value)): 9925 return null() 9926 if isinstance(value, numbers.Number): 9927 return Literal.number(value) 9928 if isinstance(value, bytes): 9929 return HexString(this=value.hex()) 9930 if isinstance(value, datetime.datetime): 9931 datetime_literal = Literal.string(value.isoformat(sep=" ")) 9932 9933 tz = None 9934 if value.tzinfo: 9935 # this works for zoneinfo.ZoneInfo, pytz.timezone and datetime.datetime.utc to return IANA timezone names like "America/Los_Angeles" 9936 # instead of abbreviations like "PDT". This is for consistency with other timezone handling functions in SQLGlot 9937 tz = Literal.string(str(value.tzinfo)) 9938 9939 return TimeStrToTime(this=datetime_literal, zone=tz) 9940 if isinstance(value, datetime.date): 9941 date_literal = Literal.string(value.strftime("%Y-%m-%d")) 9942 return DateStrToDate(this=date_literal) 9943 if isinstance(value, datetime.time): 9944 time_literal = Literal.string(value.isoformat()) 9945 return TsOrDsToTime(this=time_literal) 9946 if isinstance(value, tuple): 9947 if hasattr(value, "_fields"): 9948 return Struct( 9949 expressions=[ 9950 PropertyEQ( 9951 this=to_identifier(k), expression=convert(getattr(value, k), copy=copy) 9952 ) 9953 for k in value._fields 9954 ] 9955 ) 9956 return Tuple(expressions=[convert(v, copy=copy) for v in value]) 9957 if isinstance(value, list): 9958 return Array(expressions=[convert(v, copy=copy) for v in value]) 9959 if isinstance(value, dict): 9960 return Map( 9961 keys=Array(expressions=[convert(k, copy=copy) for k in value]), 9962 values=Array(expressions=[convert(v, copy=copy) for v in value.values()]), 9963 ) 9964 if hasattr(value, "__dict__"): 9965 return Struct( 9966 expressions=[ 9967 PropertyEQ(this=to_identifier(k), expression=convert(v, copy=copy)) 9968 for k, v in value.__dict__.items() 9969 ] 9970 ) 9971 raise ValueError(f"Cannot convert {value}") 9972 9973 9974def replace_children(expression: Expression, fun: t.Callable, *args, **kwargs) -> None: 9975 """ 9976 Replace children of an expression with the result of a lambda fun(child) -> exp. 9977 """ 9978 for k, v in tuple(expression.args.items()): 9979 is_list_arg = type(v) is list 9980 9981 child_nodes = v if is_list_arg else [v] 9982 new_child_nodes = [] 9983 9984 for cn in child_nodes: 9985 if isinstance(cn, Expression): 9986 for child_node in ensure_collection(fun(cn, *args, **kwargs)): 9987 new_child_nodes.append(child_node) 9988 else: 9989 new_child_nodes.append(cn) 9990 9991 expression.set(k, new_child_nodes if is_list_arg else seq_get(new_child_nodes, 0)) 9992 9993 9994def replace_tree( 9995 expression: Expression, 9996 fun: t.Callable, 9997 prune: t.Optional[t.Callable[[Expression], bool]] = None, 9998) -> Expression: 9999 """ 10000 Replace an entire tree with the result of function calls on each node. 10001 10002 This will be traversed in reverse dfs, so leaves first. 10003 If new nodes are created as a result of function calls, they will also be traversed. 10004 """ 10005 stack = list(expression.dfs(prune=prune)) 10006 10007 while stack: 10008 node = stack.pop() 10009 new_node = fun(node) 10010 10011 if new_node is not node: 10012 node.replace(new_node) 10013 10014 if isinstance(new_node, Expression): 10015 stack.append(new_node) 10016 10017 return new_node 10018 10019 10020def find_tables(expression: Expression) -> t.Set[Table]: 10021 """ 10022 Find all tables referenced in a query. 10023 10024 Args: 10025 expressions: The query to find the tables in. 10026 10027 Returns: 10028 A set of all the tables. 10029 """ 10030 from sqlglot.optimizer.scope import traverse_scope 10031 10032 return { 10033 table 10034 for scope in traverse_scope(expression) 10035 for table in scope.tables 10036 if table.name and table.name not in scope.cte_sources 10037 } 10038 10039 10040def column_table_names(expression: Expression, exclude: str = "") -> t.Set[str]: 10041 """ 10042 Return all table names referenced through columns in an expression. 10043 10044 Example: 10045 >>> import sqlglot 10046 >>> sorted(column_table_names(sqlglot.parse_one("a.b AND c.d AND c.e"))) 10047 ['a', 'c'] 10048 10049 Args: 10050 expression: expression to find table names. 10051 exclude: a table name to exclude 10052 10053 Returns: 10054 A list of unique names. 10055 """ 10056 return { 10057 table 10058 for table in (column.table for column in expression.find_all(Column)) 10059 if table and table != exclude 10060 } 10061 10062 10063def table_name(table: Table | str, dialect: DialectType = None, identify: bool = False) -> str: 10064 """Get the full name of a table as a string. 10065 10066 Args: 10067 table: Table expression node or string. 10068 dialect: The dialect to generate the table name for. 10069 identify: Determines when an identifier should be quoted. Possible values are: 10070 False (default): Never quote, except in cases where it's mandatory by the dialect. 10071 True: Always quote. 10072 10073 Examples: 10074 >>> from sqlglot import exp, parse_one 10075 >>> table_name(parse_one("select * from a.b.c").find(exp.Table)) 10076 'a.b.c' 10077 10078 Returns: 10079 The table name. 10080 """ 10081 10082 table = maybe_parse(table, into=Table, dialect=dialect) 10083 10084 if not table: 10085 raise ValueError(f"Cannot parse {table}") 10086 10087 return ".".join( 10088 ( 10089 part.sql(dialect=dialect, identify=True, copy=False, comments=False) 10090 if identify or not SAFE_IDENTIFIER_RE.match(part.name) 10091 else part.name 10092 ) 10093 for part in table.parts 10094 ) 10095 10096 10097def normalize_table_name(table: str | Table, dialect: DialectType = None, copy: bool = True) -> str: 10098 """Returns a case normalized table name without quotes. 10099 10100 Args: 10101 table: the table to normalize 10102 dialect: the dialect to use for normalization rules 10103 copy: whether to copy the expression. 10104 10105 Examples: 10106 >>> normalize_table_name("`A-B`.c", dialect="bigquery") 10107 'A-B.c' 10108 """ 10109 from sqlglot.optimizer.normalize_identifiers import normalize_identifiers 10110 10111 return ".".join( 10112 p.name 10113 for p in normalize_identifiers( 10114 to_table(table, dialect=dialect, copy=copy), dialect=dialect 10115 ).parts 10116 ) 10117 10118 10119def replace_tables( 10120 expression: E, mapping: t.Dict[str, str], dialect: DialectType = None, copy: bool = True 10121) -> E: 10122 """Replace all tables in expression according to the mapping. 10123 10124 Args: 10125 expression: expression node to be transformed and replaced. 10126 mapping: mapping of table names. 10127 dialect: the dialect of the mapping table 10128 copy: whether to copy the expression. 10129 10130 Examples: 10131 >>> from sqlglot import exp, parse_one 10132 >>> replace_tables(parse_one("select * from a.b"), {"a.b": "c"}).sql() 10133 'SELECT * FROM c /* a.b */' 10134 10135 Returns: 10136 The mapped expression. 10137 """ 10138 10139 mapping = {normalize_table_name(k, dialect=dialect): v for k, v in mapping.items()} 10140 10141 def _replace_tables(node: Expression) -> Expression: 10142 if isinstance(node, Table) and node.meta.get("replace") is not False: 10143 original = normalize_table_name(node, dialect=dialect) 10144 new_name = mapping.get(original) 10145 10146 if new_name: 10147 table = to_table( 10148 new_name, 10149 **{k: v for k, v in node.args.items() if k not in TABLE_PARTS}, 10150 dialect=dialect, 10151 ) 10152 table.add_comments([original]) 10153 return table 10154 return node 10155 10156 return expression.transform(_replace_tables, copy=copy) # type: ignore 10157 10158 10159def replace_placeholders(expression: Expression, *args, **kwargs) -> Expression: 10160 """Replace placeholders in an expression. 10161 10162 Args: 10163 expression: expression node to be transformed and replaced. 10164 args: positional names that will substitute unnamed placeholders in the given order. 10165 kwargs: keyword arguments that will substitute named placeholders. 10166 10167 Examples: 10168 >>> from sqlglot import exp, parse_one 10169 >>> replace_placeholders( 10170 ... parse_one("select * from :tbl where ? = ?"), 10171 ... exp.to_identifier("str_col"), "b", tbl=exp.to_identifier("foo") 10172 ... ).sql() 10173 "SELECT * FROM foo WHERE str_col = 'b'" 10174 10175 Returns: 10176 The mapped expression. 10177 """ 10178 10179 def _replace_placeholders(node: Expression, args, **kwargs) -> Expression: 10180 if isinstance(node, Placeholder): 10181 if node.this: 10182 new_name = kwargs.get(node.this) 10183 if new_name is not None: 10184 return convert(new_name) 10185 else: 10186 try: 10187 return convert(next(args)) 10188 except StopIteration: 10189 pass 10190 return node 10191 10192 return expression.transform(_replace_placeholders, iter(args), **kwargs) 10193 10194 10195def expand( 10196 expression: Expression, 10197 sources: t.Dict[str, Query | t.Callable[[], Query]], 10198 dialect: DialectType = None, 10199 copy: bool = True, 10200) -> Expression: 10201 """Transforms an expression by expanding all referenced sources into subqueries. 10202 10203 Examples: 10204 >>> from sqlglot import parse_one 10205 >>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y")}).sql() 10206 'SELECT * FROM (SELECT * FROM y) AS z /* source: x */' 10207 10208 >>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y"), "y": parse_one("select * from z")}).sql() 10209 'SELECT * FROM (SELECT * FROM (SELECT * FROM z) AS y /* source: y */) AS z /* source: x */' 10210 10211 Args: 10212 expression: The expression to expand. 10213 sources: A dict of name to query or a callable that provides a query on demand. 10214 dialect: The dialect of the sources dict or the callable. 10215 copy: Whether to copy the expression during transformation. Defaults to True. 10216 10217 Returns: 10218 The transformed expression. 10219 """ 10220 normalized_sources = {normalize_table_name(k, dialect=dialect): v for k, v in sources.items()} 10221 10222 def _expand(node: Expression): 10223 if isinstance(node, Table): 10224 name = normalize_table_name(node, dialect=dialect) 10225 source = normalized_sources.get(name) 10226 10227 if source: 10228 # Create a subquery with the same alias (or table name if no alias) 10229 parsed_source = source() if callable(source) else source 10230 subquery = parsed_source.subquery(node.alias or name) 10231 subquery.comments = [f"source: {name}"] 10232 10233 # Continue expanding within the subquery 10234 return subquery.transform(_expand, copy=False) 10235 10236 return node 10237 10238 return expression.transform(_expand, copy=copy) 10239 10240 10241def func(name: str, *args, copy: bool = True, dialect: DialectType = None, **kwargs) -> Func: 10242 """ 10243 Returns a Func expression. 10244 10245 Examples: 10246 >>> func("abs", 5).sql() 10247 'ABS(5)' 10248 10249 >>> func("cast", this=5, to=DataType.build("DOUBLE")).sql() 10250 'CAST(5 AS DOUBLE)' 10251 10252 Args: 10253 name: the name of the function to build. 10254 args: the args used to instantiate the function of interest. 10255 copy: whether to copy the argument expressions. 10256 dialect: the source dialect. 10257 kwargs: the kwargs used to instantiate the function of interest. 10258 10259 Note: 10260 The arguments `args` and `kwargs` are mutually exclusive. 10261 10262 Returns: 10263 An instance of the function of interest, or an anonymous function, if `name` doesn't 10264 correspond to an existing `sqlglot.expressions.Func` class. 10265 """ 10266 if args and kwargs: 10267 raise ValueError("Can't use both args and kwargs to instantiate a function.") 10268 10269 from sqlglot.dialects.dialect import Dialect 10270 10271 dialect = Dialect.get_or_raise(dialect) 10272 10273 converted: t.List[Expression] = [maybe_parse(arg, dialect=dialect, copy=copy) for arg in args] 10274 kwargs = {key: maybe_parse(value, dialect=dialect, copy=copy) for key, value in kwargs.items()} 10275 10276 constructor = dialect.parser_class.FUNCTIONS.get(name.upper()) 10277 if constructor: 10278 if converted: 10279 if "dialect" in constructor.__code__.co_varnames: 10280 function = constructor(converted, dialect=dialect) 10281 else: 10282 function = constructor(converted) 10283 elif constructor.__name__ == "from_arg_list": 10284 function = constructor.__self__(**kwargs) # type: ignore 10285 else: 10286 constructor = FUNCTION_BY_NAME.get(name.upper()) 10287 if constructor: 10288 function = constructor(**kwargs) 10289 else: 10290 raise ValueError( 10291 f"Unable to convert '{name}' into a Func. Either manually construct " 10292 "the Func expression of interest or parse the function call." 10293 ) 10294 else: 10295 kwargs = kwargs or {"expressions": converted} 10296 function = Anonymous(this=name, **kwargs) 10297 10298 for error_message in function.error_messages(converted): 10299 raise ValueError(error_message) 10300 10301 return function 10302 10303 10304def case( 10305 expression: t.Optional[ExpOrStr] = None, 10306 **opts, 10307) -> Case: 10308 """ 10309 Initialize a CASE statement. 10310 10311 Example: 10312 case().when("a = 1", "foo").else_("bar") 10313 10314 Args: 10315 expression: Optionally, the input expression (not all dialects support this) 10316 **opts: Extra keyword arguments for parsing `expression` 10317 """ 10318 if expression is not None: 10319 this = maybe_parse(expression, **opts) 10320 else: 10321 this = None 10322 return Case(this=this, ifs=[]) 10323 10324 10325def array( 10326 *expressions: ExpOrStr, copy: bool = True, dialect: DialectType = None, **kwargs 10327) -> Array: 10328 """ 10329 Returns an array. 10330 10331 Examples: 10332 >>> array(1, 'x').sql() 10333 'ARRAY(1, x)' 10334 10335 Args: 10336 expressions: the expressions to add to the array. 10337 copy: whether to copy the argument expressions. 10338 dialect: the source dialect. 10339 kwargs: the kwargs used to instantiate the function of interest. 10340 10341 Returns: 10342 An array expression. 10343 """ 10344 return Array( 10345 expressions=[ 10346 maybe_parse(expression, copy=copy, dialect=dialect, **kwargs) 10347 for expression in expressions 10348 ] 10349 ) 10350 10351 10352def tuple_( 10353 *expressions: ExpOrStr, copy: bool = True, dialect: DialectType = None, **kwargs 10354) -> Tuple: 10355 """ 10356 Returns an tuple. 10357 10358 Examples: 10359 >>> tuple_(1, 'x').sql() 10360 '(1, x)' 10361 10362 Args: 10363 expressions: the expressions to add to the tuple. 10364 copy: whether to copy the argument expressions. 10365 dialect: the source dialect. 10366 kwargs: the kwargs used to instantiate the function of interest. 10367 10368 Returns: 10369 A tuple expression. 10370 """ 10371 return Tuple( 10372 expressions=[ 10373 maybe_parse(expression, copy=copy, dialect=dialect, **kwargs) 10374 for expression in expressions 10375 ] 10376 ) 10377 10378 10379def true() -> Boolean: 10380 """ 10381 Returns a true Boolean expression. 10382 """ 10383 return Boolean(this=True) 10384 10385 10386def false() -> Boolean: 10387 """ 10388 Returns a false Boolean expression. 10389 """ 10390 return Boolean(this=False) 10391 10392 10393def null() -> Null: 10394 """ 10395 Returns a Null expression. 10396 """ 10397 return Null() 10398 10399 10400NONNULL_CONSTANTS = ( 10401 Literal, 10402 Boolean, 10403) 10404 10405CONSTANTS = ( 10406 Literal, 10407 Boolean, 10408 Null, 10409)
75class Expression(metaclass=_Expression): 76 """ 77 The base class for all expressions in a syntax tree. Each Expression encapsulates any necessary 78 context, such as its child expressions, their names (arg keys), and whether a given child expression 79 is optional or not. 80 81 Attributes: 82 key: a unique key for each class in the Expression hierarchy. This is useful for hashing 83 and representing expressions as strings. 84 arg_types: determines the arguments (child nodes) supported by an expression. It maps 85 arg keys to booleans that indicate whether the corresponding args are optional. 86 parent: a reference to the parent expression (or None, in case of root expressions). 87 arg_key: the arg key an expression is associated with, i.e. the name its parent expression 88 uses to refer to it. 89 index: the index of an expression if it is inside of a list argument in its parent. 90 comments: a list of comments that are associated with a given expression. This is used in 91 order to preserve comments when transpiling SQL code. 92 type: the `sqlglot.expressions.DataType` type of an expression. This is inferred by the 93 optimizer, in order to enable some transformations that require type information. 94 meta: a dictionary that can be used to store useful metadata for a given expression. 95 96 Example: 97 >>> class Foo(Expression): 98 ... arg_types = {"this": True, "expression": False} 99 100 The above definition informs us that Foo is an Expression that requires an argument called 101 "this" and may also optionally receive an argument called "expression". 102 103 Args: 104 args: a mapping used for retrieving the arguments of an expression, given their arg keys. 105 """ 106 107 key = "expression" 108 arg_types = {"this": True} 109 required_args = {"this"} 110 __slots__ = ("args", "parent", "arg_key", "index", "comments", "_type", "_meta", "_hash") 111 112 def __init__(self, **args: t.Any): 113 self.args: t.Dict[str, t.Any] = args 114 self.parent: t.Optional[Expression] = None 115 self.arg_key: t.Optional[str] = None 116 self.index: t.Optional[int] = None 117 self.comments: t.Optional[t.List[str]] = None 118 self._type: t.Optional[DataType] = None 119 self._meta: t.Optional[t.Dict[str, t.Any]] = None 120 self._hash: t.Optional[int] = None 121 122 for arg_key, value in self.args.items(): 123 self._set_parent(arg_key, value) 124 125 def __eq__(self, other) -> bool: 126 return self is other or (type(self) is type(other) and hash(self) == hash(other)) 127 128 def __hash__(self) -> int: 129 if self._hash is None: 130 nodes = [] 131 queue = deque([self]) 132 133 while queue: 134 node = queue.popleft() 135 nodes.append(node) 136 137 for v in node.iter_expressions(): 138 if v._hash is None: 139 queue.append(v) 140 141 for node in reversed(nodes): 142 hash_ = hash(node.key) 143 t = type(node) 144 145 if t is Literal or t is Identifier: 146 for k, v in sorted(node.args.items()): 147 if v: 148 hash_ = hash((hash_, k, v)) 149 else: 150 for k, v in sorted(node.args.items()): 151 t = type(v) 152 153 if t is list: 154 for x in v: 155 if x is not None and x is not False: 156 hash_ = hash((hash_, k, x.lower() if type(x) is str else x)) 157 else: 158 hash_ = hash((hash_, k)) 159 elif v is not None and v is not False: 160 hash_ = hash((hash_, k, v.lower() if t is str else v)) 161 162 node._hash = hash_ 163 assert self._hash 164 return self._hash 165 166 def __reduce__(self) -> t.Tuple[t.Callable, t.Tuple[t.List[t.Dict[str, t.Any]]]]: 167 from sqlglot.serde import dump, load 168 169 return (load, (dump(self),)) 170 171 @property 172 def this(self) -> t.Any: 173 """ 174 Retrieves the argument with key "this". 175 """ 176 return self.args.get("this") 177 178 @property 179 def expression(self) -> t.Any: 180 """ 181 Retrieves the argument with key "expression". 182 """ 183 return self.args.get("expression") 184 185 @property 186 def expressions(self) -> t.List[t.Any]: 187 """ 188 Retrieves the argument with key "expressions". 189 """ 190 return self.args.get("expressions") or [] 191 192 def text(self, key) -> str: 193 """ 194 Returns a textual representation of the argument corresponding to "key". This can only be used 195 for args that are strings or leaf Expression instances, such as identifiers and literals. 196 """ 197 field = self.args.get(key) 198 if isinstance(field, str): 199 return field 200 if isinstance(field, (Identifier, Literal, Var)): 201 return field.this 202 if isinstance(field, (Star, Null)): 203 return field.name 204 return "" 205 206 @property 207 def is_string(self) -> bool: 208 """ 209 Checks whether a Literal expression is a string. 210 """ 211 return isinstance(self, Literal) and self.args["is_string"] 212 213 @property 214 def is_number(self) -> bool: 215 """ 216 Checks whether a Literal expression is a number. 217 """ 218 return (isinstance(self, Literal) and not self.args["is_string"]) or ( 219 isinstance(self, Neg) and self.this.is_number 220 ) 221 222 def to_py(self) -> t.Any: 223 """ 224 Returns a Python object equivalent of the SQL node. 225 """ 226 raise ValueError(f"{self} cannot be converted to a Python object.") 227 228 @property 229 def is_int(self) -> bool: 230 """ 231 Checks whether an expression is an integer. 232 """ 233 return self.is_number and isinstance(self.to_py(), int) 234 235 @property 236 def is_star(self) -> bool: 237 """Checks whether an expression is a star.""" 238 return isinstance(self, Star) or (isinstance(self, Column) and isinstance(self.this, Star)) 239 240 @property 241 def alias(self) -> str: 242 """ 243 Returns the alias of the expression, or an empty string if it's not aliased. 244 """ 245 if isinstance(self.args.get("alias"), TableAlias): 246 return self.args["alias"].name 247 return self.text("alias") 248 249 @property 250 def alias_column_names(self) -> t.List[str]: 251 table_alias = self.args.get("alias") 252 if not table_alias: 253 return [] 254 return [c.name for c in table_alias.args.get("columns") or []] 255 256 @property 257 def name(self) -> str: 258 return self.text("this") 259 260 @property 261 def alias_or_name(self) -> str: 262 return self.alias or self.name 263 264 @property 265 def output_name(self) -> str: 266 """ 267 Name of the output column if this expression is a selection. 268 269 If the Expression has no output name, an empty string is returned. 270 271 Example: 272 >>> from sqlglot import parse_one 273 >>> parse_one("SELECT a").expressions[0].output_name 274 'a' 275 >>> parse_one("SELECT b AS c").expressions[0].output_name 276 'c' 277 >>> parse_one("SELECT 1 + 2").expressions[0].output_name 278 '' 279 """ 280 return "" 281 282 @property 283 def type(self) -> t.Optional[DataType]: 284 if isinstance(self, Cast): 285 return self._type or self.to 286 return self._type 287 288 @type.setter 289 def type(self, dtype: t.Optional[DataType | DataType.Type | str]) -> None: 290 if dtype and not isinstance(dtype, DataType): 291 dtype = DataType.build(dtype) 292 self._type = dtype # type: ignore 293 294 def is_type(self, *dtypes) -> bool: 295 return self.type is not None and self.type.is_type(*dtypes) 296 297 def is_leaf(self) -> bool: 298 return not any(isinstance(v, (Expression, list)) and v for v in self.args.values()) 299 300 @property 301 def meta(self) -> t.Dict[str, t.Any]: 302 if self._meta is None: 303 self._meta = {} 304 return self._meta 305 306 def __deepcopy__(self, memo): 307 root = self.__class__() 308 stack = [(self, root)] 309 310 while stack: 311 node, copy = stack.pop() 312 313 if node.comments is not None: 314 copy.comments = deepcopy(node.comments) 315 if node._type is not None: 316 copy._type = deepcopy(node._type) 317 if node._meta is not None: 318 copy._meta = deepcopy(node._meta) 319 if node._hash is not None: 320 copy._hash = node._hash 321 322 for k, vs in node.args.items(): 323 if hasattr(vs, "parent"): 324 stack.append((vs, vs.__class__())) 325 copy.set(k, stack[-1][-1]) 326 elif type(vs) is list: 327 copy.args[k] = [] 328 329 for v in vs: 330 if hasattr(v, "parent"): 331 stack.append((v, v.__class__())) 332 copy.append(k, stack[-1][-1]) 333 else: 334 copy.append(k, v) 335 else: 336 copy.args[k] = vs 337 338 return root 339 340 def copy(self) -> Self: 341 """ 342 Returns a deep copy of the expression. 343 """ 344 return deepcopy(self) 345 346 def add_comments(self, comments: t.Optional[t.List[str]] = None, prepend: bool = False) -> None: 347 if self.comments is None: 348 self.comments = [] 349 350 if comments: 351 for comment in comments: 352 _, *meta = comment.split(SQLGLOT_META) 353 if meta: 354 for kv in "".join(meta).split(","): 355 k, *v = kv.split("=") 356 value = v[0].strip() if v else True 357 self.meta[k.strip()] = to_bool(value) 358 359 if not prepend: 360 self.comments.append(comment) 361 362 if prepend: 363 self.comments = comments + self.comments 364 365 def pop_comments(self) -> t.List[str]: 366 comments = self.comments or [] 367 self.comments = None 368 return comments 369 370 def append(self, arg_key: str, value: t.Any) -> None: 371 """ 372 Appends value to arg_key if it's a list or sets it as a new list. 373 374 Args: 375 arg_key (str): name of the list expression arg 376 value (Any): value to append to the list 377 """ 378 if type(self.args.get(arg_key)) is not list: 379 self.args[arg_key] = [] 380 self._set_parent(arg_key, value) 381 values = self.args[arg_key] 382 if hasattr(value, "parent"): 383 value.index = len(values) 384 values.append(value) 385 386 def set( 387 self, 388 arg_key: str, 389 value: t.Any, 390 index: t.Optional[int] = None, 391 overwrite: bool = True, 392 ) -> None: 393 """ 394 Sets arg_key to value. 395 396 Args: 397 arg_key: name of the expression arg. 398 value: value to set the arg to. 399 index: if the arg is a list, this specifies what position to add the value in it. 400 overwrite: assuming an index is given, this determines whether to overwrite the 401 list entry instead of only inserting a new value (i.e., like list.insert). 402 """ 403 expression: t.Optional[Expression] = self 404 405 while expression and expression._hash is not None: 406 expression._hash = None 407 expression = expression.parent 408 409 if index is not None: 410 expressions = self.args.get(arg_key) or [] 411 412 if seq_get(expressions, index) is None: 413 return 414 if value is None: 415 expressions.pop(index) 416 for v in expressions[index:]: 417 v.index = v.index - 1 418 return 419 420 if isinstance(value, list): 421 expressions.pop(index) 422 expressions[index:index] = value 423 elif overwrite: 424 expressions[index] = value 425 else: 426 expressions.insert(index, value) 427 428 value = expressions 429 elif value is None: 430 self.args.pop(arg_key, None) 431 return 432 433 self.args[arg_key] = value 434 self._set_parent(arg_key, value, index) 435 436 def _set_parent(self, arg_key: str, value: t.Any, index: t.Optional[int] = None) -> None: 437 if hasattr(value, "parent"): 438 value.parent = self 439 value.arg_key = arg_key 440 value.index = index 441 elif type(value) is list: 442 for index, v in enumerate(value): 443 if hasattr(v, "parent"): 444 v.parent = self 445 v.arg_key = arg_key 446 v.index = index 447 448 @property 449 def depth(self) -> int: 450 """ 451 Returns the depth of this tree. 452 """ 453 if self.parent: 454 return self.parent.depth + 1 455 return 0 456 457 def iter_expressions(self, reverse: bool = False) -> t.Iterator[Expression]: 458 """Yields the key and expression for all arguments, exploding list args.""" 459 for vs in reversed(self.args.values()) if reverse else self.args.values(): # type: ignore 460 if type(vs) is list: 461 for v in reversed(vs) if reverse else vs: # type: ignore 462 if hasattr(v, "parent"): 463 yield v 464 elif hasattr(vs, "parent"): 465 yield vs 466 467 def find(self, *expression_types: t.Type[E], bfs: bool = True) -> t.Optional[E]: 468 """ 469 Returns the first node in this tree which matches at least one of 470 the specified types. 471 472 Args: 473 expression_types: the expression type(s) to match. 474 bfs: whether to search the AST using the BFS algorithm (DFS is used if false). 475 476 Returns: 477 The node which matches the criteria or None if no such node was found. 478 """ 479 return next(self.find_all(*expression_types, bfs=bfs), None) 480 481 def find_all(self, *expression_types: t.Type[E], bfs: bool = True) -> t.Iterator[E]: 482 """ 483 Returns a generator object which visits all nodes in this tree and only 484 yields those that match at least one of the specified expression types. 485 486 Args: 487 expression_types: the expression type(s) to match. 488 bfs: whether to search the AST using the BFS algorithm (DFS is used if false). 489 490 Returns: 491 The generator object. 492 """ 493 for expression in self.walk(bfs=bfs): 494 if isinstance(expression, expression_types): 495 yield expression 496 497 def find_ancestor(self, *expression_types: t.Type[E]) -> t.Optional[E]: 498 """ 499 Returns a nearest parent matching expression_types. 500 501 Args: 502 expression_types: the expression type(s) to match. 503 504 Returns: 505 The parent node. 506 """ 507 ancestor = self.parent 508 while ancestor and not isinstance(ancestor, expression_types): 509 ancestor = ancestor.parent 510 return ancestor # type: ignore 511 512 @property 513 def parent_select(self) -> t.Optional[Select]: 514 """ 515 Returns the parent select statement. 516 """ 517 return self.find_ancestor(Select) 518 519 @property 520 def same_parent(self) -> bool: 521 """Returns if the parent is the same class as itself.""" 522 return type(self.parent) is self.__class__ 523 524 def root(self) -> Expression: 525 """ 526 Returns the root expression of this tree. 527 """ 528 expression = self 529 while expression.parent: 530 expression = expression.parent 531 return expression 532 533 def walk( 534 self, bfs: bool = True, prune: t.Optional[t.Callable[[Expression], bool]] = None 535 ) -> t.Iterator[Expression]: 536 """ 537 Returns a generator object which visits all nodes in this tree. 538 539 Args: 540 bfs: if set to True the BFS traversal order will be applied, 541 otherwise the DFS traversal will be used instead. 542 prune: callable that returns True if the generator should stop traversing 543 this branch of the tree. 544 545 Returns: 546 the generator object. 547 """ 548 if bfs: 549 yield from self.bfs(prune=prune) 550 else: 551 yield from self.dfs(prune=prune) 552 553 def dfs( 554 self, prune: t.Optional[t.Callable[[Expression], bool]] = None 555 ) -> t.Iterator[Expression]: 556 """ 557 Returns a generator object which visits all nodes in this tree in 558 the DFS (Depth-first) order. 559 560 Returns: 561 The generator object. 562 """ 563 stack = [self] 564 565 while stack: 566 node = stack.pop() 567 568 yield node 569 570 if prune and prune(node): 571 continue 572 573 for v in node.iter_expressions(reverse=True): 574 stack.append(v) 575 576 def bfs( 577 self, prune: t.Optional[t.Callable[[Expression], bool]] = None 578 ) -> t.Iterator[Expression]: 579 """ 580 Returns a generator object which visits all nodes in this tree in 581 the BFS (Breadth-first) order. 582 583 Returns: 584 The generator object. 585 """ 586 queue = deque([self]) 587 588 while queue: 589 node = queue.popleft() 590 591 yield node 592 593 if prune and prune(node): 594 continue 595 596 for v in node.iter_expressions(): 597 queue.append(v) 598 599 def unnest(self): 600 """ 601 Returns the first non parenthesis child or self. 602 """ 603 expression = self 604 while type(expression) is Paren: 605 expression = expression.this 606 return expression 607 608 def unalias(self): 609 """ 610 Returns the inner expression if this is an Alias. 611 """ 612 if isinstance(self, Alias): 613 return self.this 614 return self 615 616 def unnest_operands(self): 617 """ 618 Returns unnested operands as a tuple. 619 """ 620 return tuple(arg.unnest() for arg in self.iter_expressions()) 621 622 def flatten(self, unnest=True): 623 """ 624 Returns a generator which yields child nodes whose parents are the same class. 625 626 A AND B AND C -> [A, B, C] 627 """ 628 for node in self.dfs(prune=lambda n: n.parent and type(n) is not self.__class__): 629 if type(node) is not self.__class__: 630 yield node.unnest() if unnest and not isinstance(node, Subquery) else node 631 632 def __str__(self) -> str: 633 return self.sql() 634 635 def __repr__(self) -> str: 636 return _to_s(self) 637 638 def to_s(self) -> str: 639 """ 640 Same as __repr__, but includes additional information which can be useful 641 for debugging, like empty or missing args and the AST nodes' object IDs. 642 """ 643 return _to_s(self, verbose=True) 644 645 def sql(self, dialect: DialectType = None, **opts) -> str: 646 """ 647 Returns SQL string representation of this tree. 648 649 Args: 650 dialect: the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql"). 651 opts: other `sqlglot.generator.Generator` options. 652 653 Returns: 654 The SQL string. 655 """ 656 from sqlglot.dialects import Dialect 657 658 return Dialect.get_or_raise(dialect).generate(self, **opts) 659 660 def transform(self, fun: t.Callable, *args: t.Any, copy: bool = True, **kwargs) -> Expression: 661 """ 662 Visits all tree nodes (excluding already transformed ones) 663 and applies the given transformation function to each node. 664 665 Args: 666 fun: a function which takes a node as an argument and returns a 667 new transformed node or the same node without modifications. If the function 668 returns None, then the corresponding node will be removed from the syntax tree. 669 copy: if set to True a new tree instance is constructed, otherwise the tree is 670 modified in place. 671 672 Returns: 673 The transformed tree. 674 """ 675 root = None 676 new_node = None 677 678 for node in (self.copy() if copy else self).dfs(prune=lambda n: n is not new_node): 679 parent, arg_key, index = node.parent, node.arg_key, node.index 680 new_node = fun(node, *args, **kwargs) 681 682 if not root: 683 root = new_node 684 elif parent and arg_key and new_node is not node: 685 parent.set(arg_key, new_node, index) 686 687 assert root 688 return root.assert_is(Expression) 689 690 @t.overload 691 def replace(self, expression: E) -> E: ... 692 693 @t.overload 694 def replace(self, expression: None) -> None: ... 695 696 def replace(self, expression): 697 """ 698 Swap out this expression with a new expression. 699 700 For example:: 701 702 >>> tree = Select().select("x").from_("tbl") 703 >>> tree.find(Column).replace(column("y")) 704 Column( 705 this=Identifier(this=y, quoted=False)) 706 >>> tree.sql() 707 'SELECT y FROM tbl' 708 709 Args: 710 expression: new node 711 712 Returns: 713 The new expression or expressions. 714 """ 715 parent = self.parent 716 717 if not parent or parent is expression: 718 return expression 719 720 key = self.arg_key 721 value = parent.args.get(key) 722 723 if type(expression) is list and isinstance(value, Expression): 724 # We are trying to replace an Expression with a list, so it's assumed that 725 # the intention was to really replace the parent of this expression. 726 value.parent.replace(expression) 727 else: 728 parent.set(key, expression, self.index) 729 730 if expression is not self: 731 self.parent = None 732 self.arg_key = None 733 self.index = None 734 735 return expression 736 737 def pop(self: E) -> E: 738 """ 739 Remove this expression from its AST. 740 741 Returns: 742 The popped expression. 743 """ 744 self.replace(None) 745 return self 746 747 def assert_is(self, type_: t.Type[E]) -> E: 748 """ 749 Assert that this `Expression` is an instance of `type_`. 750 751 If it is NOT an instance of `type_`, this raises an assertion error. 752 Otherwise, this returns this expression. 753 754 Examples: 755 This is useful for type security in chained expressions: 756 757 >>> import sqlglot 758 >>> sqlglot.parse_one("SELECT x from y").assert_is(Select).select("z").sql() 759 'SELECT x, z FROM y' 760 """ 761 if not isinstance(self, type_): 762 raise AssertionError(f"{self} is not {type_}.") 763 return self 764 765 def error_messages(self, args: t.Optional[t.Sequence] = None) -> t.List[str]: 766 """ 767 Checks if this expression is valid (e.g. all mandatory args are set). 768 769 Args: 770 args: a sequence of values that were used to instantiate a Func expression. This is used 771 to check that the provided arguments don't exceed the function argument limit. 772 773 Returns: 774 A list of error messages for all possible errors that were found. 775 """ 776 errors: t.List[str] = [] 777 778 if UNITTEST: 779 for k in self.args: 780 if k not in self.arg_types: 781 raise TypeError(f"Unexpected keyword: '{k}' for {self.__class__}") 782 783 for k in self.required_args: 784 v = self.args.get(k) 785 if v is None or (type(v) is list and not v): 786 errors.append(f"Required keyword: '{k}' missing for {self.__class__}") 787 788 if ( 789 args 790 and isinstance(self, Func) 791 and len(args) > len(self.arg_types) 792 and not self.is_var_len_args 793 ): 794 errors.append( 795 f"The number of provided arguments ({len(args)}) is greater than " 796 f"the maximum number of supported arguments ({len(self.arg_types)})" 797 ) 798 799 return errors 800 801 def dump(self): 802 """ 803 Dump this Expression to a JSON-serializable dict. 804 """ 805 from sqlglot.serde import dump 806 807 return dump(self) 808 809 @classmethod 810 def load(cls, obj): 811 """ 812 Load a dict (as returned by `Expression.dump`) into an Expression instance. 813 """ 814 from sqlglot.serde import load 815 816 return load(obj) 817 818 def and_( 819 self, 820 *expressions: t.Optional[ExpOrStr], 821 dialect: DialectType = None, 822 copy: bool = True, 823 wrap: bool = True, 824 **opts, 825 ) -> Condition: 826 """ 827 AND this condition with one or multiple expressions. 828 829 Example: 830 >>> condition("x=1").and_("y=1").sql() 831 'x = 1 AND y = 1' 832 833 Args: 834 *expressions: the SQL code strings to parse. 835 If an `Expression` instance is passed, it will be used as-is. 836 dialect: the dialect used to parse the input expression. 837 copy: whether to copy the involved expressions (only applies to Expressions). 838 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 839 precedence issues, but can be turned off when the produced AST is too deep and 840 causes recursion-related issues. 841 opts: other options to use to parse the input expressions. 842 843 Returns: 844 The new And condition. 845 """ 846 return and_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts) 847 848 def or_( 849 self, 850 *expressions: t.Optional[ExpOrStr], 851 dialect: DialectType = None, 852 copy: bool = True, 853 wrap: bool = True, 854 **opts, 855 ) -> Condition: 856 """ 857 OR this condition with one or multiple expressions. 858 859 Example: 860 >>> condition("x=1").or_("y=1").sql() 861 'x = 1 OR y = 1' 862 863 Args: 864 *expressions: the SQL code strings to parse. 865 If an `Expression` instance is passed, it will be used as-is. 866 dialect: the dialect used to parse the input expression. 867 copy: whether to copy the involved expressions (only applies to Expressions). 868 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 869 precedence issues, but can be turned off when the produced AST is too deep and 870 causes recursion-related issues. 871 opts: other options to use to parse the input expressions. 872 873 Returns: 874 The new Or condition. 875 """ 876 return or_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts) 877 878 def not_(self, copy: bool = True): 879 """ 880 Wrap this condition with NOT. 881 882 Example: 883 >>> condition("x=1").not_().sql() 884 'NOT x = 1' 885 886 Args: 887 copy: whether to copy this object. 888 889 Returns: 890 The new Not instance. 891 """ 892 return not_(self, copy=copy) 893 894 def update_positions( 895 self: E, 896 other: t.Optional[Token | Expression] = None, 897 line: t.Optional[int] = None, 898 col: t.Optional[int] = None, 899 start: t.Optional[int] = None, 900 end: t.Optional[int] = None, 901 ) -> E: 902 """ 903 Update this expression with positions from a token or other expression. 904 905 Args: 906 other: a token or expression to update this expression with. 907 line: the line number to use if other is None 908 col: column number 909 start: start char index 910 end: end char index 911 912 Returns: 913 The updated expression. 914 """ 915 if other is None: 916 self.meta["line"] = line 917 self.meta["col"] = col 918 self.meta["start"] = start 919 self.meta["end"] = end 920 elif hasattr(other, "meta"): 921 for k in POSITION_META_KEYS: 922 self.meta[k] = other.meta[k] 923 else: 924 self.meta["line"] = other.line 925 self.meta["col"] = other.col 926 self.meta["start"] = other.start 927 self.meta["end"] = other.end 928 return self 929 930 def as_( 931 self, 932 alias: str | Identifier, 933 quoted: t.Optional[bool] = None, 934 dialect: DialectType = None, 935 copy: bool = True, 936 **opts, 937 ) -> Alias: 938 return alias_(self, alias, quoted=quoted, dialect=dialect, copy=copy, **opts) 939 940 def _binop(self, klass: t.Type[E], other: t.Any, reverse: bool = False) -> E: 941 this = self.copy() 942 other = convert(other, copy=True) 943 if not isinstance(this, klass) and not isinstance(other, klass): 944 this = _wrap(this, Binary) 945 other = _wrap(other, Binary) 946 if reverse: 947 return klass(this=other, expression=this) 948 return klass(this=this, expression=other) 949 950 def __getitem__(self, other: ExpOrStr | t.Tuple[ExpOrStr]) -> Bracket: 951 return Bracket( 952 this=self.copy(), expressions=[convert(e, copy=True) for e in ensure_list(other)] 953 ) 954 955 def __iter__(self) -> t.Iterator: 956 if "expressions" in self.arg_types: 957 return iter(self.args.get("expressions") or []) 958 # We define this because __getitem__ converts Expression into an iterable, which is 959 # problematic because one can hit infinite loops if they do "for x in some_expr: ..." 960 # See: https://peps.python.org/pep-0234/ 961 raise TypeError(f"'{self.__class__.__name__}' object is not iterable") 962 963 def isin( 964 self, 965 *expressions: t.Any, 966 query: t.Optional[ExpOrStr] = None, 967 unnest: t.Optional[ExpOrStr] | t.Collection[ExpOrStr] = None, 968 copy: bool = True, 969 **opts, 970 ) -> In: 971 subquery = maybe_parse(query, copy=copy, **opts) if query else None 972 if subquery and not isinstance(subquery, Subquery): 973 subquery = subquery.subquery(copy=False) 974 975 return In( 976 this=maybe_copy(self, copy), 977 expressions=[convert(e, copy=copy) for e in expressions], 978 query=subquery, 979 unnest=( 980 Unnest( 981 expressions=[ 982 maybe_parse(t.cast(ExpOrStr, e), copy=copy, **opts) 983 for e in ensure_list(unnest) 984 ] 985 ) 986 if unnest 987 else None 988 ), 989 ) 990 991 def between( 992 self, 993 low: t.Any, 994 high: t.Any, 995 copy: bool = True, 996 symmetric: t.Optional[bool] = None, 997 **opts, 998 ) -> Between: 999 between = Between( 1000 this=maybe_copy(self, copy), 1001 low=convert(low, copy=copy, **opts), 1002 high=convert(high, copy=copy, **opts), 1003 ) 1004 if symmetric is not None: 1005 between.set("symmetric", symmetric) 1006 1007 return between 1008 1009 def is_(self, other: ExpOrStr) -> Is: 1010 return self._binop(Is, other) 1011 1012 def like(self, other: ExpOrStr) -> Like: 1013 return self._binop(Like, other) 1014 1015 def ilike(self, other: ExpOrStr) -> ILike: 1016 return self._binop(ILike, other) 1017 1018 def eq(self, other: t.Any) -> EQ: 1019 return self._binop(EQ, other) 1020 1021 def neq(self, other: t.Any) -> NEQ: 1022 return self._binop(NEQ, other) 1023 1024 def rlike(self, other: ExpOrStr) -> RegexpLike: 1025 return self._binop(RegexpLike, other) 1026 1027 def div(self, other: ExpOrStr, typed: bool = False, safe: bool = False) -> Div: 1028 div = self._binop(Div, other) 1029 div.set("typed", typed) 1030 div.set("safe", safe) 1031 return div 1032 1033 def asc(self, nulls_first: bool = True) -> Ordered: 1034 return Ordered(this=self.copy(), nulls_first=nulls_first) 1035 1036 def desc(self, nulls_first: bool = False) -> Ordered: 1037 return Ordered(this=self.copy(), desc=True, nulls_first=nulls_first) 1038 1039 def __lt__(self, other: t.Any) -> LT: 1040 return self._binop(LT, other) 1041 1042 def __le__(self, other: t.Any) -> LTE: 1043 return self._binop(LTE, other) 1044 1045 def __gt__(self, other: t.Any) -> GT: 1046 return self._binop(GT, other) 1047 1048 def __ge__(self, other: t.Any) -> GTE: 1049 return self._binop(GTE, other) 1050 1051 def __add__(self, other: t.Any) -> Add: 1052 return self._binop(Add, other) 1053 1054 def __radd__(self, other: t.Any) -> Add: 1055 return self._binop(Add, other, reverse=True) 1056 1057 def __sub__(self, other: t.Any) -> Sub: 1058 return self._binop(Sub, other) 1059 1060 def __rsub__(self, other: t.Any) -> Sub: 1061 return self._binop(Sub, other, reverse=True) 1062 1063 def __mul__(self, other: t.Any) -> Mul: 1064 return self._binop(Mul, other) 1065 1066 def __rmul__(self, other: t.Any) -> Mul: 1067 return self._binop(Mul, other, reverse=True) 1068 1069 def __truediv__(self, other: t.Any) -> Div: 1070 return self._binop(Div, other) 1071 1072 def __rtruediv__(self, other: t.Any) -> Div: 1073 return self._binop(Div, other, reverse=True) 1074 1075 def __floordiv__(self, other: t.Any) -> IntDiv: 1076 return self._binop(IntDiv, other) 1077 1078 def __rfloordiv__(self, other: t.Any) -> IntDiv: 1079 return self._binop(IntDiv, other, reverse=True) 1080 1081 def __mod__(self, other: t.Any) -> Mod: 1082 return self._binop(Mod, other) 1083 1084 def __rmod__(self, other: t.Any) -> Mod: 1085 return self._binop(Mod, other, reverse=True) 1086 1087 def __pow__(self, other: t.Any) -> Pow: 1088 return self._binop(Pow, other) 1089 1090 def __rpow__(self, other: t.Any) -> Pow: 1091 return self._binop(Pow, other, reverse=True) 1092 1093 def __and__(self, other: t.Any) -> And: 1094 return self._binop(And, other) 1095 1096 def __rand__(self, other: t.Any) -> And: 1097 return self._binop(And, other, reverse=True) 1098 1099 def __or__(self, other: t.Any) -> Or: 1100 return self._binop(Or, other) 1101 1102 def __ror__(self, other: t.Any) -> Or: 1103 return self._binop(Or, other, reverse=True) 1104 1105 def __neg__(self) -> Neg: 1106 return Neg(this=_wrap(self.copy(), Binary)) 1107 1108 def __invert__(self) -> Not: 1109 return not_(self.copy())
The base class for all expressions in a syntax tree. Each Expression encapsulates any necessary context, such as its child expressions, their names (arg keys), and whether a given child expression is optional or not.
Attributes:
- key: a unique key for each class in the Expression hierarchy. This is useful for hashing and representing expressions as strings.
- arg_types: determines the arguments (child nodes) supported by an expression. It maps arg keys to booleans that indicate whether the corresponding args are optional.
- parent: a reference to the parent expression (or None, in case of root expressions).
- arg_key: the arg key an expression is associated with, i.e. the name its parent expression uses to refer to it.
- index: the index of an expression if it is inside of a list argument in its parent.
- comments: a list of comments that are associated with a given expression. This is used in order to preserve comments when transpiling SQL code.
- type: the
sqlglot.expressions.DataTypetype of an expression. This is inferred by the optimizer, in order to enable some transformations that require type information. - meta: a dictionary that can be used to store useful metadata for a given expression.
Example:
>>> class Foo(Expression): ... arg_types = {"this": True, "expression": False}The above definition informs us that Foo is an Expression that requires an argument called "this" and may also optionally receive an argument called "expression".
Arguments:
- args: a mapping used for retrieving the arguments of an expression, given their arg keys.
112 def __init__(self, **args: t.Any): 113 self.args: t.Dict[str, t.Any] = args 114 self.parent: t.Optional[Expression] = None 115 self.arg_key: t.Optional[str] = None 116 self.index: t.Optional[int] = None 117 self.comments: t.Optional[t.List[str]] = None 118 self._type: t.Optional[DataType] = None 119 self._meta: t.Optional[t.Dict[str, t.Any]] = None 120 self._hash: t.Optional[int] = None 121 122 for arg_key, value in self.args.items(): 123 self._set_parent(arg_key, value)
171 @property 172 def this(self) -> t.Any: 173 """ 174 Retrieves the argument with key "this". 175 """ 176 return self.args.get("this")
Retrieves the argument with key "this".
178 @property 179 def expression(self) -> t.Any: 180 """ 181 Retrieves the argument with key "expression". 182 """ 183 return self.args.get("expression")
Retrieves the argument with key "expression".
185 @property 186 def expressions(self) -> t.List[t.Any]: 187 """ 188 Retrieves the argument with key "expressions". 189 """ 190 return self.args.get("expressions") or []
Retrieves the argument with key "expressions".
192 def text(self, key) -> str: 193 """ 194 Returns a textual representation of the argument corresponding to "key". This can only be used 195 for args that are strings or leaf Expression instances, such as identifiers and literals. 196 """ 197 field = self.args.get(key) 198 if isinstance(field, str): 199 return field 200 if isinstance(field, (Identifier, Literal, Var)): 201 return field.this 202 if isinstance(field, (Star, Null)): 203 return field.name 204 return ""
Returns a textual representation of the argument corresponding to "key". This can only be used for args that are strings or leaf Expression instances, such as identifiers and literals.
206 @property 207 def is_string(self) -> bool: 208 """ 209 Checks whether a Literal expression is a string. 210 """ 211 return isinstance(self, Literal) and self.args["is_string"]
Checks whether a Literal expression is a string.
213 @property 214 def is_number(self) -> bool: 215 """ 216 Checks whether a Literal expression is a number. 217 """ 218 return (isinstance(self, Literal) and not self.args["is_string"]) or ( 219 isinstance(self, Neg) and self.this.is_number 220 )
Checks whether a Literal expression is a number.
222 def to_py(self) -> t.Any: 223 """ 224 Returns a Python object equivalent of the SQL node. 225 """ 226 raise ValueError(f"{self} cannot be converted to a Python object.")
Returns a Python object equivalent of the SQL node.
228 @property 229 def is_int(self) -> bool: 230 """ 231 Checks whether an expression is an integer. 232 """ 233 return self.is_number and isinstance(self.to_py(), int)
Checks whether an expression is an integer.
235 @property 236 def is_star(self) -> bool: 237 """Checks whether an expression is a star.""" 238 return isinstance(self, Star) or (isinstance(self, Column) and isinstance(self.this, Star))
Checks whether an expression is a star.
240 @property 241 def alias(self) -> str: 242 """ 243 Returns the alias of the expression, or an empty string if it's not aliased. 244 """ 245 if isinstance(self.args.get("alias"), TableAlias): 246 return self.args["alias"].name 247 return self.text("alias")
Returns the alias of the expression, or an empty string if it's not aliased.
264 @property 265 def output_name(self) -> str: 266 """ 267 Name of the output column if this expression is a selection. 268 269 If the Expression has no output name, an empty string is returned. 270 271 Example: 272 >>> from sqlglot import parse_one 273 >>> parse_one("SELECT a").expressions[0].output_name 274 'a' 275 >>> parse_one("SELECT b AS c").expressions[0].output_name 276 'c' 277 >>> parse_one("SELECT 1 + 2").expressions[0].output_name 278 '' 279 """ 280 return ""
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
340 def copy(self) -> Self: 341 """ 342 Returns a deep copy of the expression. 343 """ 344 return deepcopy(self)
Returns a deep copy of the expression.
346 def add_comments(self, comments: t.Optional[t.List[str]] = None, prepend: bool = False) -> None: 347 if self.comments is None: 348 self.comments = [] 349 350 if comments: 351 for comment in comments: 352 _, *meta = comment.split(SQLGLOT_META) 353 if meta: 354 for kv in "".join(meta).split(","): 355 k, *v = kv.split("=") 356 value = v[0].strip() if v else True 357 self.meta[k.strip()] = to_bool(value) 358 359 if not prepend: 360 self.comments.append(comment) 361 362 if prepend: 363 self.comments = comments + self.comments
370 def append(self, arg_key: str, value: t.Any) -> None: 371 """ 372 Appends value to arg_key if it's a list or sets it as a new list. 373 374 Args: 375 arg_key (str): name of the list expression arg 376 value (Any): value to append to the list 377 """ 378 if type(self.args.get(arg_key)) is not list: 379 self.args[arg_key] = [] 380 self._set_parent(arg_key, value) 381 values = self.args[arg_key] 382 if hasattr(value, "parent"): 383 value.index = len(values) 384 values.append(value)
Appends value to arg_key if it's a list or sets it as a new list.
Arguments:
- arg_key (str): name of the list expression arg
- value (Any): value to append to the list
386 def set( 387 self, 388 arg_key: str, 389 value: t.Any, 390 index: t.Optional[int] = None, 391 overwrite: bool = True, 392 ) -> None: 393 """ 394 Sets arg_key to value. 395 396 Args: 397 arg_key: name of the expression arg. 398 value: value to set the arg to. 399 index: if the arg is a list, this specifies what position to add the value in it. 400 overwrite: assuming an index is given, this determines whether to overwrite the 401 list entry instead of only inserting a new value (i.e., like list.insert). 402 """ 403 expression: t.Optional[Expression] = self 404 405 while expression and expression._hash is not None: 406 expression._hash = None 407 expression = expression.parent 408 409 if index is not None: 410 expressions = self.args.get(arg_key) or [] 411 412 if seq_get(expressions, index) is None: 413 return 414 if value is None: 415 expressions.pop(index) 416 for v in expressions[index:]: 417 v.index = v.index - 1 418 return 419 420 if isinstance(value, list): 421 expressions.pop(index) 422 expressions[index:index] = value 423 elif overwrite: 424 expressions[index] = value 425 else: 426 expressions.insert(index, value) 427 428 value = expressions 429 elif value is None: 430 self.args.pop(arg_key, None) 431 return 432 433 self.args[arg_key] = value 434 self._set_parent(arg_key, value, index)
Sets arg_key to value.
Arguments:
- arg_key: name of the expression arg.
- value: value to set the arg to.
- index: if the arg is a list, this specifies what position to add the value in it.
- overwrite: assuming an index is given, this determines whether to overwrite the list entry instead of only inserting a new value (i.e., like list.insert).
448 @property 449 def depth(self) -> int: 450 """ 451 Returns the depth of this tree. 452 """ 453 if self.parent: 454 return self.parent.depth + 1 455 return 0
Returns the depth of this tree.
457 def iter_expressions(self, reverse: bool = False) -> t.Iterator[Expression]: 458 """Yields the key and expression for all arguments, exploding list args.""" 459 for vs in reversed(self.args.values()) if reverse else self.args.values(): # type: ignore 460 if type(vs) is list: 461 for v in reversed(vs) if reverse else vs: # type: ignore 462 if hasattr(v, "parent"): 463 yield v 464 elif hasattr(vs, "parent"): 465 yield vs
Yields the key and expression for all arguments, exploding list args.
467 def find(self, *expression_types: t.Type[E], bfs: bool = True) -> t.Optional[E]: 468 """ 469 Returns the first node in this tree which matches at least one of 470 the specified types. 471 472 Args: 473 expression_types: the expression type(s) to match. 474 bfs: whether to search the AST using the BFS algorithm (DFS is used if false). 475 476 Returns: 477 The node which matches the criteria or None if no such node was found. 478 """ 479 return next(self.find_all(*expression_types, bfs=bfs), None)
Returns the first node in this tree which matches at least one of the specified types.
Arguments:
- expression_types: the expression type(s) to match.
- bfs: whether to search the AST using the BFS algorithm (DFS is used if false).
Returns:
The node which matches the criteria or None if no such node was found.
481 def find_all(self, *expression_types: t.Type[E], bfs: bool = True) -> t.Iterator[E]: 482 """ 483 Returns a generator object which visits all nodes in this tree and only 484 yields those that match at least one of the specified expression types. 485 486 Args: 487 expression_types: the expression type(s) to match. 488 bfs: whether to search the AST using the BFS algorithm (DFS is used if false). 489 490 Returns: 491 The generator object. 492 """ 493 for expression in self.walk(bfs=bfs): 494 if isinstance(expression, expression_types): 495 yield expression
Returns a generator object which visits all nodes in this tree and only yields those that match at least one of the specified expression types.
Arguments:
- expression_types: the expression type(s) to match.
- bfs: whether to search the AST using the BFS algorithm (DFS is used if false).
Returns:
The generator object.
497 def find_ancestor(self, *expression_types: t.Type[E]) -> t.Optional[E]: 498 """ 499 Returns a nearest parent matching expression_types. 500 501 Args: 502 expression_types: the expression type(s) to match. 503 504 Returns: 505 The parent node. 506 """ 507 ancestor = self.parent 508 while ancestor and not isinstance(ancestor, expression_types): 509 ancestor = ancestor.parent 510 return ancestor # type: ignore
Returns a nearest parent matching expression_types.
Arguments:
- expression_types: the expression type(s) to match.
Returns:
The parent node.
512 @property 513 def parent_select(self) -> t.Optional[Select]: 514 """ 515 Returns the parent select statement. 516 """ 517 return self.find_ancestor(Select)
Returns the parent select statement.
519 @property 520 def same_parent(self) -> bool: 521 """Returns if the parent is the same class as itself.""" 522 return type(self.parent) is self.__class__
Returns if the parent is the same class as itself.
524 def root(self) -> Expression: 525 """ 526 Returns the root expression of this tree. 527 """ 528 expression = self 529 while expression.parent: 530 expression = expression.parent 531 return expression
Returns the root expression of this tree.
533 def walk( 534 self, bfs: bool = True, prune: t.Optional[t.Callable[[Expression], bool]] = None 535 ) -> t.Iterator[Expression]: 536 """ 537 Returns a generator object which visits all nodes in this tree. 538 539 Args: 540 bfs: if set to True the BFS traversal order will be applied, 541 otherwise the DFS traversal will be used instead. 542 prune: callable that returns True if the generator should stop traversing 543 this branch of the tree. 544 545 Returns: 546 the generator object. 547 """ 548 if bfs: 549 yield from self.bfs(prune=prune) 550 else: 551 yield from self.dfs(prune=prune)
Returns a generator object which visits all nodes in this tree.
Arguments:
- bfs: if set to True the BFS traversal order will be applied, otherwise the DFS traversal will be used instead.
- prune: callable that returns True if the generator should stop traversing this branch of the tree.
Returns:
the generator object.
553 def dfs( 554 self, prune: t.Optional[t.Callable[[Expression], bool]] = None 555 ) -> t.Iterator[Expression]: 556 """ 557 Returns a generator object which visits all nodes in this tree in 558 the DFS (Depth-first) order. 559 560 Returns: 561 The generator object. 562 """ 563 stack = [self] 564 565 while stack: 566 node = stack.pop() 567 568 yield node 569 570 if prune and prune(node): 571 continue 572 573 for v in node.iter_expressions(reverse=True): 574 stack.append(v)
Returns a generator object which visits all nodes in this tree in the DFS (Depth-first) order.
Returns:
The generator object.
576 def bfs( 577 self, prune: t.Optional[t.Callable[[Expression], bool]] = None 578 ) -> t.Iterator[Expression]: 579 """ 580 Returns a generator object which visits all nodes in this tree in 581 the BFS (Breadth-first) order. 582 583 Returns: 584 The generator object. 585 """ 586 queue = deque([self]) 587 588 while queue: 589 node = queue.popleft() 590 591 yield node 592 593 if prune and prune(node): 594 continue 595 596 for v in node.iter_expressions(): 597 queue.append(v)
Returns a generator object which visits all nodes in this tree in the BFS (Breadth-first) order.
Returns:
The generator object.
599 def unnest(self): 600 """ 601 Returns the first non parenthesis child or self. 602 """ 603 expression = self 604 while type(expression) is Paren: 605 expression = expression.this 606 return expression
Returns the first non parenthesis child or self.
608 def unalias(self): 609 """ 610 Returns the inner expression if this is an Alias. 611 """ 612 if isinstance(self, Alias): 613 return self.this 614 return self
Returns the inner expression if this is an Alias.
616 def unnest_operands(self): 617 """ 618 Returns unnested operands as a tuple. 619 """ 620 return tuple(arg.unnest() for arg in self.iter_expressions())
Returns unnested operands as a tuple.
622 def flatten(self, unnest=True): 623 """ 624 Returns a generator which yields child nodes whose parents are the same class. 625 626 A AND B AND C -> [A, B, C] 627 """ 628 for node in self.dfs(prune=lambda n: n.parent and type(n) is not self.__class__): 629 if type(node) is not self.__class__: 630 yield node.unnest() if unnest and not isinstance(node, Subquery) else node
Returns a generator which yields child nodes whose parents are the same class.
A AND B AND C -> [A, B, C]
638 def to_s(self) -> str: 639 """ 640 Same as __repr__, but includes additional information which can be useful 641 for debugging, like empty or missing args and the AST nodes' object IDs. 642 """ 643 return _to_s(self, verbose=True)
Same as __repr__, but includes additional information which can be useful for debugging, like empty or missing args and the AST nodes' object IDs.
645 def sql(self, dialect: DialectType = None, **opts) -> str: 646 """ 647 Returns SQL string representation of this tree. 648 649 Args: 650 dialect: the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql"). 651 opts: other `sqlglot.generator.Generator` options. 652 653 Returns: 654 The SQL string. 655 """ 656 from sqlglot.dialects import Dialect 657 658 return Dialect.get_or_raise(dialect).generate(self, **opts)
Returns SQL string representation of this tree.
Arguments:
- dialect: the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql").
- opts: other
sqlglot.generator.Generatoroptions.
Returns:
The SQL string.
660 def transform(self, fun: t.Callable, *args: t.Any, copy: bool = True, **kwargs) -> Expression: 661 """ 662 Visits all tree nodes (excluding already transformed ones) 663 and applies the given transformation function to each node. 664 665 Args: 666 fun: a function which takes a node as an argument and returns a 667 new transformed node or the same node without modifications. If the function 668 returns None, then the corresponding node will be removed from the syntax tree. 669 copy: if set to True a new tree instance is constructed, otherwise the tree is 670 modified in place. 671 672 Returns: 673 The transformed tree. 674 """ 675 root = None 676 new_node = None 677 678 for node in (self.copy() if copy else self).dfs(prune=lambda n: n is not new_node): 679 parent, arg_key, index = node.parent, node.arg_key, node.index 680 new_node = fun(node, *args, **kwargs) 681 682 if not root: 683 root = new_node 684 elif parent and arg_key and new_node is not node: 685 parent.set(arg_key, new_node, index) 686 687 assert root 688 return root.assert_is(Expression)
Visits all tree nodes (excluding already transformed ones) and applies the given transformation function to each node.
Arguments:
- fun: a function which takes a node as an argument and returns a new transformed node or the same node without modifications. If the function returns None, then the corresponding node will be removed from the syntax tree.
- copy: if set to True a new tree instance is constructed, otherwise the tree is modified in place.
Returns:
The transformed tree.
696 def replace(self, expression): 697 """ 698 Swap out this expression with a new expression. 699 700 For example:: 701 702 >>> tree = Select().select("x").from_("tbl") 703 >>> tree.find(Column).replace(column("y")) 704 Column( 705 this=Identifier(this=y, quoted=False)) 706 >>> tree.sql() 707 'SELECT y FROM tbl' 708 709 Args: 710 expression: new node 711 712 Returns: 713 The new expression or expressions. 714 """ 715 parent = self.parent 716 717 if not parent or parent is expression: 718 return expression 719 720 key = self.arg_key 721 value = parent.args.get(key) 722 723 if type(expression) is list and isinstance(value, Expression): 724 # We are trying to replace an Expression with a list, so it's assumed that 725 # the intention was to really replace the parent of this expression. 726 value.parent.replace(expression) 727 else: 728 parent.set(key, expression, self.index) 729 730 if expression is not self: 731 self.parent = None 732 self.arg_key = None 733 self.index = None 734 735 return expression
Swap out this expression with a new expression.
For example::
>>> tree = Select().select("x").from_("tbl")
>>> tree.find(Column).replace(column("y"))
Column(
this=Identifier(this=y, quoted=False))
>>> tree.sql()
'SELECT y FROM tbl'
Arguments:
- expression: new node
Returns:
The new expression or expressions.
737 def pop(self: E) -> E: 738 """ 739 Remove this expression from its AST. 740 741 Returns: 742 The popped expression. 743 """ 744 self.replace(None) 745 return self
Remove this expression from its AST.
Returns:
The popped expression.
747 def assert_is(self, type_: t.Type[E]) -> E: 748 """ 749 Assert that this `Expression` is an instance of `type_`. 750 751 If it is NOT an instance of `type_`, this raises an assertion error. 752 Otherwise, this returns this expression. 753 754 Examples: 755 This is useful for type security in chained expressions: 756 757 >>> import sqlglot 758 >>> sqlglot.parse_one("SELECT x from y").assert_is(Select).select("z").sql() 759 'SELECT x, z FROM y' 760 """ 761 if not isinstance(self, type_): 762 raise AssertionError(f"{self} is not {type_}.") 763 return self
Assert that this Expression is an instance of type_.
If it is NOT an instance of type_, this raises an assertion error.
Otherwise, this returns this expression.
Examples:
This is useful for type security in chained expressions:
>>> import sqlglot >>> sqlglot.parse_one("SELECT x from y").assert_is(Select).select("z").sql() 'SELECT x, z FROM y'
765 def error_messages(self, args: t.Optional[t.Sequence] = None) -> t.List[str]: 766 """ 767 Checks if this expression is valid (e.g. all mandatory args are set). 768 769 Args: 770 args: a sequence of values that were used to instantiate a Func expression. This is used 771 to check that the provided arguments don't exceed the function argument limit. 772 773 Returns: 774 A list of error messages for all possible errors that were found. 775 """ 776 errors: t.List[str] = [] 777 778 if UNITTEST: 779 for k in self.args: 780 if k not in self.arg_types: 781 raise TypeError(f"Unexpected keyword: '{k}' for {self.__class__}") 782 783 for k in self.required_args: 784 v = self.args.get(k) 785 if v is None or (type(v) is list and not v): 786 errors.append(f"Required keyword: '{k}' missing for {self.__class__}") 787 788 if ( 789 args 790 and isinstance(self, Func) 791 and len(args) > len(self.arg_types) 792 and not self.is_var_len_args 793 ): 794 errors.append( 795 f"The number of provided arguments ({len(args)}) is greater than " 796 f"the maximum number of supported arguments ({len(self.arg_types)})" 797 ) 798 799 return errors
Checks if this expression is valid (e.g. all mandatory args are set).
Arguments:
- args: a sequence of values that were used to instantiate a Func expression. This is used to check that the provided arguments don't exceed the function argument limit.
Returns:
A list of error messages for all possible errors that were found.
801 def dump(self): 802 """ 803 Dump this Expression to a JSON-serializable dict. 804 """ 805 from sqlglot.serde import dump 806 807 return dump(self)
Dump this Expression to a JSON-serializable dict.
809 @classmethod 810 def load(cls, obj): 811 """ 812 Load a dict (as returned by `Expression.dump`) into an Expression instance. 813 """ 814 from sqlglot.serde import load 815 816 return load(obj)
Load a dict (as returned by Expression.dump) into an Expression instance.
818 def and_( 819 self, 820 *expressions: t.Optional[ExpOrStr], 821 dialect: DialectType = None, 822 copy: bool = True, 823 wrap: bool = True, 824 **opts, 825 ) -> Condition: 826 """ 827 AND this condition with one or multiple expressions. 828 829 Example: 830 >>> condition("x=1").and_("y=1").sql() 831 'x = 1 AND y = 1' 832 833 Args: 834 *expressions: the SQL code strings to parse. 835 If an `Expression` instance is passed, it will be used as-is. 836 dialect: the dialect used to parse the input expression. 837 copy: whether to copy the involved expressions (only applies to Expressions). 838 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 839 precedence issues, but can be turned off when the produced AST is too deep and 840 causes recursion-related issues. 841 opts: other options to use to parse the input expressions. 842 843 Returns: 844 The new And condition. 845 """ 846 return and_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts)
AND this condition with one or multiple expressions.
Example:
>>> condition("x=1").and_("y=1").sql() 'x = 1 AND y = 1'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - dialect: the dialect used to parse the input expression.
- copy: whether to copy the involved expressions (only applies to Expressions).
- wrap: whether to wrap the operands in
Parens. This is true by default to avoid precedence issues, but can be turned off when the produced AST is too deep and causes recursion-related issues. - opts: other options to use to parse the input expressions.
Returns:
The new And condition.
848 def or_( 849 self, 850 *expressions: t.Optional[ExpOrStr], 851 dialect: DialectType = None, 852 copy: bool = True, 853 wrap: bool = True, 854 **opts, 855 ) -> Condition: 856 """ 857 OR this condition with one or multiple expressions. 858 859 Example: 860 >>> condition("x=1").or_("y=1").sql() 861 'x = 1 OR y = 1' 862 863 Args: 864 *expressions: the SQL code strings to parse. 865 If an `Expression` instance is passed, it will be used as-is. 866 dialect: the dialect used to parse the input expression. 867 copy: whether to copy the involved expressions (only applies to Expressions). 868 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 869 precedence issues, but can be turned off when the produced AST is too deep and 870 causes recursion-related issues. 871 opts: other options to use to parse the input expressions. 872 873 Returns: 874 The new Or condition. 875 """ 876 return or_(self, *expressions, dialect=dialect, copy=copy, wrap=wrap, **opts)
OR this condition with one or multiple expressions.
Example:
>>> condition("x=1").or_("y=1").sql() 'x = 1 OR y = 1'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - dialect: the dialect used to parse the input expression.
- copy: whether to copy the involved expressions (only applies to Expressions).
- wrap: whether to wrap the operands in
Parens. This is true by default to avoid precedence issues, but can be turned off when the produced AST is too deep and causes recursion-related issues. - opts: other options to use to parse the input expressions.
Returns:
The new Or condition.
878 def not_(self, copy: bool = True): 879 """ 880 Wrap this condition with NOT. 881 882 Example: 883 >>> condition("x=1").not_().sql() 884 'NOT x = 1' 885 886 Args: 887 copy: whether to copy this object. 888 889 Returns: 890 The new Not instance. 891 """ 892 return not_(self, copy=copy)
Wrap this condition with NOT.
Example:
>>> condition("x=1").not_().sql() 'NOT x = 1'
Arguments:
- copy: whether to copy this object.
Returns:
The new Not instance.
894 def update_positions( 895 self: E, 896 other: t.Optional[Token | Expression] = None, 897 line: t.Optional[int] = None, 898 col: t.Optional[int] = None, 899 start: t.Optional[int] = None, 900 end: t.Optional[int] = None, 901 ) -> E: 902 """ 903 Update this expression with positions from a token or other expression. 904 905 Args: 906 other: a token or expression to update this expression with. 907 line: the line number to use if other is None 908 col: column number 909 start: start char index 910 end: end char index 911 912 Returns: 913 The updated expression. 914 """ 915 if other is None: 916 self.meta["line"] = line 917 self.meta["col"] = col 918 self.meta["start"] = start 919 self.meta["end"] = end 920 elif hasattr(other, "meta"): 921 for k in POSITION_META_KEYS: 922 self.meta[k] = other.meta[k] 923 else: 924 self.meta["line"] = other.line 925 self.meta["col"] = other.col 926 self.meta["start"] = other.start 927 self.meta["end"] = other.end 928 return self
Update this expression with positions from a token or other expression.
Arguments:
- other: a token or expression to update this expression with.
- line: the line number to use if other is None
- col: column number
- start: start char index
- end: end char index
Returns:
The updated expression.
963 def isin( 964 self, 965 *expressions: t.Any, 966 query: t.Optional[ExpOrStr] = None, 967 unnest: t.Optional[ExpOrStr] | t.Collection[ExpOrStr] = None, 968 copy: bool = True, 969 **opts, 970 ) -> In: 971 subquery = maybe_parse(query, copy=copy, **opts) if query else None 972 if subquery and not isinstance(subquery, Subquery): 973 subquery = subquery.subquery(copy=False) 974 975 return In( 976 this=maybe_copy(self, copy), 977 expressions=[convert(e, copy=copy) for e in expressions], 978 query=subquery, 979 unnest=( 980 Unnest( 981 expressions=[ 982 maybe_parse(t.cast(ExpOrStr, e), copy=copy, **opts) 983 for e in ensure_list(unnest) 984 ] 985 ) 986 if unnest 987 else None 988 ), 989 )
991 def between( 992 self, 993 low: t.Any, 994 high: t.Any, 995 copy: bool = True, 996 symmetric: t.Optional[bool] = None, 997 **opts, 998 ) -> Between: 999 between = Between( 1000 this=maybe_copy(self, copy), 1001 low=convert(low, copy=copy, **opts), 1002 high=convert(high, copy=copy, **opts), 1003 ) 1004 if symmetric is not None: 1005 between.set("symmetric", symmetric) 1006 1007 return between
Logical conditions like x AND y, or simply x
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Relationships like x = y, x > 1, x >= y.
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1128class DerivedTable(Expression): 1129 @property 1130 def selects(self) -> t.List[Expression]: 1131 return self.this.selects if isinstance(self.this, Query) else [] 1132 1133 @property 1134 def named_selects(self) -> t.List[str]: 1135 return [select.output_name for select in self.selects]
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1138class Query(Expression): 1139 def subquery(self, alias: t.Optional[ExpOrStr] = None, copy: bool = True) -> Subquery: 1140 """ 1141 Returns a `Subquery` that wraps around this query. 1142 1143 Example: 1144 >>> subquery = Select().select("x").from_("tbl").subquery() 1145 >>> Select().select("x").from_(subquery).sql() 1146 'SELECT x FROM (SELECT x FROM tbl)' 1147 1148 Args: 1149 alias: an optional alias for the subquery. 1150 copy: if `False`, modify this expression instance in-place. 1151 """ 1152 instance = maybe_copy(self, copy) 1153 if not isinstance(alias, Expression): 1154 alias = TableAlias(this=to_identifier(alias)) if alias else None 1155 1156 return Subquery(this=instance, alias=alias) 1157 1158 def limit( 1159 self: Q, expression: ExpOrStr | int, dialect: DialectType = None, copy: bool = True, **opts 1160 ) -> Q: 1161 """ 1162 Adds a LIMIT clause to this query. 1163 1164 Example: 1165 >>> select("1").union(select("1")).limit(1).sql() 1166 'SELECT 1 UNION SELECT 1 LIMIT 1' 1167 1168 Args: 1169 expression: the SQL code string to parse. 1170 This can also be an integer. 1171 If a `Limit` instance is passed, it will be used as-is. 1172 If another `Expression` instance is passed, it will be wrapped in a `Limit`. 1173 dialect: the dialect used to parse the input expression. 1174 copy: if `False`, modify this expression instance in-place. 1175 opts: other options to use to parse the input expressions. 1176 1177 Returns: 1178 A limited Select expression. 1179 """ 1180 return _apply_builder( 1181 expression=expression, 1182 instance=self, 1183 arg="limit", 1184 into=Limit, 1185 prefix="LIMIT", 1186 dialect=dialect, 1187 copy=copy, 1188 into_arg="expression", 1189 **opts, 1190 ) 1191 1192 def offset( 1193 self: Q, expression: ExpOrStr | int, dialect: DialectType = None, copy: bool = True, **opts 1194 ) -> Q: 1195 """ 1196 Set the OFFSET expression. 1197 1198 Example: 1199 >>> Select().from_("tbl").select("x").offset(10).sql() 1200 'SELECT x FROM tbl OFFSET 10' 1201 1202 Args: 1203 expression: the SQL code string to parse. 1204 This can also be an integer. 1205 If a `Offset` instance is passed, this is used as-is. 1206 If another `Expression` instance is passed, it will be wrapped in a `Offset`. 1207 dialect: the dialect used to parse the input expression. 1208 copy: if `False`, modify this expression instance in-place. 1209 opts: other options to use to parse the input expressions. 1210 1211 Returns: 1212 The modified Select expression. 1213 """ 1214 return _apply_builder( 1215 expression=expression, 1216 instance=self, 1217 arg="offset", 1218 into=Offset, 1219 prefix="OFFSET", 1220 dialect=dialect, 1221 copy=copy, 1222 into_arg="expression", 1223 **opts, 1224 ) 1225 1226 def order_by( 1227 self: Q, 1228 *expressions: t.Optional[ExpOrStr], 1229 append: bool = True, 1230 dialect: DialectType = None, 1231 copy: bool = True, 1232 **opts, 1233 ) -> Q: 1234 """ 1235 Set the ORDER BY expression. 1236 1237 Example: 1238 >>> Select().from_("tbl").select("x").order_by("x DESC").sql() 1239 'SELECT x FROM tbl ORDER BY x DESC' 1240 1241 Args: 1242 *expressions: the SQL code strings to parse. 1243 If a `Group` instance is passed, this is used as-is. 1244 If another `Expression` instance is passed, it will be wrapped in a `Order`. 1245 append: if `True`, add to any existing expressions. 1246 Otherwise, this flattens all the `Order` expression into a single expression. 1247 dialect: the dialect used to parse the input expression. 1248 copy: if `False`, modify this expression instance in-place. 1249 opts: other options to use to parse the input expressions. 1250 1251 Returns: 1252 The modified Select expression. 1253 """ 1254 return _apply_child_list_builder( 1255 *expressions, 1256 instance=self, 1257 arg="order", 1258 append=append, 1259 copy=copy, 1260 prefix="ORDER BY", 1261 into=Order, 1262 dialect=dialect, 1263 **opts, 1264 ) 1265 1266 @property 1267 def ctes(self) -> t.List[CTE]: 1268 """Returns a list of all the CTEs attached to this query.""" 1269 with_ = self.args.get("with_") 1270 return with_.expressions if with_ else [] 1271 1272 @property 1273 def selects(self) -> t.List[Expression]: 1274 """Returns the query's projections.""" 1275 raise NotImplementedError("Query objects must implement `selects`") 1276 1277 @property 1278 def named_selects(self) -> t.List[str]: 1279 """Returns the output names of the query's projections.""" 1280 raise NotImplementedError("Query objects must implement `named_selects`") 1281 1282 def select( 1283 self: Q, 1284 *expressions: t.Optional[ExpOrStr], 1285 append: bool = True, 1286 dialect: DialectType = None, 1287 copy: bool = True, 1288 **opts, 1289 ) -> Q: 1290 """ 1291 Append to or set the SELECT expressions. 1292 1293 Example: 1294 >>> Select().select("x", "y").sql() 1295 'SELECT x, y' 1296 1297 Args: 1298 *expressions: the SQL code strings to parse. 1299 If an `Expression` instance is passed, it will be used as-is. 1300 append: if `True`, add to any existing expressions. 1301 Otherwise, this resets the expressions. 1302 dialect: the dialect used to parse the input expressions. 1303 copy: if `False`, modify this expression instance in-place. 1304 opts: other options to use to parse the input expressions. 1305 1306 Returns: 1307 The modified Query expression. 1308 """ 1309 raise NotImplementedError("Query objects must implement `select`") 1310 1311 def where( 1312 self: Q, 1313 *expressions: t.Optional[ExpOrStr], 1314 append: bool = True, 1315 dialect: DialectType = None, 1316 copy: bool = True, 1317 **opts, 1318 ) -> Q: 1319 """ 1320 Append to or set the WHERE expressions. 1321 1322 Examples: 1323 >>> Select().select("x").from_("tbl").where("x = 'a' OR x < 'b'").sql() 1324 "SELECT x FROM tbl WHERE x = 'a' OR x < 'b'" 1325 1326 Args: 1327 *expressions: the SQL code strings to parse. 1328 If an `Expression` instance is passed, it will be used as-is. 1329 Multiple expressions are combined with an AND operator. 1330 append: if `True`, AND the new expressions to any existing expression. 1331 Otherwise, this resets the expression. 1332 dialect: the dialect used to parse the input expressions. 1333 copy: if `False`, modify this expression instance in-place. 1334 opts: other options to use to parse the input expressions. 1335 1336 Returns: 1337 The modified expression. 1338 """ 1339 return _apply_conjunction_builder( 1340 *[expr.this if isinstance(expr, Where) else expr for expr in expressions], 1341 instance=self, 1342 arg="where", 1343 append=append, 1344 into=Where, 1345 dialect=dialect, 1346 copy=copy, 1347 **opts, 1348 ) 1349 1350 def with_( 1351 self: Q, 1352 alias: ExpOrStr, 1353 as_: ExpOrStr, 1354 recursive: t.Optional[bool] = None, 1355 materialized: t.Optional[bool] = None, 1356 append: bool = True, 1357 dialect: DialectType = None, 1358 copy: bool = True, 1359 scalar: t.Optional[bool] = None, 1360 **opts, 1361 ) -> Q: 1362 """ 1363 Append to or set the common table expressions. 1364 1365 Example: 1366 >>> Select().with_("tbl2", as_="SELECT * FROM tbl").select("x").from_("tbl2").sql() 1367 'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2' 1368 1369 Args: 1370 alias: the SQL code string to parse as the table name. 1371 If an `Expression` instance is passed, this is used as-is. 1372 as_: the SQL code string to parse as the table expression. 1373 If an `Expression` instance is passed, it will be used as-is. 1374 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 1375 materialized: set the MATERIALIZED part of the expression. 1376 append: if `True`, add to any existing expressions. 1377 Otherwise, this resets the expressions. 1378 dialect: the dialect used to parse the input expression. 1379 copy: if `False`, modify this expression instance in-place. 1380 scalar: if `True`, this is a scalar common table expression. 1381 opts: other options to use to parse the input expressions. 1382 1383 Returns: 1384 The modified expression. 1385 """ 1386 return _apply_cte_builder( 1387 self, 1388 alias, 1389 as_, 1390 recursive=recursive, 1391 materialized=materialized, 1392 append=append, 1393 dialect=dialect, 1394 copy=copy, 1395 scalar=scalar, 1396 **opts, 1397 ) 1398 1399 def union( 1400 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1401 ) -> Union: 1402 """ 1403 Builds a UNION expression. 1404 1405 Example: 1406 >>> import sqlglot 1407 >>> sqlglot.parse_one("SELECT * FROM foo").union("SELECT * FROM bla").sql() 1408 'SELECT * FROM foo UNION SELECT * FROM bla' 1409 1410 Args: 1411 expressions: the SQL code strings. 1412 If `Expression` instances are passed, they will be used as-is. 1413 distinct: set the DISTINCT flag if and only if this is true. 1414 dialect: the dialect used to parse the input expression. 1415 opts: other options to use to parse the input expressions. 1416 1417 Returns: 1418 The new Union expression. 1419 """ 1420 return union(self, *expressions, distinct=distinct, dialect=dialect, **opts) 1421 1422 def intersect( 1423 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1424 ) -> Intersect: 1425 """ 1426 Builds an INTERSECT expression. 1427 1428 Example: 1429 >>> import sqlglot 1430 >>> sqlglot.parse_one("SELECT * FROM foo").intersect("SELECT * FROM bla").sql() 1431 'SELECT * FROM foo INTERSECT SELECT * FROM bla' 1432 1433 Args: 1434 expressions: the SQL code strings. 1435 If `Expression` instances are passed, they will be used as-is. 1436 distinct: set the DISTINCT flag if and only if this is true. 1437 dialect: the dialect used to parse the input expression. 1438 opts: other options to use to parse the input expressions. 1439 1440 Returns: 1441 The new Intersect expression. 1442 """ 1443 return intersect(self, *expressions, distinct=distinct, dialect=dialect, **opts) 1444 1445 def except_( 1446 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1447 ) -> Except: 1448 """ 1449 Builds an EXCEPT expression. 1450 1451 Example: 1452 >>> import sqlglot 1453 >>> sqlglot.parse_one("SELECT * FROM foo").except_("SELECT * FROM bla").sql() 1454 'SELECT * FROM foo EXCEPT SELECT * FROM bla' 1455 1456 Args: 1457 expressions: the SQL code strings. 1458 If `Expression` instance are passed, they will be used as-is. 1459 distinct: set the DISTINCT flag if and only if this is true. 1460 dialect: the dialect used to parse the input expression. 1461 opts: other options to use to parse the input expressions. 1462 1463 Returns: 1464 The new Except expression. 1465 """ 1466 return except_(self, *expressions, distinct=distinct, dialect=dialect, **opts)
1139 def subquery(self, alias: t.Optional[ExpOrStr] = None, copy: bool = True) -> Subquery: 1140 """ 1141 Returns a `Subquery` that wraps around this query. 1142 1143 Example: 1144 >>> subquery = Select().select("x").from_("tbl").subquery() 1145 >>> Select().select("x").from_(subquery).sql() 1146 'SELECT x FROM (SELECT x FROM tbl)' 1147 1148 Args: 1149 alias: an optional alias for the subquery. 1150 copy: if `False`, modify this expression instance in-place. 1151 """ 1152 instance = maybe_copy(self, copy) 1153 if not isinstance(alias, Expression): 1154 alias = TableAlias(this=to_identifier(alias)) if alias else None 1155 1156 return Subquery(this=instance, alias=alias)
Returns a Subquery that wraps around this query.
Example:
Arguments:
- alias: an optional alias for the subquery.
- copy: if
False, modify this expression instance in-place.
1158 def limit( 1159 self: Q, expression: ExpOrStr | int, dialect: DialectType = None, copy: bool = True, **opts 1160 ) -> Q: 1161 """ 1162 Adds a LIMIT clause to this query. 1163 1164 Example: 1165 >>> select("1").union(select("1")).limit(1).sql() 1166 'SELECT 1 UNION SELECT 1 LIMIT 1' 1167 1168 Args: 1169 expression: the SQL code string to parse. 1170 This can also be an integer. 1171 If a `Limit` instance is passed, it will be used as-is. 1172 If another `Expression` instance is passed, it will be wrapped in a `Limit`. 1173 dialect: the dialect used to parse the input expression. 1174 copy: if `False`, modify this expression instance in-place. 1175 opts: other options to use to parse the input expressions. 1176 1177 Returns: 1178 A limited Select expression. 1179 """ 1180 return _apply_builder( 1181 expression=expression, 1182 instance=self, 1183 arg="limit", 1184 into=Limit, 1185 prefix="LIMIT", 1186 dialect=dialect, 1187 copy=copy, 1188 into_arg="expression", 1189 **opts, 1190 )
Adds a LIMIT clause to this query.
Example:
>>> select("1").union(select("1")).limit(1).sql() 'SELECT 1 UNION SELECT 1 LIMIT 1'
Arguments:
- expression: the SQL code string to parse.
This can also be an integer.
If a
Limitinstance is passed, it will be used as-is. If anotherExpressioninstance is passed, it will be wrapped in aLimit. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
A limited Select expression.
1192 def offset( 1193 self: Q, expression: ExpOrStr | int, dialect: DialectType = None, copy: bool = True, **opts 1194 ) -> Q: 1195 """ 1196 Set the OFFSET expression. 1197 1198 Example: 1199 >>> Select().from_("tbl").select("x").offset(10).sql() 1200 'SELECT x FROM tbl OFFSET 10' 1201 1202 Args: 1203 expression: the SQL code string to parse. 1204 This can also be an integer. 1205 If a `Offset` instance is passed, this is used as-is. 1206 If another `Expression` instance is passed, it will be wrapped in a `Offset`. 1207 dialect: the dialect used to parse the input expression. 1208 copy: if `False`, modify this expression instance in-place. 1209 opts: other options to use to parse the input expressions. 1210 1211 Returns: 1212 The modified Select expression. 1213 """ 1214 return _apply_builder( 1215 expression=expression, 1216 instance=self, 1217 arg="offset", 1218 into=Offset, 1219 prefix="OFFSET", 1220 dialect=dialect, 1221 copy=copy, 1222 into_arg="expression", 1223 **opts, 1224 )
Set the OFFSET expression.
Example:
Arguments:
- expression: the SQL code string to parse.
This can also be an integer.
If a
Offsetinstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aOffset. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
1226 def order_by( 1227 self: Q, 1228 *expressions: t.Optional[ExpOrStr], 1229 append: bool = True, 1230 dialect: DialectType = None, 1231 copy: bool = True, 1232 **opts, 1233 ) -> Q: 1234 """ 1235 Set the ORDER BY expression. 1236 1237 Example: 1238 >>> Select().from_("tbl").select("x").order_by("x DESC").sql() 1239 'SELECT x FROM tbl ORDER BY x DESC' 1240 1241 Args: 1242 *expressions: the SQL code strings to parse. 1243 If a `Group` instance is passed, this is used as-is. 1244 If another `Expression` instance is passed, it will be wrapped in a `Order`. 1245 append: if `True`, add to any existing expressions. 1246 Otherwise, this flattens all the `Order` expression into a single expression. 1247 dialect: the dialect used to parse the input expression. 1248 copy: if `False`, modify this expression instance in-place. 1249 opts: other options to use to parse the input expressions. 1250 1251 Returns: 1252 The modified Select expression. 1253 """ 1254 return _apply_child_list_builder( 1255 *expressions, 1256 instance=self, 1257 arg="order", 1258 append=append, 1259 copy=copy, 1260 prefix="ORDER BY", 1261 into=Order, 1262 dialect=dialect, 1263 **opts, 1264 )
Set the ORDER BY expression.
Example:
Arguments:
- *expressions: the SQL code strings to parse.
If a
Groupinstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aOrder. - append: if
True, add to any existing expressions. Otherwise, this flattens all theOrderexpression into a single expression. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
1266 @property 1267 def ctes(self) -> t.List[CTE]: 1268 """Returns a list of all the CTEs attached to this query.""" 1269 with_ = self.args.get("with_") 1270 return with_.expressions if with_ else []
Returns a list of all the CTEs attached to this query.
1272 @property 1273 def selects(self) -> t.List[Expression]: 1274 """Returns the query's projections.""" 1275 raise NotImplementedError("Query objects must implement `selects`")
Returns the query's projections.
1277 @property 1278 def named_selects(self) -> t.List[str]: 1279 """Returns the output names of the query's projections.""" 1280 raise NotImplementedError("Query objects must implement `named_selects`")
Returns the output names of the query's projections.
1282 def select( 1283 self: Q, 1284 *expressions: t.Optional[ExpOrStr], 1285 append: bool = True, 1286 dialect: DialectType = None, 1287 copy: bool = True, 1288 **opts, 1289 ) -> Q: 1290 """ 1291 Append to or set the SELECT expressions. 1292 1293 Example: 1294 >>> Select().select("x", "y").sql() 1295 'SELECT x, y' 1296 1297 Args: 1298 *expressions: the SQL code strings to parse. 1299 If an `Expression` instance is passed, it will be used as-is. 1300 append: if `True`, add to any existing expressions. 1301 Otherwise, this resets the expressions. 1302 dialect: the dialect used to parse the input expressions. 1303 copy: if `False`, modify this expression instance in-place. 1304 opts: other options to use to parse the input expressions. 1305 1306 Returns: 1307 The modified Query expression. 1308 """ 1309 raise NotImplementedError("Query objects must implement `select`")
Append to or set the SELECT expressions.
Example:
>>> Select().select("x", "y").sql() 'SELECT x, y'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Query expression.
1311 def where( 1312 self: Q, 1313 *expressions: t.Optional[ExpOrStr], 1314 append: bool = True, 1315 dialect: DialectType = None, 1316 copy: bool = True, 1317 **opts, 1318 ) -> Q: 1319 """ 1320 Append to or set the WHERE expressions. 1321 1322 Examples: 1323 >>> Select().select("x").from_("tbl").where("x = 'a' OR x < 'b'").sql() 1324 "SELECT x FROM tbl WHERE x = 'a' OR x < 'b'" 1325 1326 Args: 1327 *expressions: the SQL code strings to parse. 1328 If an `Expression` instance is passed, it will be used as-is. 1329 Multiple expressions are combined with an AND operator. 1330 append: if `True`, AND the new expressions to any existing expression. 1331 Otherwise, this resets the expression. 1332 dialect: the dialect used to parse the input expressions. 1333 copy: if `False`, modify this expression instance in-place. 1334 opts: other options to use to parse the input expressions. 1335 1336 Returns: 1337 The modified expression. 1338 """ 1339 return _apply_conjunction_builder( 1340 *[expr.this if isinstance(expr, Where) else expr for expr in expressions], 1341 instance=self, 1342 arg="where", 1343 append=append, 1344 into=Where, 1345 dialect=dialect, 1346 copy=copy, 1347 **opts, 1348 )
Append to or set the WHERE expressions.
Examples:
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. Multiple expressions are combined with an AND operator. - append: if
True, AND the new expressions to any existing expression. Otherwise, this resets the expression. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified expression.
1350 def with_( 1351 self: Q, 1352 alias: ExpOrStr, 1353 as_: ExpOrStr, 1354 recursive: t.Optional[bool] = None, 1355 materialized: t.Optional[bool] = None, 1356 append: bool = True, 1357 dialect: DialectType = None, 1358 copy: bool = True, 1359 scalar: t.Optional[bool] = None, 1360 **opts, 1361 ) -> Q: 1362 """ 1363 Append to or set the common table expressions. 1364 1365 Example: 1366 >>> Select().with_("tbl2", as_="SELECT * FROM tbl").select("x").from_("tbl2").sql() 1367 'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2' 1368 1369 Args: 1370 alias: the SQL code string to parse as the table name. 1371 If an `Expression` instance is passed, this is used as-is. 1372 as_: the SQL code string to parse as the table expression. 1373 If an `Expression` instance is passed, it will be used as-is. 1374 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 1375 materialized: set the MATERIALIZED part of the expression. 1376 append: if `True`, add to any existing expressions. 1377 Otherwise, this resets the expressions. 1378 dialect: the dialect used to parse the input expression. 1379 copy: if `False`, modify this expression instance in-place. 1380 scalar: if `True`, this is a scalar common table expression. 1381 opts: other options to use to parse the input expressions. 1382 1383 Returns: 1384 The modified expression. 1385 """ 1386 return _apply_cte_builder( 1387 self, 1388 alias, 1389 as_, 1390 recursive=recursive, 1391 materialized=materialized, 1392 append=append, 1393 dialect=dialect, 1394 copy=copy, 1395 scalar=scalar, 1396 **opts, 1397 )
Append to or set the common table expressions.
Example:
Arguments:
- alias: the SQL code string to parse as the table name.
If an
Expressioninstance is passed, this is used as-is. - as_: the SQL code string to parse as the table expression.
If an
Expressioninstance is passed, it will be used as-is. - recursive: set the RECURSIVE part of the expression. Defaults to
False. - materialized: set the MATERIALIZED part of the expression.
- append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - scalar: if
True, this is a scalar common table expression. - opts: other options to use to parse the input expressions.
Returns:
The modified expression.
1399 def union( 1400 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1401 ) -> Union: 1402 """ 1403 Builds a UNION expression. 1404 1405 Example: 1406 >>> import sqlglot 1407 >>> sqlglot.parse_one("SELECT * FROM foo").union("SELECT * FROM bla").sql() 1408 'SELECT * FROM foo UNION SELECT * FROM bla' 1409 1410 Args: 1411 expressions: the SQL code strings. 1412 If `Expression` instances are passed, they will be used as-is. 1413 distinct: set the DISTINCT flag if and only if this is true. 1414 dialect: the dialect used to parse the input expression. 1415 opts: other options to use to parse the input expressions. 1416 1417 Returns: 1418 The new Union expression. 1419 """ 1420 return union(self, *expressions, distinct=distinct, dialect=dialect, **opts)
Builds a UNION expression.
Example:
>>> import sqlglot >>> sqlglot.parse_one("SELECT * FROM foo").union("SELECT * FROM bla").sql() 'SELECT * FROM foo UNION SELECT * FROM bla'
Arguments:
- expressions: the SQL code strings.
If
Expressioninstances are passed, they will be used as-is. - distinct: set the DISTINCT flag if and only if this is true.
- dialect: the dialect used to parse the input expression.
- opts: other options to use to parse the input expressions.
Returns:
The new Union expression.
1422 def intersect( 1423 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1424 ) -> Intersect: 1425 """ 1426 Builds an INTERSECT expression. 1427 1428 Example: 1429 >>> import sqlglot 1430 >>> sqlglot.parse_one("SELECT * FROM foo").intersect("SELECT * FROM bla").sql() 1431 'SELECT * FROM foo INTERSECT SELECT * FROM bla' 1432 1433 Args: 1434 expressions: the SQL code strings. 1435 If `Expression` instances are passed, they will be used as-is. 1436 distinct: set the DISTINCT flag if and only if this is true. 1437 dialect: the dialect used to parse the input expression. 1438 opts: other options to use to parse the input expressions. 1439 1440 Returns: 1441 The new Intersect expression. 1442 """ 1443 return intersect(self, *expressions, distinct=distinct, dialect=dialect, **opts)
Builds an INTERSECT expression.
Example:
>>> import sqlglot >>> sqlglot.parse_one("SELECT * FROM foo").intersect("SELECT * FROM bla").sql() 'SELECT * FROM foo INTERSECT SELECT * FROM bla'
Arguments:
- expressions: the SQL code strings.
If
Expressioninstances are passed, they will be used as-is. - distinct: set the DISTINCT flag if and only if this is true.
- dialect: the dialect used to parse the input expression.
- opts: other options to use to parse the input expressions.
Returns:
The new Intersect expression.
1445 def except_( 1446 self, *expressions: ExpOrStr, distinct: bool = True, dialect: DialectType = None, **opts 1447 ) -> Except: 1448 """ 1449 Builds an EXCEPT expression. 1450 1451 Example: 1452 >>> import sqlglot 1453 >>> sqlglot.parse_one("SELECT * FROM foo").except_("SELECT * FROM bla").sql() 1454 'SELECT * FROM foo EXCEPT SELECT * FROM bla' 1455 1456 Args: 1457 expressions: the SQL code strings. 1458 If `Expression` instance are passed, they will be used as-is. 1459 distinct: set the DISTINCT flag if and only if this is true. 1460 dialect: the dialect used to parse the input expression. 1461 opts: other options to use to parse the input expressions. 1462 1463 Returns: 1464 The new Except expression. 1465 """ 1466 return except_(self, *expressions, distinct=distinct, dialect=dialect, **opts)
Builds an EXCEPT expression.
Example:
>>> import sqlglot >>> sqlglot.parse_one("SELECT * FROM foo").except_("SELECT * FROM bla").sql() 'SELECT * FROM foo EXCEPT SELECT * FROM bla'
Arguments:
- expressions: the SQL code strings.
If
Expressioninstance are passed, they will be used as-is. - distinct: set the DISTINCT flag if and only if this is true.
- dialect: the dialect used to parse the input expression.
- opts: other options to use to parse the input expressions.
Returns:
The new Except expression.
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1469class UDTF(DerivedTable): 1470 @property 1471 def selects(self) -> t.List[Expression]: 1472 alias = self.args.get("alias") 1473 return alias.columns if alias else []
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1476class Cache(Expression): 1477 arg_types = { 1478 "this": True, 1479 "lazy": False, 1480 "options": False, 1481 "expression": False, 1482 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1493class DDL(Expression): 1494 @property 1495 def ctes(self) -> t.List[CTE]: 1496 """Returns a list of all the CTEs attached to this statement.""" 1497 with_ = self.args.get("with_") 1498 return with_.expressions if with_ else [] 1499 1500 @property 1501 def selects(self) -> t.List[Expression]: 1502 """If this statement contains a query (e.g. a CTAS), this returns the query's projections.""" 1503 return self.expression.selects if isinstance(self.expression, Query) else [] 1504 1505 @property 1506 def named_selects(self) -> t.List[str]: 1507 """ 1508 If this statement contains a query (e.g. a CTAS), this returns the output 1509 names of the query's projections. 1510 """ 1511 return self.expression.named_selects if isinstance(self.expression, Query) else []
1494 @property 1495 def ctes(self) -> t.List[CTE]: 1496 """Returns a list of all the CTEs attached to this statement.""" 1497 with_ = self.args.get("with_") 1498 return with_.expressions if with_ else []
Returns a list of all the CTEs attached to this statement.
1500 @property 1501 def selects(self) -> t.List[Expression]: 1502 """If this statement contains a query (e.g. a CTAS), this returns the query's projections.""" 1503 return self.expression.selects if isinstance(self.expression, Query) else []
If this statement contains a query (e.g. a CTAS), this returns the query's projections.
1505 @property 1506 def named_selects(self) -> t.List[str]: 1507 """ 1508 If this statement contains a query (e.g. a CTAS), this returns the output 1509 names of the query's projections. 1510 """ 1511 return self.expression.named_selects if isinstance(self.expression, Query) else []
If this statement contains a query (e.g. a CTAS), this returns the output names of the query's projections.
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1519class DML(Expression): 1520 def returning( 1521 self, 1522 expression: ExpOrStr, 1523 dialect: DialectType = None, 1524 copy: bool = True, 1525 **opts, 1526 ) -> "Self": 1527 """ 1528 Set the RETURNING expression. Not supported by all dialects. 1529 1530 Example: 1531 >>> delete("tbl").returning("*", dialect="postgres").sql() 1532 'DELETE FROM tbl RETURNING *' 1533 1534 Args: 1535 expression: the SQL code strings to parse. 1536 If an `Expression` instance is passed, it will be used as-is. 1537 dialect: the dialect used to parse the input expressions. 1538 copy: if `False`, modify this expression instance in-place. 1539 opts: other options to use to parse the input expressions. 1540 1541 Returns: 1542 Delete: the modified expression. 1543 """ 1544 return _apply_builder( 1545 expression=expression, 1546 instance=self, 1547 arg="returning", 1548 prefix="RETURNING", 1549 dialect=dialect, 1550 copy=copy, 1551 into=Returning, 1552 **opts, 1553 )
1520 def returning( 1521 self, 1522 expression: ExpOrStr, 1523 dialect: DialectType = None, 1524 copy: bool = True, 1525 **opts, 1526 ) -> "Self": 1527 """ 1528 Set the RETURNING expression. Not supported by all dialects. 1529 1530 Example: 1531 >>> delete("tbl").returning("*", dialect="postgres").sql() 1532 'DELETE FROM tbl RETURNING *' 1533 1534 Args: 1535 expression: the SQL code strings to parse. 1536 If an `Expression` instance is passed, it will be used as-is. 1537 dialect: the dialect used to parse the input expressions. 1538 copy: if `False`, modify this expression instance in-place. 1539 opts: other options to use to parse the input expressions. 1540 1541 Returns: 1542 Delete: the modified expression. 1543 """ 1544 return _apply_builder( 1545 expression=expression, 1546 instance=self, 1547 arg="returning", 1548 prefix="RETURNING", 1549 dialect=dialect, 1550 copy=copy, 1551 into=Returning, 1552 **opts, 1553 )
Set the RETURNING expression. Not supported by all dialects.
Example:
>>> delete("tbl").returning("*", dialect="postgres").sql() 'DELETE FROM tbl RETURNING *'
Arguments:
- expression: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
Delete: the modified expression.
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1556class Create(DDL): 1557 arg_types = { 1558 "with_": False, 1559 "this": True, 1560 "kind": True, 1561 "expression": False, 1562 "exists": False, 1563 "properties": False, 1564 "replace": False, 1565 "refresh": False, 1566 "unique": False, 1567 "indexes": False, 1568 "no_schema_binding": False, 1569 "begin": False, 1570 "end": False, 1571 "clone": False, 1572 "concurrently": False, 1573 "clustered": False, 1574 } 1575 1576 @property 1577 def kind(self) -> t.Optional[str]: 1578 kind = self.args.get("kind") 1579 return kind and kind.upper()
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1582class SequenceProperties(Expression): 1583 arg_types = { 1584 "increment": False, 1585 "minvalue": False, 1586 "maxvalue": False, 1587 "cache": False, 1588 "start": False, 1589 "owned": False, 1590 "options": False, 1591 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1594class TruncateTable(Expression): 1595 arg_types = { 1596 "expressions": True, 1597 "is_database": False, 1598 "exists": False, 1599 "only": False, 1600 "cluster": False, 1601 "identity": False, 1602 "option": False, 1603 "partition": False, 1604 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1614class Describe(Expression): 1615 arg_types = { 1616 "this": True, 1617 "style": False, 1618 "kind": False, 1619 "expressions": False, 1620 "partition": False, 1621 "format": False, 1622 "as_json": False, 1623 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1627class Attach(Expression): 1628 arg_types = {"this": True, "exists": False, "expressions": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1670class SetItem(Expression): 1671 arg_types = { 1672 "this": False, 1673 "expressions": False, 1674 "kind": False, 1675 "collate": False, # MySQL SET NAMES statement 1676 "global_": False, 1677 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1684class Show(Expression): 1685 arg_types = { 1686 "this": True, 1687 "history": False, 1688 "terse": False, 1689 "target": False, 1690 "offset": False, 1691 "starts_with": False, 1692 "limit": False, 1693 "from_": False, 1694 "like": False, 1695 "where": False, 1696 "db": False, 1697 "scope": False, 1698 "scope_kind": False, 1699 "full": False, 1700 "mutex": False, 1701 "query": False, 1702 "channel": False, 1703 "global_": False, 1704 "log": False, 1705 "position": False, 1706 "types": False, 1707 "privileges": False, 1708 "for_table": False, 1709 "for_group": False, 1710 "for_user": False, 1711 "for_role": False, 1712 "into_outfile": False, 1713 "json": False, 1714 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1717class UserDefinedFunction(Expression): 1718 arg_types = {"this": True, "expressions": False, "wrapped": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1725class RecursiveWithSearch(Expression): 1726 arg_types = {"kind": True, "this": True, "expression": True, "using": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1729class With(Expression): 1730 arg_types = {"expressions": True, "recursive": False, "search": False} 1731 1732 @property 1733 def recursive(self) -> bool: 1734 return bool(self.args.get("recursive"))
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1743class CTE(DerivedTable): 1744 arg_types = { 1745 "this": True, 1746 "alias": True, 1747 "scalar": False, 1748 "materialized": False, 1749 "key_expressions": False, 1750 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1757class TableAlias(Expression): 1758 arg_types = {"this": False, "columns": False} 1759 1760 @property 1761 def columns(self): 1762 return self.args.get("columns") or []
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1785class Column(Condition): 1786 arg_types = {"this": True, "table": False, "db": False, "catalog": False, "join_mark": False} 1787 1788 @property 1789 def table(self) -> str: 1790 return self.text("table") 1791 1792 @property 1793 def db(self) -> str: 1794 return self.text("db") 1795 1796 @property 1797 def catalog(self) -> str: 1798 return self.text("catalog") 1799 1800 @property 1801 def output_name(self) -> str: 1802 return self.name 1803 1804 @property 1805 def parts(self) -> t.List[Identifier]: 1806 """Return the parts of a column in order catalog, db, table, name.""" 1807 return [ 1808 t.cast(Identifier, self.args[part]) 1809 for part in ("catalog", "db", "table", "this") 1810 if self.args.get(part) 1811 ] 1812 1813 def to_dot(self, include_dots: bool = True) -> Dot | Identifier: 1814 """Converts the column into a dot expression.""" 1815 parts = self.parts 1816 parent = self.parent 1817 1818 if include_dots: 1819 while isinstance(parent, Dot): 1820 parts.append(parent.expression) 1821 parent = parent.parent 1822 1823 return Dot.build(deepcopy(parts)) if len(parts) > 1 else parts[0]
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
1804 @property 1805 def parts(self) -> t.List[Identifier]: 1806 """Return the parts of a column in order catalog, db, table, name.""" 1807 return [ 1808 t.cast(Identifier, self.args[part]) 1809 for part in ("catalog", "db", "table", "this") 1810 if self.args.get(part) 1811 ]
Return the parts of a column in order catalog, db, table, name.
1813 def to_dot(self, include_dots: bool = True) -> Dot | Identifier: 1814 """Converts the column into a dot expression.""" 1815 parts = self.parts 1816 parent = self.parent 1817 1818 if include_dots: 1819 while isinstance(parent, Dot): 1820 parts.append(parent.expression) 1821 parent = parent.parent 1822 1823 return Dot.build(deepcopy(parts)) if len(parts) > 1 else parts[0]
Converts the column into a dot expression.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1834class ColumnDef(Expression): 1835 arg_types = { 1836 "this": True, 1837 "kind": False, 1838 "constraints": False, 1839 "exists": False, 1840 "position": False, 1841 "default": False, 1842 "output": False, 1843 } 1844 1845 @property 1846 def constraints(self) -> t.List[ColumnConstraint]: 1847 return self.args.get("constraints") or [] 1848 1849 @property 1850 def kind(self) -> t.Optional[DataType]: 1851 return self.args.get("kind")
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1854class AlterColumn(Expression): 1855 arg_types = { 1856 "this": True, 1857 "dtype": False, 1858 "collate": False, 1859 "using": False, 1860 "default": False, 1861 "drop": False, 1862 "comment": False, 1863 "allow_null": False, 1864 "visible": False, 1865 "rename_to": False, 1866 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1879class AlterSortKey(Expression): 1880 arg_types = {"this": False, "expressions": False, "compound": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1883class AlterSet(Expression): 1884 arg_types = { 1885 "expressions": False, 1886 "option": False, 1887 "tablespace": False, 1888 "access_method": False, 1889 "file_format": False, 1890 "copy_options": False, 1891 "tag": False, 1892 "location": False, 1893 "serde": False, 1894 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1909class Comment(Expression): 1910 arg_types = { 1911 "this": True, 1912 "kind": True, 1913 "expression": True, 1914 "exists": False, 1915 "materialized": False, 1916 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1919class Comprehension(Expression): 1920 arg_types = { 1921 "this": True, 1922 "expression": True, 1923 "position": False, 1924 "iterator": True, 1925 "condition": False, 1926 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1930class MergeTreeTTLAction(Expression): 1931 arg_types = { 1932 "this": True, 1933 "delete": False, 1934 "recompress": False, 1935 "to_disk": False, 1936 "to_volume": False, 1937 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1941class MergeTreeTTL(Expression): 1942 arg_types = { 1943 "expressions": True, 1944 "where": False, 1945 "group": False, 1946 "aggregates": False, 1947 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1951class IndexConstraintOption(Expression): 1952 arg_types = { 1953 "key_block_size": False, 1954 "using": False, 1955 "parser": False, 1956 "comment": False, 1957 "visible": False, 1958 "engine_attr": False, 1959 "secondary_engine_attr": False, 1960 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1963class ColumnConstraint(Expression): 1964 arg_types = {"this": False, "kind": True} 1965 1966 @property 1967 def kind(self) -> ColumnConstraintKind: 1968 return self.args["kind"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1983class PeriodForSystemTimeConstraint(ColumnConstraintKind): 1984 arg_types = {"this": True, "expression": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
1995class CheckColumnConstraint(ColumnConstraintKind): 1996 arg_types = {"this": True, "enforced": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2040class GeneratedAsIdentityColumnConstraint(ColumnConstraintKind): 2041 # this: True -> ALWAYS, this: False -> BY DEFAULT 2042 arg_types = { 2043 "this": False, 2044 "expression": False, 2045 "on_null": False, 2046 "start": False, 2047 "increment": False, 2048 "minvalue": False, 2049 "maxvalue": False, 2050 "cycle": False, 2051 "order": False, 2052 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2055class GeneratedAsRowColumnConstraint(ColumnConstraintKind): 2056 arg_types = {"start": False, "hidden": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2061class IndexColumnConstraint(ColumnConstraintKind): 2062 arg_types = { 2063 "this": False, 2064 "expressions": False, 2065 "kind": False, 2066 "index_type": False, 2067 "options": False, 2068 "expression": False, # Clickhouse 2069 "granularity": False, 2070 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2086class MaskingPolicyColumnConstraint(ColumnConstraintKind): 2087 arg_types = {"this": True, "expressions": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2099class PrimaryKeyColumnConstraint(ColumnConstraintKind): 2100 arg_types = {"desc": False, "options": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2107class UniqueColumnConstraint(ColumnConstraintKind): 2108 arg_types = { 2109 "this": False, 2110 "index_type": False, 2111 "on_conflict": False, 2112 "nulls": False, 2113 "options": False, 2114 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2122class WatermarkColumnConstraint(Expression): 2123 arg_types = {"this": True, "expression": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2137class ComputedColumnConstraint(ColumnConstraintKind): 2138 arg_types = {"this": True, "persisted": False, "not_null": False, "data_type": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2142class InOutColumnConstraint(ColumnConstraintKind): 2143 arg_types = {"input_": False, "output": False, "variadic": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2150class Delete(DML): 2151 arg_types = { 2152 "with_": False, 2153 "this": False, 2154 "using": False, 2155 "where": False, 2156 "returning": False, 2157 "order": False, 2158 "limit": False, 2159 "tables": False, # Multiple-Table Syntax (MySQL) 2160 "cluster": False, # Clickhouse 2161 } 2162 2163 def delete( 2164 self, 2165 table: ExpOrStr, 2166 dialect: DialectType = None, 2167 copy: bool = True, 2168 **opts, 2169 ) -> Delete: 2170 """ 2171 Create a DELETE expression or replace the table on an existing DELETE expression. 2172 2173 Example: 2174 >>> delete("tbl").sql() 2175 'DELETE FROM tbl' 2176 2177 Args: 2178 table: the table from which to delete. 2179 dialect: the dialect used to parse the input expression. 2180 copy: if `False`, modify this expression instance in-place. 2181 opts: other options to use to parse the input expressions. 2182 2183 Returns: 2184 Delete: the modified expression. 2185 """ 2186 return _apply_builder( 2187 expression=table, 2188 instance=self, 2189 arg="this", 2190 dialect=dialect, 2191 into=Table, 2192 copy=copy, 2193 **opts, 2194 ) 2195 2196 def where( 2197 self, 2198 *expressions: t.Optional[ExpOrStr], 2199 append: bool = True, 2200 dialect: DialectType = None, 2201 copy: bool = True, 2202 **opts, 2203 ) -> Delete: 2204 """ 2205 Append to or set the WHERE expressions. 2206 2207 Example: 2208 >>> delete("tbl").where("x = 'a' OR x < 'b'").sql() 2209 "DELETE FROM tbl WHERE x = 'a' OR x < 'b'" 2210 2211 Args: 2212 *expressions: the SQL code strings to parse. 2213 If an `Expression` instance is passed, it will be used as-is. 2214 Multiple expressions are combined with an AND operator. 2215 append: if `True`, AND the new expressions to any existing expression. 2216 Otherwise, this resets the expression. 2217 dialect: the dialect used to parse the input expressions. 2218 copy: if `False`, modify this expression instance in-place. 2219 opts: other options to use to parse the input expressions. 2220 2221 Returns: 2222 Delete: the modified expression. 2223 """ 2224 return _apply_conjunction_builder( 2225 *expressions, 2226 instance=self, 2227 arg="where", 2228 append=append, 2229 into=Where, 2230 dialect=dialect, 2231 copy=copy, 2232 **opts, 2233 )
2163 def delete( 2164 self, 2165 table: ExpOrStr, 2166 dialect: DialectType = None, 2167 copy: bool = True, 2168 **opts, 2169 ) -> Delete: 2170 """ 2171 Create a DELETE expression or replace the table on an existing DELETE expression. 2172 2173 Example: 2174 >>> delete("tbl").sql() 2175 'DELETE FROM tbl' 2176 2177 Args: 2178 table: the table from which to delete. 2179 dialect: the dialect used to parse the input expression. 2180 copy: if `False`, modify this expression instance in-place. 2181 opts: other options to use to parse the input expressions. 2182 2183 Returns: 2184 Delete: the modified expression. 2185 """ 2186 return _apply_builder( 2187 expression=table, 2188 instance=self, 2189 arg="this", 2190 dialect=dialect, 2191 into=Table, 2192 copy=copy, 2193 **opts, 2194 )
Create a DELETE expression or replace the table on an existing DELETE expression.
Example:
>>> delete("tbl").sql() 'DELETE FROM tbl'
Arguments:
- table: the table from which to delete.
- dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
Delete: the modified expression.
2196 def where( 2197 self, 2198 *expressions: t.Optional[ExpOrStr], 2199 append: bool = True, 2200 dialect: DialectType = None, 2201 copy: bool = True, 2202 **opts, 2203 ) -> Delete: 2204 """ 2205 Append to or set the WHERE expressions. 2206 2207 Example: 2208 >>> delete("tbl").where("x = 'a' OR x < 'b'").sql() 2209 "DELETE FROM tbl WHERE x = 'a' OR x < 'b'" 2210 2211 Args: 2212 *expressions: the SQL code strings to parse. 2213 If an `Expression` instance is passed, it will be used as-is. 2214 Multiple expressions are combined with an AND operator. 2215 append: if `True`, AND the new expressions to any existing expression. 2216 Otherwise, this resets the expression. 2217 dialect: the dialect used to parse the input expressions. 2218 copy: if `False`, modify this expression instance in-place. 2219 opts: other options to use to parse the input expressions. 2220 2221 Returns: 2222 Delete: the modified expression. 2223 """ 2224 return _apply_conjunction_builder( 2225 *expressions, 2226 instance=self, 2227 arg="where", 2228 append=append, 2229 into=Where, 2230 dialect=dialect, 2231 copy=copy, 2232 **opts, 2233 )
Append to or set the WHERE expressions.
Example:
>>> delete("tbl").where("x = 'a' OR x < 'b'").sql() "DELETE FROM tbl WHERE x = 'a' OR x < 'b'"
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. Multiple expressions are combined with an AND operator. - append: if
True, AND the new expressions to any existing expression. Otherwise, this resets the expression. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
Delete: the modified expression.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2236class Drop(Expression): 2237 arg_types = { 2238 "this": False, 2239 "kind": False, 2240 "expressions": False, 2241 "exists": False, 2242 "temporary": False, 2243 "materialized": False, 2244 "cascade": False, 2245 "constraints": False, 2246 "purge": False, 2247 "cluster": False, 2248 "concurrently": False, 2249 } 2250 2251 @property 2252 def kind(self) -> t.Optional[str]: 2253 kind = self.args.get("kind") 2254 return kind and kind.upper()
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2270class Changes(Expression): 2271 arg_types = {"information": True, "at_before": False, "end": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2279class CopyParameter(Expression): 2280 arg_types = {"this": True, "expression": False, "expressions": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2283class Copy(DML): 2284 arg_types = { 2285 "this": True, 2286 "kind": True, 2287 "files": False, 2288 "credentials": False, 2289 "format": False, 2290 "params": False, 2291 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2294class Credentials(Expression): 2295 arg_types = { 2296 "credentials": False, 2297 "encryption": False, 2298 "storage": False, 2299 "iam_role": False, 2300 "region": False, 2301 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2308class Directory(Expression): 2309 arg_types = {"this": True, "local": False, "row_format": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2317class ForeignKey(Expression): 2318 arg_types = { 2319 "expressions": False, 2320 "reference": False, 2321 "delete": False, 2322 "update": False, 2323 "options": False, 2324 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2331class PrimaryKey(Expression): 2332 arg_types = {"this": False, "expressions": True, "options": False, "include": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2337class Into(Expression): 2338 arg_types = { 2339 "this": False, 2340 "temporary": False, 2341 "unlogged": False, 2342 "bulk_collect": False, 2343 "expressions": False, 2344 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2347class From(Expression): 2348 @property 2349 def name(self) -> str: 2350 return self.this.name 2351 2352 @property 2353 def alias_or_name(self) -> str: 2354 return self.this.alias_or_name
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2369class Identifier(Expression): 2370 arg_types = {"this": True, "quoted": False, "global_": False, "temporary": False} 2371 2372 @property 2373 def quoted(self) -> bool: 2374 return bool(self.args.get("quoted")) 2375 2376 @property 2377 def output_name(self) -> str: 2378 return self.name
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2386class Index(Expression): 2387 arg_types = { 2388 "this": False, 2389 "table": False, 2390 "unique": False, 2391 "primary": False, 2392 "amp": False, # teradata 2393 "params": False, 2394 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2397class IndexParameters(Expression): 2398 arg_types = { 2399 "using": False, 2400 "include": False, 2401 "columns": False, 2402 "with_storage": False, 2403 "partition_by": False, 2404 "tablespace": False, 2405 "where": False, 2406 "on": False, 2407 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2410class Insert(DDL, DML): 2411 arg_types = { 2412 "hint": False, 2413 "with_": False, 2414 "is_function": False, 2415 "this": False, 2416 "expression": False, 2417 "conflict": False, 2418 "returning": False, 2419 "overwrite": False, 2420 "exists": False, 2421 "alternative": False, 2422 "where": False, 2423 "ignore": False, 2424 "by_name": False, 2425 "stored": False, 2426 "partition": False, 2427 "settings": False, 2428 "source": False, 2429 "default": False, 2430 } 2431 2432 def with_( 2433 self, 2434 alias: ExpOrStr, 2435 as_: ExpOrStr, 2436 recursive: t.Optional[bool] = None, 2437 materialized: t.Optional[bool] = None, 2438 append: bool = True, 2439 dialect: DialectType = None, 2440 copy: bool = True, 2441 **opts, 2442 ) -> Insert: 2443 """ 2444 Append to or set the common table expressions. 2445 2446 Example: 2447 >>> insert("SELECT x FROM cte", "t").with_("cte", as_="SELECT * FROM tbl").sql() 2448 'WITH cte AS (SELECT * FROM tbl) INSERT INTO t SELECT x FROM cte' 2449 2450 Args: 2451 alias: the SQL code string to parse as the table name. 2452 If an `Expression` instance is passed, this is used as-is. 2453 as_: the SQL code string to parse as the table expression. 2454 If an `Expression` instance is passed, it will be used as-is. 2455 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 2456 materialized: set the MATERIALIZED part of the expression. 2457 append: if `True`, add to any existing expressions. 2458 Otherwise, this resets the expressions. 2459 dialect: the dialect used to parse the input expression. 2460 copy: if `False`, modify this expression instance in-place. 2461 opts: other options to use to parse the input expressions. 2462 2463 Returns: 2464 The modified expression. 2465 """ 2466 return _apply_cte_builder( 2467 self, 2468 alias, 2469 as_, 2470 recursive=recursive, 2471 materialized=materialized, 2472 append=append, 2473 dialect=dialect, 2474 copy=copy, 2475 **opts, 2476 )
2432 def with_( 2433 self, 2434 alias: ExpOrStr, 2435 as_: ExpOrStr, 2436 recursive: t.Optional[bool] = None, 2437 materialized: t.Optional[bool] = None, 2438 append: bool = True, 2439 dialect: DialectType = None, 2440 copy: bool = True, 2441 **opts, 2442 ) -> Insert: 2443 """ 2444 Append to or set the common table expressions. 2445 2446 Example: 2447 >>> insert("SELECT x FROM cte", "t").with_("cte", as_="SELECT * FROM tbl").sql() 2448 'WITH cte AS (SELECT * FROM tbl) INSERT INTO t SELECT x FROM cte' 2449 2450 Args: 2451 alias: the SQL code string to parse as the table name. 2452 If an `Expression` instance is passed, this is used as-is. 2453 as_: the SQL code string to parse as the table expression. 2454 If an `Expression` instance is passed, it will be used as-is. 2455 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 2456 materialized: set the MATERIALIZED part of the expression. 2457 append: if `True`, add to any existing expressions. 2458 Otherwise, this resets the expressions. 2459 dialect: the dialect used to parse the input expression. 2460 copy: if `False`, modify this expression instance in-place. 2461 opts: other options to use to parse the input expressions. 2462 2463 Returns: 2464 The modified expression. 2465 """ 2466 return _apply_cte_builder( 2467 self, 2468 alias, 2469 as_, 2470 recursive=recursive, 2471 materialized=materialized, 2472 append=append, 2473 dialect=dialect, 2474 copy=copy, 2475 **opts, 2476 )
Append to or set the common table expressions.
Example:
>>> insert("SELECT x FROM cte", "t").with_("cte", as_="SELECT * FROM tbl").sql() 'WITH cte AS (SELECT * FROM tbl) INSERT INTO t SELECT x FROM cte'
Arguments:
- alias: the SQL code string to parse as the table name.
If an
Expressioninstance is passed, this is used as-is. - as_: the SQL code string to parse as the table expression.
If an
Expressioninstance is passed, it will be used as-is. - recursive: set the RECURSIVE part of the expression. Defaults to
False. - materialized: set the MATERIALIZED part of the expression.
- append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified expression.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2479class ConditionalInsert(Expression): 2480 arg_types = {"this": True, "expression": False, "else_": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2483class MultitableInserts(Expression): 2484 arg_types = {"expressions": True, "kind": True, "source": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2487class OnConflict(Expression): 2488 arg_types = { 2489 "duplicate": False, 2490 "expressions": False, 2491 "action": False, 2492 "conflict_keys": False, 2493 "index_predicate": False, 2494 "constraint": False, 2495 "where": False, 2496 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2517class LoadData(Expression): 2518 arg_types = { 2519 "this": True, 2520 "local": False, 2521 "overwrite": False, 2522 "inpath": True, 2523 "partition": False, 2524 "input_format": False, 2525 "serde": False, 2526 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2533class PartitionRange(Expression): 2534 arg_types = {"this": True, "expression": False, "expressions": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2542class Fetch(Expression): 2543 arg_types = { 2544 "direction": False, 2545 "count": False, 2546 "limit_options": False, 2547 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2550class Grant(Expression): 2551 arg_types = { 2552 "privileges": True, 2553 "kind": False, 2554 "securable": True, 2555 "principals": True, 2556 "grant_option": False, 2557 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2564class Group(Expression): 2565 arg_types = { 2566 "expressions": False, 2567 "grouping_sets": False, 2568 "cube": False, 2569 "rollup": False, 2570 "totals": False, 2571 "all": False, 2572 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2591class Limit(Expression): 2592 arg_types = { 2593 "this": False, 2594 "expression": True, 2595 "offset": False, 2596 "limit_options": False, 2597 "expressions": False, 2598 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2601class LimitOptions(Expression): 2602 arg_types = { 2603 "percent": False, 2604 "rows": False, 2605 "with_ties": False, 2606 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2609class Literal(Condition): 2610 arg_types = {"this": True, "is_string": True} 2611 2612 @classmethod 2613 def number(cls, number) -> Literal | Neg: 2614 expr: Literal | Neg = cls(this=str(number), is_string=False) 2615 2616 try: 2617 to_py = expr.to_py() 2618 2619 if not isinstance(to_py, str) and to_py < 0: 2620 expr.set("this", str(abs(to_py))) 2621 expr = Neg(this=expr) 2622 except Exception: 2623 pass 2624 2625 return expr 2626 2627 @classmethod 2628 def string(cls, string) -> Literal: 2629 return cls(this=str(string), is_string=True) 2630 2631 @property 2632 def output_name(self) -> str: 2633 return self.name 2634 2635 def to_py(self) -> int | str | Decimal: 2636 if self.is_number: 2637 try: 2638 return int(self.this) 2639 except ValueError: 2640 return Decimal(self.this) 2641 return self.this
2612 @classmethod 2613 def number(cls, number) -> Literal | Neg: 2614 expr: Literal | Neg = cls(this=str(number), is_string=False) 2615 2616 try: 2617 to_py = expr.to_py() 2618 2619 if not isinstance(to_py, str) and to_py < 0: 2620 expr.set("this", str(abs(to_py))) 2621 expr = Neg(this=expr) 2622 except Exception: 2623 pass 2624 2625 return expr
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
2635 def to_py(self) -> int | str | Decimal: 2636 if self.is_number: 2637 try: 2638 return int(self.this) 2639 except ValueError: 2640 return Decimal(self.this) 2641 return self.this
Returns a Python object equivalent of the SQL node.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2644class Join(Expression): 2645 arg_types = { 2646 "this": True, 2647 "on": False, 2648 "side": False, 2649 "kind": False, 2650 "using": False, 2651 "method": False, 2652 "global_": False, 2653 "hint": False, 2654 "match_condition": False, # Snowflake 2655 "directed": False, # Snowflake 2656 "expressions": False, 2657 "pivots": False, 2658 } 2659 2660 @property 2661 def method(self) -> str: 2662 return self.text("method").upper() 2663 2664 @property 2665 def kind(self) -> str: 2666 return self.text("kind").upper() 2667 2668 @property 2669 def side(self) -> str: 2670 return self.text("side").upper() 2671 2672 @property 2673 def hint(self) -> str: 2674 return self.text("hint").upper() 2675 2676 @property 2677 def alias_or_name(self) -> str: 2678 return self.this.alias_or_name 2679 2680 @property 2681 def is_semi_or_anti_join(self) -> bool: 2682 return self.kind in ("SEMI", "ANTI") 2683 2684 def on( 2685 self, 2686 *expressions: t.Optional[ExpOrStr], 2687 append: bool = True, 2688 dialect: DialectType = None, 2689 copy: bool = True, 2690 **opts, 2691 ) -> Join: 2692 """ 2693 Append to or set the ON expressions. 2694 2695 Example: 2696 >>> import sqlglot 2697 >>> sqlglot.parse_one("JOIN x", into=Join).on("y = 1").sql() 2698 'JOIN x ON y = 1' 2699 2700 Args: 2701 *expressions: the SQL code strings to parse. 2702 If an `Expression` instance is passed, it will be used as-is. 2703 Multiple expressions are combined with an AND operator. 2704 append: if `True`, AND the new expressions to any existing expression. 2705 Otherwise, this resets the expression. 2706 dialect: the dialect used to parse the input expressions. 2707 copy: if `False`, modify this expression instance in-place. 2708 opts: other options to use to parse the input expressions. 2709 2710 Returns: 2711 The modified Join expression. 2712 """ 2713 join = _apply_conjunction_builder( 2714 *expressions, 2715 instance=self, 2716 arg="on", 2717 append=append, 2718 dialect=dialect, 2719 copy=copy, 2720 **opts, 2721 ) 2722 2723 if join.kind == "CROSS": 2724 join.set("kind", None) 2725 2726 return join 2727 2728 def using( 2729 self, 2730 *expressions: t.Optional[ExpOrStr], 2731 append: bool = True, 2732 dialect: DialectType = None, 2733 copy: bool = True, 2734 **opts, 2735 ) -> Join: 2736 """ 2737 Append to or set the USING expressions. 2738 2739 Example: 2740 >>> import sqlglot 2741 >>> sqlglot.parse_one("JOIN x", into=Join).using("foo", "bla").sql() 2742 'JOIN x USING (foo, bla)' 2743 2744 Args: 2745 *expressions: the SQL code strings to parse. 2746 If an `Expression` instance is passed, it will be used as-is. 2747 append: if `True`, concatenate the new expressions to the existing "using" list. 2748 Otherwise, this resets the expression. 2749 dialect: the dialect used to parse the input expressions. 2750 copy: if `False`, modify this expression instance in-place. 2751 opts: other options to use to parse the input expressions. 2752 2753 Returns: 2754 The modified Join expression. 2755 """ 2756 join = _apply_list_builder( 2757 *expressions, 2758 instance=self, 2759 arg="using", 2760 append=append, 2761 dialect=dialect, 2762 copy=copy, 2763 **opts, 2764 ) 2765 2766 if join.kind == "CROSS": 2767 join.set("kind", None) 2768 2769 return join
2684 def on( 2685 self, 2686 *expressions: t.Optional[ExpOrStr], 2687 append: bool = True, 2688 dialect: DialectType = None, 2689 copy: bool = True, 2690 **opts, 2691 ) -> Join: 2692 """ 2693 Append to or set the ON expressions. 2694 2695 Example: 2696 >>> import sqlglot 2697 >>> sqlglot.parse_one("JOIN x", into=Join).on("y = 1").sql() 2698 'JOIN x ON y = 1' 2699 2700 Args: 2701 *expressions: the SQL code strings to parse. 2702 If an `Expression` instance is passed, it will be used as-is. 2703 Multiple expressions are combined with an AND operator. 2704 append: if `True`, AND the new expressions to any existing expression. 2705 Otherwise, this resets the expression. 2706 dialect: the dialect used to parse the input expressions. 2707 copy: if `False`, modify this expression instance in-place. 2708 opts: other options to use to parse the input expressions. 2709 2710 Returns: 2711 The modified Join expression. 2712 """ 2713 join = _apply_conjunction_builder( 2714 *expressions, 2715 instance=self, 2716 arg="on", 2717 append=append, 2718 dialect=dialect, 2719 copy=copy, 2720 **opts, 2721 ) 2722 2723 if join.kind == "CROSS": 2724 join.set("kind", None) 2725 2726 return join
Append to or set the ON expressions.
Example:
>>> import sqlglot >>> sqlglot.parse_one("JOIN x", into=Join).on("y = 1").sql() 'JOIN x ON y = 1'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. Multiple expressions are combined with an AND operator. - append: if
True, AND the new expressions to any existing expression. Otherwise, this resets the expression. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Join expression.
2728 def using( 2729 self, 2730 *expressions: t.Optional[ExpOrStr], 2731 append: bool = True, 2732 dialect: DialectType = None, 2733 copy: bool = True, 2734 **opts, 2735 ) -> Join: 2736 """ 2737 Append to or set the USING expressions. 2738 2739 Example: 2740 >>> import sqlglot 2741 >>> sqlglot.parse_one("JOIN x", into=Join).using("foo", "bla").sql() 2742 'JOIN x USING (foo, bla)' 2743 2744 Args: 2745 *expressions: the SQL code strings to parse. 2746 If an `Expression` instance is passed, it will be used as-is. 2747 append: if `True`, concatenate the new expressions to the existing "using" list. 2748 Otherwise, this resets the expression. 2749 dialect: the dialect used to parse the input expressions. 2750 copy: if `False`, modify this expression instance in-place. 2751 opts: other options to use to parse the input expressions. 2752 2753 Returns: 2754 The modified Join expression. 2755 """ 2756 join = _apply_list_builder( 2757 *expressions, 2758 instance=self, 2759 arg="using", 2760 append=append, 2761 dialect=dialect, 2762 copy=copy, 2763 **opts, 2764 ) 2765 2766 if join.kind == "CROSS": 2767 join.set("kind", None) 2768 2769 return join
Append to or set the USING expressions.
Example:
>>> import sqlglot >>> sqlglot.parse_one("JOIN x", into=Join).using("foo", "bla").sql() 'JOIN x USING (foo, bla)'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - append: if
True, concatenate the new expressions to the existing "using" list. Otherwise, this resets the expression. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Join expression.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2772class Lateral(UDTF): 2773 arg_types = { 2774 "this": True, 2775 "view": False, 2776 "outer": False, 2777 "alias": False, 2778 "cross_apply": False, # True -> CROSS APPLY, False -> OUTER APPLY 2779 "ordinality": False, 2780 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2785class TableFromRows(UDTF): 2786 arg_types = { 2787 "this": True, 2788 "alias": False, 2789 "joins": False, 2790 "pivots": False, 2791 "sample": False, 2792 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2795class MatchRecognizeMeasure(Expression): 2796 arg_types = { 2797 "this": True, 2798 "window_frame": False, 2799 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2802class MatchRecognize(Expression): 2803 arg_types = { 2804 "partition_by": False, 2805 "order": False, 2806 "measures": False, 2807 "rows": False, 2808 "after": False, 2809 "pattern": False, 2810 "define": False, 2811 "alias": False, 2812 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2821class Offset(Expression): 2822 arg_types = {"this": False, "expression": True, "expressions": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2825class Order(Expression): 2826 arg_types = {"this": False, "expressions": True, "siblings": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2830class WithFill(Expression): 2831 arg_types = { 2832 "from_": False, 2833 "to": False, 2834 "step": False, 2835 "interpolate": False, 2836 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2853class Ordered(Expression): 2854 arg_types = {"this": True, "desc": False, "nulls_first": True, "with_fill": False} 2855 2856 @property 2857 def name(self) -> str: 2858 return self.this.name
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2899class BlockCompressionProperty(Property): 2900 arg_types = { 2901 "autotemp": False, 2902 "always": False, 2903 "default": False, 2904 "manual": False, 2905 "never": False, 2906 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2925class DataBlocksizeProperty(Property): 2926 arg_types = { 2927 "size": False, 2928 "units": False, 2929 "minimum": False, 2930 "maximum": False, 2931 "default": False, 2932 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2935class DataDeletionProperty(Property): 2936 arg_types = {"on": True, "filter_column": False, "retention_period": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2949class DistributedByProperty(Property): 2950 arg_types = {"expressions": False, "kind": True, "buckets": False, "order": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
2986class FileFormatProperty(Property): 2987 arg_types = {"this": False, "expressions": False, "hive_format": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3018class IsolatedLoadingProperty(Property): 3019 arg_types = {"no": False, "concurrent": False, "target": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3022class JournalProperty(Property): 3023 arg_types = { 3024 "no": False, 3025 "dual": False, 3026 "before": False, 3027 "local": False, 3028 "after": False, 3029 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3041class ClusteredByProperty(Property): 3042 arg_types = {"expressions": True, "sorted_by": False, "buckets": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3084class LockingProperty(Property): 3085 arg_types = { 3086 "this": False, 3087 "kind": True, 3088 "for_or_in": False, 3089 "lock_type": True, 3090 "override": False, 3091 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3102class MergeBlockRatioProperty(Property): 3103 arg_types = {"this": False, "no": False, "default": False, "percent": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3131class PartitionByRangeProperty(Property): 3132 arg_types = {"partition_expressions": True, "create_expressions": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3136class PartitionByRangePropertyDynamic(Expression): 3137 arg_types = {"this": False, "start": True, "end": True, "every": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3146class RollupIndex(Expression): 3147 arg_types = {"this": True, "expressions": True, "from_index": False, "properties": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3151class PartitionByListProperty(Property): 3152 arg_types = {"partition_expressions": True, "create_expressions": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3161class RefreshTriggerProperty(Property): 3162 arg_types = { 3163 "method": False, 3164 "kind": False, 3165 "every": False, 3166 "unit": False, 3167 "starts": False, 3168 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3177class PartitionBoundSpec(Expression): 3178 # this -> IN / MODULUS, expression -> REMAINDER, from_expressions -> FROM (...), to_expressions -> TO (...) 3179 arg_types = { 3180 "this": False, 3181 "expression": False, 3182 "from_expressions": False, 3183 "to_expressions": False, 3184 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3187class PartitionedOfProperty(Property): 3188 # this -> parent_table (schema), expression -> FOR VALUES ... / DEFAULT 3189 arg_types = {"this": True, "expression": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3200class ReturnsProperty(Property): 3201 arg_types = {"this": False, "is_table": False, "table": False, "null": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3212class RowFormatDelimitedProperty(Property): 3213 # https://cwiki.apache.org/confluence/display/hive/languagemanual+dml 3214 arg_types = { 3215 "fields": False, 3216 "escaped": False, 3217 "collection_items": False, 3218 "map_keys": False, 3219 "lines": False, 3220 "null": False, 3221 "serde": False, 3222 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3225class RowFormatSerdeProperty(Property): 3226 arg_types = {"this": True, "serde_properties": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3230class QueryTransform(Expression): 3231 arg_types = { 3232 "expressions": True, 3233 "command_script": True, 3234 "schema": False, 3235 "row_format_before": False, 3236 "record_writer": False, 3237 "row_format_after": False, 3238 "record_reader": False, 3239 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3255class SemanticView(Expression): 3256 arg_types = { 3257 "this": True, 3258 "metrics": False, 3259 "dimensions": False, 3260 "facts": False, 3261 "where": False, 3262 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3356class WithSystemVersioningProperty(Property): 3357 arg_types = { 3358 "on": False, 3359 "this": False, 3360 "data_consistency": False, 3361 "retention_period": False, 3362 "with_": True, 3363 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3370class EncodeProperty(Property): 3371 arg_types = {"this": True, "properties": False, "key": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3374class IncludeProperty(Property): 3375 arg_types = {"this": True, "alias": False, "column_def": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3382class Properties(Expression): 3383 arg_types = {"expressions": True} 3384 3385 NAME_TO_PROPERTY = { 3386 "ALGORITHM": AlgorithmProperty, 3387 "AUTO_INCREMENT": AutoIncrementProperty, 3388 "CHARACTER SET": CharacterSetProperty, 3389 "CLUSTERED_BY": ClusteredByProperty, 3390 "COLLATE": CollateProperty, 3391 "COMMENT": SchemaCommentProperty, 3392 "CREDENTIALS": CredentialsProperty, 3393 "DEFINER": DefinerProperty, 3394 "DISTKEY": DistKeyProperty, 3395 "DISTRIBUTED_BY": DistributedByProperty, 3396 "DISTSTYLE": DistStyleProperty, 3397 "ENGINE": EngineProperty, 3398 "EXECUTE AS": ExecuteAsProperty, 3399 "FORMAT": FileFormatProperty, 3400 "LANGUAGE": LanguageProperty, 3401 "LOCATION": LocationProperty, 3402 "LOCK": LockProperty, 3403 "PARTITIONED_BY": PartitionedByProperty, 3404 "RETURNS": ReturnsProperty, 3405 "ROW_FORMAT": RowFormatProperty, 3406 "SORTKEY": SortKeyProperty, 3407 "ENCODE": EncodeProperty, 3408 "INCLUDE": IncludeProperty, 3409 } 3410 3411 PROPERTY_TO_NAME = {v: k for k, v in NAME_TO_PROPERTY.items()} 3412 3413 # CREATE property locations 3414 # Form: schema specified 3415 # create [POST_CREATE] 3416 # table a [POST_NAME] 3417 # (b int) [POST_SCHEMA] 3418 # with ([POST_WITH]) 3419 # index (b) [POST_INDEX] 3420 # 3421 # Form: alias selection 3422 # create [POST_CREATE] 3423 # table a [POST_NAME] 3424 # as [POST_ALIAS] (select * from b) [POST_EXPRESSION] 3425 # index (c) [POST_INDEX] 3426 class Location(AutoName): 3427 POST_CREATE = auto() 3428 POST_NAME = auto() 3429 POST_SCHEMA = auto() 3430 POST_WITH = auto() 3431 POST_ALIAS = auto() 3432 POST_EXPRESSION = auto() 3433 POST_INDEX = auto() 3434 UNSUPPORTED = auto() 3435 3436 @classmethod 3437 def from_dict(cls, properties_dict: t.Dict) -> Properties: 3438 expressions = [] 3439 for key, value in properties_dict.items(): 3440 property_cls = cls.NAME_TO_PROPERTY.get(key.upper()) 3441 if property_cls: 3442 expressions.append(property_cls(this=convert(value))) 3443 else: 3444 expressions.append(Property(this=Literal.string(key), value=convert(value))) 3445 3446 return cls(expressions=expressions)
3436 @classmethod 3437 def from_dict(cls, properties_dict: t.Dict) -> Properties: 3438 expressions = [] 3439 for key, value in properties_dict.items(): 3440 property_cls = cls.NAME_TO_PROPERTY.get(key.upper()) 3441 if property_cls: 3442 expressions.append(property_cls(this=convert(value))) 3443 else: 3444 expressions.append(Property(this=Literal.string(key), value=convert(value))) 3445 3446 return cls(expressions=expressions)
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3426 class Location(AutoName): 3427 POST_CREATE = auto() 3428 POST_NAME = auto() 3429 POST_SCHEMA = auto() 3430 POST_WITH = auto() 3431 POST_ALIAS = auto() 3432 POST_EXPRESSION = auto() 3433 POST_INDEX = auto() 3434 UNSUPPORTED = auto()
An enumeration.
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3453class InputOutputFormat(Expression): 3454 arg_types = {"input_format": False, "output_format": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3462class Reference(Expression): 3463 arg_types = {"this": True, "expressions": False, "options": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3466class Tuple(Expression): 3467 arg_types = {"expressions": False} 3468 3469 def isin( 3470 self, 3471 *expressions: t.Any, 3472 query: t.Optional[ExpOrStr] = None, 3473 unnest: t.Optional[ExpOrStr] | t.Collection[ExpOrStr] = None, 3474 copy: bool = True, 3475 **opts, 3476 ) -> In: 3477 return In( 3478 this=maybe_copy(self, copy), 3479 expressions=[convert(e, copy=copy) for e in expressions], 3480 query=maybe_parse(query, copy=copy, **opts) if query else None, 3481 unnest=( 3482 Unnest( 3483 expressions=[ 3484 maybe_parse(t.cast(ExpOrStr, e), copy=copy, **opts) 3485 for e in ensure_list(unnest) 3486 ] 3487 ) 3488 if unnest 3489 else None 3490 ), 3491 )
3469 def isin( 3470 self, 3471 *expressions: t.Any, 3472 query: t.Optional[ExpOrStr] = None, 3473 unnest: t.Optional[ExpOrStr] | t.Collection[ExpOrStr] = None, 3474 copy: bool = True, 3475 **opts, 3476 ) -> In: 3477 return In( 3478 this=maybe_copy(self, copy), 3479 expressions=[convert(e, copy=copy) for e in expressions], 3480 query=maybe_parse(query, copy=copy, **opts) if query else None, 3481 unnest=( 3482 Unnest( 3483 expressions=[ 3484 maybe_parse(t.cast(ExpOrStr, e), copy=copy, **opts) 3485 for e in ensure_list(unnest) 3486 ] 3487 ) 3488 if unnest 3489 else None 3490 ), 3491 )
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3532class IndexTableHint(Expression): 3533 arg_types = {"this": True, "expressions": False, "target": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3537class HistoricalData(Expression): 3538 arg_types = {"this": True, "kind": True, "expression": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3551class Table(Expression): 3552 arg_types = { 3553 "this": False, 3554 "alias": False, 3555 "db": False, 3556 "catalog": False, 3557 "laterals": False, 3558 "joins": False, 3559 "pivots": False, 3560 "hints": False, 3561 "system_time": False, 3562 "version": False, 3563 "format": False, 3564 "pattern": False, 3565 "ordinality": False, 3566 "when": False, 3567 "only": False, 3568 "partition": False, 3569 "changes": False, 3570 "rows_from": False, 3571 "sample": False, 3572 "indexed": False, 3573 } 3574 3575 @property 3576 def name(self) -> str: 3577 if not self.this or isinstance(self.this, Func): 3578 return "" 3579 return self.this.name 3580 3581 @property 3582 def db(self) -> str: 3583 return self.text("db") 3584 3585 @property 3586 def catalog(self) -> str: 3587 return self.text("catalog") 3588 3589 @property 3590 def selects(self) -> t.List[Expression]: 3591 return [] 3592 3593 @property 3594 def named_selects(self) -> t.List[str]: 3595 return [] 3596 3597 @property 3598 def parts(self) -> t.List[Expression]: 3599 """Return the parts of a table in order catalog, db, table.""" 3600 parts: t.List[Expression] = [] 3601 3602 for arg in ("catalog", "db", "this"): 3603 part = self.args.get(arg) 3604 3605 if isinstance(part, Dot): 3606 parts.extend(part.flatten()) 3607 elif isinstance(part, Expression): 3608 parts.append(part) 3609 3610 return parts 3611 3612 def to_column(self, copy: bool = True) -> Expression: 3613 parts = self.parts 3614 last_part = parts[-1] 3615 3616 if isinstance(last_part, Identifier): 3617 col: Expression = column(*reversed(parts[0:4]), fields=parts[4:], copy=copy) # type: ignore 3618 else: 3619 # This branch will be reached if a function or array is wrapped in a `Table` 3620 col = last_part 3621 3622 alias = self.args.get("alias") 3623 if alias: 3624 col = alias_(col, alias.this, copy=copy) 3625 3626 return col
3597 @property 3598 def parts(self) -> t.List[Expression]: 3599 """Return the parts of a table in order catalog, db, table.""" 3600 parts: t.List[Expression] = [] 3601 3602 for arg in ("catalog", "db", "this"): 3603 part = self.args.get(arg) 3604 3605 if isinstance(part, Dot): 3606 parts.extend(part.flatten()) 3607 elif isinstance(part, Expression): 3608 parts.append(part) 3609 3610 return parts
Return the parts of a table in order catalog, db, table.
3612 def to_column(self, copy: bool = True) -> Expression: 3613 parts = self.parts 3614 last_part = parts[-1] 3615 3616 if isinstance(last_part, Identifier): 3617 col: Expression = column(*reversed(parts[0:4]), fields=parts[4:], copy=copy) # type: ignore 3618 else: 3619 # This branch will be reached if a function or array is wrapped in a `Table` 3620 col = last_part 3621 3622 alias = self.args.get("alias") 3623 if alias: 3624 col = alias_(col, alias.this, copy=copy) 3625 3626 return col
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3629class SetOperation(Query): 3630 arg_types = { 3631 "with_": False, 3632 "this": True, 3633 "expression": True, 3634 "distinct": False, 3635 "by_name": False, 3636 "side": False, 3637 "kind": False, 3638 "on": False, 3639 **QUERY_MODIFIERS, 3640 } 3641 3642 def select( 3643 self: S, 3644 *expressions: t.Optional[ExpOrStr], 3645 append: bool = True, 3646 dialect: DialectType = None, 3647 copy: bool = True, 3648 **opts, 3649 ) -> S: 3650 this = maybe_copy(self, copy) 3651 this.this.unnest().select(*expressions, append=append, dialect=dialect, copy=False, **opts) 3652 this.expression.unnest().select( 3653 *expressions, append=append, dialect=dialect, copy=False, **opts 3654 ) 3655 return this 3656 3657 @property 3658 def named_selects(self) -> t.List[str]: 3659 expression = self 3660 while isinstance(expression, SetOperation): 3661 expression = expression.this.unnest() 3662 return expression.named_selects 3663 3664 @property 3665 def is_star(self) -> bool: 3666 return self.this.is_star or self.expression.is_star 3667 3668 @property 3669 def selects(self) -> t.List[Expression]: 3670 expression = self 3671 while isinstance(expression, SetOperation): 3672 expression = expression.this.unnest() 3673 return expression.selects 3674 3675 @property 3676 def left(self) -> Query: 3677 return self.this 3678 3679 @property 3680 def right(self) -> Query: 3681 return self.expression 3682 3683 @property 3684 def kind(self) -> str: 3685 return self.text("kind").upper() 3686 3687 @property 3688 def side(self) -> str: 3689 return self.text("side").upper()
3642 def select( 3643 self: S, 3644 *expressions: t.Optional[ExpOrStr], 3645 append: bool = True, 3646 dialect: DialectType = None, 3647 copy: bool = True, 3648 **opts, 3649 ) -> S: 3650 this = maybe_copy(self, copy) 3651 this.this.unnest().select(*expressions, append=append, dialect=dialect, copy=False, **opts) 3652 this.expression.unnest().select( 3653 *expressions, append=append, dialect=dialect, copy=False, **opts 3654 ) 3655 return this
Append to or set the SELECT expressions.
Example:
>>> Select().select("x", "y").sql() 'SELECT x, y'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Query expression.
3657 @property 3658 def named_selects(self) -> t.List[str]: 3659 expression = self 3660 while isinstance(expression, SetOperation): 3661 expression = expression.this.unnest() 3662 return expression.named_selects
Returns the output names of the query's projections.
3664 @property 3665 def is_star(self) -> bool: 3666 return self.this.is_star or self.expression.is_star
Checks whether an expression is a star.
3668 @property 3669 def selects(self) -> t.List[Expression]: 3670 expression = self 3671 while isinstance(expression, SetOperation): 3672 expression = expression.this.unnest() 3673 return expression.selects
Returns the query's projections.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3704class Update(DML): 3705 arg_types = { 3706 "with_": False, 3707 "this": False, 3708 "expressions": False, 3709 "from_": False, 3710 "where": False, 3711 "returning": False, 3712 "order": False, 3713 "limit": False, 3714 "options": False, 3715 } 3716 3717 def table( 3718 self, expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 3719 ) -> Update: 3720 """ 3721 Set the table to update. 3722 3723 Example: 3724 >>> Update().table("my_table").set_("x = 1").sql() 3725 'UPDATE my_table SET x = 1' 3726 3727 Args: 3728 expression : the SQL code strings to parse. 3729 If a `Table` instance is passed, this is used as-is. 3730 If another `Expression` instance is passed, it will be wrapped in a `Table`. 3731 dialect: the dialect used to parse the input expression. 3732 copy: if `False`, modify this expression instance in-place. 3733 opts: other options to use to parse the input expressions. 3734 3735 Returns: 3736 The modified Update expression. 3737 """ 3738 return _apply_builder( 3739 expression=expression, 3740 instance=self, 3741 arg="this", 3742 into=Table, 3743 prefix=None, 3744 dialect=dialect, 3745 copy=copy, 3746 **opts, 3747 ) 3748 3749 def set_( 3750 self, 3751 *expressions: ExpOrStr, 3752 append: bool = True, 3753 dialect: DialectType = None, 3754 copy: bool = True, 3755 **opts, 3756 ) -> Update: 3757 """ 3758 Append to or set the SET expressions. 3759 3760 Example: 3761 >>> Update().table("my_table").set_("x = 1").sql() 3762 'UPDATE my_table SET x = 1' 3763 3764 Args: 3765 *expressions: the SQL code strings to parse. 3766 If `Expression` instance(s) are passed, they will be used as-is. 3767 Multiple expressions are combined with a comma. 3768 append: if `True`, add the new expressions to any existing SET expressions. 3769 Otherwise, this resets the expressions. 3770 dialect: the dialect used to parse the input expressions. 3771 copy: if `False`, modify this expression instance in-place. 3772 opts: other options to use to parse the input expressions. 3773 """ 3774 return _apply_list_builder( 3775 *expressions, 3776 instance=self, 3777 arg="expressions", 3778 append=append, 3779 into=Expression, 3780 prefix=None, 3781 dialect=dialect, 3782 copy=copy, 3783 **opts, 3784 ) 3785 3786 def where( 3787 self, 3788 *expressions: t.Optional[ExpOrStr], 3789 append: bool = True, 3790 dialect: DialectType = None, 3791 copy: bool = True, 3792 **opts, 3793 ) -> Select: 3794 """ 3795 Append to or set the WHERE expressions. 3796 3797 Example: 3798 >>> Update().table("tbl").set_("x = 1").where("x = 'a' OR x < 'b'").sql() 3799 "UPDATE tbl SET x = 1 WHERE x = 'a' OR x < 'b'" 3800 3801 Args: 3802 *expressions: the SQL code strings to parse. 3803 If an `Expression` instance is passed, it will be used as-is. 3804 Multiple expressions are combined with an AND operator. 3805 append: if `True`, AND the new expressions to any existing expression. 3806 Otherwise, this resets the expression. 3807 dialect: the dialect used to parse the input expressions. 3808 copy: if `False`, modify this expression instance in-place. 3809 opts: other options to use to parse the input expressions. 3810 3811 Returns: 3812 Select: the modified expression. 3813 """ 3814 return _apply_conjunction_builder( 3815 *expressions, 3816 instance=self, 3817 arg="where", 3818 append=append, 3819 into=Where, 3820 dialect=dialect, 3821 copy=copy, 3822 **opts, 3823 ) 3824 3825 def from_( 3826 self, 3827 expression: t.Optional[ExpOrStr] = None, 3828 dialect: DialectType = None, 3829 copy: bool = True, 3830 **opts, 3831 ) -> Update: 3832 """ 3833 Set the FROM expression. 3834 3835 Example: 3836 >>> Update().table("my_table").set_("x = 1").from_("baz").sql() 3837 'UPDATE my_table SET x = 1 FROM baz' 3838 3839 Args: 3840 expression : the SQL code strings to parse. 3841 If a `From` instance is passed, this is used as-is. 3842 If another `Expression` instance is passed, it will be wrapped in a `From`. 3843 If nothing is passed in then a from is not applied to the expression 3844 dialect: the dialect used to parse the input expression. 3845 copy: if `False`, modify this expression instance in-place. 3846 opts: other options to use to parse the input expressions. 3847 3848 Returns: 3849 The modified Update expression. 3850 """ 3851 if not expression: 3852 return maybe_copy(self, copy) 3853 3854 return _apply_builder( 3855 expression=expression, 3856 instance=self, 3857 arg="from_", 3858 into=From, 3859 prefix="FROM", 3860 dialect=dialect, 3861 copy=copy, 3862 **opts, 3863 ) 3864 3865 def with_( 3866 self, 3867 alias: ExpOrStr, 3868 as_: ExpOrStr, 3869 recursive: t.Optional[bool] = None, 3870 materialized: t.Optional[bool] = None, 3871 append: bool = True, 3872 dialect: DialectType = None, 3873 copy: bool = True, 3874 **opts, 3875 ) -> Update: 3876 """ 3877 Append to or set the common table expressions. 3878 3879 Example: 3880 >>> Update().table("my_table").set_("x = 1").from_("baz").with_("baz", "SELECT id FROM foo").sql() 3881 'WITH baz AS (SELECT id FROM foo) UPDATE my_table SET x = 1 FROM baz' 3882 3883 Args: 3884 alias: the SQL code string to parse as the table name. 3885 If an `Expression` instance is passed, this is used as-is. 3886 as_: the SQL code string to parse as the table expression. 3887 If an `Expression` instance is passed, it will be used as-is. 3888 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 3889 materialized: set the MATERIALIZED part of the expression. 3890 append: if `True`, add to any existing expressions. 3891 Otherwise, this resets the expressions. 3892 dialect: the dialect used to parse the input expression. 3893 copy: if `False`, modify this expression instance in-place. 3894 opts: other options to use to parse the input expressions. 3895 3896 Returns: 3897 The modified expression. 3898 """ 3899 return _apply_cte_builder( 3900 self, 3901 alias, 3902 as_, 3903 recursive=recursive, 3904 materialized=materialized, 3905 append=append, 3906 dialect=dialect, 3907 copy=copy, 3908 **opts, 3909 )
3717 def table( 3718 self, expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 3719 ) -> Update: 3720 """ 3721 Set the table to update. 3722 3723 Example: 3724 >>> Update().table("my_table").set_("x = 1").sql() 3725 'UPDATE my_table SET x = 1' 3726 3727 Args: 3728 expression : the SQL code strings to parse. 3729 If a `Table` instance is passed, this is used as-is. 3730 If another `Expression` instance is passed, it will be wrapped in a `Table`. 3731 dialect: the dialect used to parse the input expression. 3732 copy: if `False`, modify this expression instance in-place. 3733 opts: other options to use to parse the input expressions. 3734 3735 Returns: 3736 The modified Update expression. 3737 """ 3738 return _apply_builder( 3739 expression=expression, 3740 instance=self, 3741 arg="this", 3742 into=Table, 3743 prefix=None, 3744 dialect=dialect, 3745 copy=copy, 3746 **opts, 3747 )
Set the table to update.
Example:
>>> Update().table("my_table").set_("x = 1").sql() 'UPDATE my_table SET x = 1'
Arguments:
- expression : the SQL code strings to parse.
If a
Tableinstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aTable. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Update expression.
3749 def set_( 3750 self, 3751 *expressions: ExpOrStr, 3752 append: bool = True, 3753 dialect: DialectType = None, 3754 copy: bool = True, 3755 **opts, 3756 ) -> Update: 3757 """ 3758 Append to or set the SET expressions. 3759 3760 Example: 3761 >>> Update().table("my_table").set_("x = 1").sql() 3762 'UPDATE my_table SET x = 1' 3763 3764 Args: 3765 *expressions: the SQL code strings to parse. 3766 If `Expression` instance(s) are passed, they will be used as-is. 3767 Multiple expressions are combined with a comma. 3768 append: if `True`, add the new expressions to any existing SET expressions. 3769 Otherwise, this resets the expressions. 3770 dialect: the dialect used to parse the input expressions. 3771 copy: if `False`, modify this expression instance in-place. 3772 opts: other options to use to parse the input expressions. 3773 """ 3774 return _apply_list_builder( 3775 *expressions, 3776 instance=self, 3777 arg="expressions", 3778 append=append, 3779 into=Expression, 3780 prefix=None, 3781 dialect=dialect, 3782 copy=copy, 3783 **opts, 3784 )
Append to or set the SET expressions.
Example:
>>> Update().table("my_table").set_("x = 1").sql() 'UPDATE my_table SET x = 1'
Arguments:
- *expressions: the SQL code strings to parse.
If
Expressioninstance(s) are passed, they will be used as-is. Multiple expressions are combined with a comma. - append: if
True, add the new expressions to any existing SET expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
3786 def where( 3787 self, 3788 *expressions: t.Optional[ExpOrStr], 3789 append: bool = True, 3790 dialect: DialectType = None, 3791 copy: bool = True, 3792 **opts, 3793 ) -> Select: 3794 """ 3795 Append to or set the WHERE expressions. 3796 3797 Example: 3798 >>> Update().table("tbl").set_("x = 1").where("x = 'a' OR x < 'b'").sql() 3799 "UPDATE tbl SET x = 1 WHERE x = 'a' OR x < 'b'" 3800 3801 Args: 3802 *expressions: the SQL code strings to parse. 3803 If an `Expression` instance is passed, it will be used as-is. 3804 Multiple expressions are combined with an AND operator. 3805 append: if `True`, AND the new expressions to any existing expression. 3806 Otherwise, this resets the expression. 3807 dialect: the dialect used to parse the input expressions. 3808 copy: if `False`, modify this expression instance in-place. 3809 opts: other options to use to parse the input expressions. 3810 3811 Returns: 3812 Select: the modified expression. 3813 """ 3814 return _apply_conjunction_builder( 3815 *expressions, 3816 instance=self, 3817 arg="where", 3818 append=append, 3819 into=Where, 3820 dialect=dialect, 3821 copy=copy, 3822 **opts, 3823 )
Append to or set the WHERE expressions.
Example:
>>> Update().table("tbl").set_("x = 1").where("x = 'a' OR x < 'b'").sql() "UPDATE tbl SET x = 1 WHERE x = 'a' OR x < 'b'"
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. Multiple expressions are combined with an AND operator. - append: if
True, AND the new expressions to any existing expression. Otherwise, this resets the expression. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
Select: the modified expression.
3825 def from_( 3826 self, 3827 expression: t.Optional[ExpOrStr] = None, 3828 dialect: DialectType = None, 3829 copy: bool = True, 3830 **opts, 3831 ) -> Update: 3832 """ 3833 Set the FROM expression. 3834 3835 Example: 3836 >>> Update().table("my_table").set_("x = 1").from_("baz").sql() 3837 'UPDATE my_table SET x = 1 FROM baz' 3838 3839 Args: 3840 expression : the SQL code strings to parse. 3841 If a `From` instance is passed, this is used as-is. 3842 If another `Expression` instance is passed, it will be wrapped in a `From`. 3843 If nothing is passed in then a from is not applied to the expression 3844 dialect: the dialect used to parse the input expression. 3845 copy: if `False`, modify this expression instance in-place. 3846 opts: other options to use to parse the input expressions. 3847 3848 Returns: 3849 The modified Update expression. 3850 """ 3851 if not expression: 3852 return maybe_copy(self, copy) 3853 3854 return _apply_builder( 3855 expression=expression, 3856 instance=self, 3857 arg="from_", 3858 into=From, 3859 prefix="FROM", 3860 dialect=dialect, 3861 copy=copy, 3862 **opts, 3863 )
Set the FROM expression.
Example:
>>> Update().table("my_table").set_("x = 1").from_("baz").sql() 'UPDATE my_table SET x = 1 FROM baz'
Arguments:
- expression : the SQL code strings to parse.
If a
Frominstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aFrom. If nothing is passed in then a from is not applied to the expression - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Update expression.
3865 def with_( 3866 self, 3867 alias: ExpOrStr, 3868 as_: ExpOrStr, 3869 recursive: t.Optional[bool] = None, 3870 materialized: t.Optional[bool] = None, 3871 append: bool = True, 3872 dialect: DialectType = None, 3873 copy: bool = True, 3874 **opts, 3875 ) -> Update: 3876 """ 3877 Append to or set the common table expressions. 3878 3879 Example: 3880 >>> Update().table("my_table").set_("x = 1").from_("baz").with_("baz", "SELECT id FROM foo").sql() 3881 'WITH baz AS (SELECT id FROM foo) UPDATE my_table SET x = 1 FROM baz' 3882 3883 Args: 3884 alias: the SQL code string to parse as the table name. 3885 If an `Expression` instance is passed, this is used as-is. 3886 as_: the SQL code string to parse as the table expression. 3887 If an `Expression` instance is passed, it will be used as-is. 3888 recursive: set the RECURSIVE part of the expression. Defaults to `False`. 3889 materialized: set the MATERIALIZED part of the expression. 3890 append: if `True`, add to any existing expressions. 3891 Otherwise, this resets the expressions. 3892 dialect: the dialect used to parse the input expression. 3893 copy: if `False`, modify this expression instance in-place. 3894 opts: other options to use to parse the input expressions. 3895 3896 Returns: 3897 The modified expression. 3898 """ 3899 return _apply_cte_builder( 3900 self, 3901 alias, 3902 as_, 3903 recursive=recursive, 3904 materialized=materialized, 3905 append=append, 3906 dialect=dialect, 3907 copy=copy, 3908 **opts, 3909 )
Append to or set the common table expressions.
Example:
>>> Update().table("my_table").set_("x = 1").from_("baz").with_("baz", "SELECT id FROM foo").sql() 'WITH baz AS (SELECT id FROM foo) UPDATE my_table SET x = 1 FROM baz'
Arguments:
- alias: the SQL code string to parse as the table name.
If an
Expressioninstance is passed, this is used as-is. - as_: the SQL code string to parse as the table expression.
If an
Expressioninstance is passed, it will be used as-is. - recursive: set the RECURSIVE part of the expression. Defaults to
False. - materialized: set the MATERIALIZED part of the expression.
- append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified expression.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3913class Values(UDTF): 3914 arg_types = { 3915 "expressions": True, 3916 "alias": False, 3917 "order": False, 3918 "limit": False, 3919 "offset": False, 3920 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3927class Version(Expression): 3928 """ 3929 Time travel, iceberg, bigquery etc 3930 https://trino.io/docs/current/connector/iceberg.html?highlight=snapshot#using-snapshots 3931 https://www.databricks.com/blog/2019/02/04/introducing-delta-time-travel-for-large-scale-data-lakes.html 3932 https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#for_system_time_as_of 3933 https://learn.microsoft.com/en-us/sql/relational-databases/tables/querying-data-in-a-system-versioned-temporal-table?view=sql-server-ver16 3934 this is either TIMESTAMP or VERSION 3935 kind is ("AS OF", "BETWEEN") 3936 """ 3937 3938 arg_types = {"this": True, "kind": True, "expression": False}
Time travel, iceberg, bigquery etc https://trino.io/docs/current/connector/iceberg.html?highlight=snapshot#using-snapshots https://www.databricks.com/blog/2019/02/04/introducing-delta-time-travel-for-large-scale-data-lakes.html https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#for_system_time_as_of https://learn.microsoft.com/en-us/sql/relational-databases/tables/querying-data-in-a-system-versioned-temporal-table?view=sql-server-ver16 this is either TIMESTAMP or VERSION kind is ("AS OF", "BETWEEN")
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3947class Lock(Expression): 3948 arg_types = {"update": True, "expressions": False, "wait": False, "key": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
3951class Select(Query): 3952 arg_types = { 3953 "with_": False, 3954 "kind": False, 3955 "expressions": False, 3956 "hint": False, 3957 "distinct": False, 3958 "into": False, 3959 "from_": False, 3960 "operation_modifiers": False, 3961 **QUERY_MODIFIERS, 3962 } 3963 3964 def from_( 3965 self, expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 3966 ) -> Select: 3967 """ 3968 Set the FROM expression. 3969 3970 Example: 3971 >>> Select().from_("tbl").select("x").sql() 3972 'SELECT x FROM tbl' 3973 3974 Args: 3975 expression : the SQL code strings to parse. 3976 If a `From` instance is passed, this is used as-is. 3977 If another `Expression` instance is passed, it will be wrapped in a `From`. 3978 dialect: the dialect used to parse the input expression. 3979 copy: if `False`, modify this expression instance in-place. 3980 opts: other options to use to parse the input expressions. 3981 3982 Returns: 3983 The modified Select expression. 3984 """ 3985 return _apply_builder( 3986 expression=expression, 3987 instance=self, 3988 arg="from_", 3989 into=From, 3990 prefix="FROM", 3991 dialect=dialect, 3992 copy=copy, 3993 **opts, 3994 ) 3995 3996 def group_by( 3997 self, 3998 *expressions: t.Optional[ExpOrStr], 3999 append: bool = True, 4000 dialect: DialectType = None, 4001 copy: bool = True, 4002 **opts, 4003 ) -> Select: 4004 """ 4005 Set the GROUP BY expression. 4006 4007 Example: 4008 >>> Select().from_("tbl").select("x", "COUNT(1)").group_by("x").sql() 4009 'SELECT x, COUNT(1) FROM tbl GROUP BY x' 4010 4011 Args: 4012 *expressions: the SQL code strings to parse. 4013 If a `Group` instance is passed, this is used as-is. 4014 If another `Expression` instance is passed, it will be wrapped in a `Group`. 4015 If nothing is passed in then a group by is not applied to the expression 4016 append: if `True`, add to any existing expressions. 4017 Otherwise, this flattens all the `Group` expression into a single expression. 4018 dialect: the dialect used to parse the input expression. 4019 copy: if `False`, modify this expression instance in-place. 4020 opts: other options to use to parse the input expressions. 4021 4022 Returns: 4023 The modified Select expression. 4024 """ 4025 if not expressions: 4026 return self if not copy else self.copy() 4027 4028 return _apply_child_list_builder( 4029 *expressions, 4030 instance=self, 4031 arg="group", 4032 append=append, 4033 copy=copy, 4034 prefix="GROUP BY", 4035 into=Group, 4036 dialect=dialect, 4037 **opts, 4038 ) 4039 4040 def sort_by( 4041 self, 4042 *expressions: t.Optional[ExpOrStr], 4043 append: bool = True, 4044 dialect: DialectType = None, 4045 copy: bool = True, 4046 **opts, 4047 ) -> Select: 4048 """ 4049 Set the SORT BY expression. 4050 4051 Example: 4052 >>> Select().from_("tbl").select("x").sort_by("x DESC").sql(dialect="hive") 4053 'SELECT x FROM tbl SORT BY x DESC' 4054 4055 Args: 4056 *expressions: the SQL code strings to parse. 4057 If a `Group` instance is passed, this is used as-is. 4058 If another `Expression` instance is passed, it will be wrapped in a `SORT`. 4059 append: if `True`, add to any existing expressions. 4060 Otherwise, this flattens all the `Order` expression into a single expression. 4061 dialect: the dialect used to parse the input expression. 4062 copy: if `False`, modify this expression instance in-place. 4063 opts: other options to use to parse the input expressions. 4064 4065 Returns: 4066 The modified Select expression. 4067 """ 4068 return _apply_child_list_builder( 4069 *expressions, 4070 instance=self, 4071 arg="sort", 4072 append=append, 4073 copy=copy, 4074 prefix="SORT BY", 4075 into=Sort, 4076 dialect=dialect, 4077 **opts, 4078 ) 4079 4080 def cluster_by( 4081 self, 4082 *expressions: t.Optional[ExpOrStr], 4083 append: bool = True, 4084 dialect: DialectType = None, 4085 copy: bool = True, 4086 **opts, 4087 ) -> Select: 4088 """ 4089 Set the CLUSTER BY expression. 4090 4091 Example: 4092 >>> Select().from_("tbl").select("x").cluster_by("x DESC").sql(dialect="hive") 4093 'SELECT x FROM tbl CLUSTER BY x DESC' 4094 4095 Args: 4096 *expressions: the SQL code strings to parse. 4097 If a `Group` instance is passed, this is used as-is. 4098 If another `Expression` instance is passed, it will be wrapped in a `Cluster`. 4099 append: if `True`, add to any existing expressions. 4100 Otherwise, this flattens all the `Order` expression into a single expression. 4101 dialect: the dialect used to parse the input expression. 4102 copy: if `False`, modify this expression instance in-place. 4103 opts: other options to use to parse the input expressions. 4104 4105 Returns: 4106 The modified Select expression. 4107 """ 4108 return _apply_child_list_builder( 4109 *expressions, 4110 instance=self, 4111 arg="cluster", 4112 append=append, 4113 copy=copy, 4114 prefix="CLUSTER BY", 4115 into=Cluster, 4116 dialect=dialect, 4117 **opts, 4118 ) 4119 4120 def select( 4121 self, 4122 *expressions: t.Optional[ExpOrStr], 4123 append: bool = True, 4124 dialect: DialectType = None, 4125 copy: bool = True, 4126 **opts, 4127 ) -> Select: 4128 return _apply_list_builder( 4129 *expressions, 4130 instance=self, 4131 arg="expressions", 4132 append=append, 4133 dialect=dialect, 4134 into=Expression, 4135 copy=copy, 4136 **opts, 4137 ) 4138 4139 def lateral( 4140 self, 4141 *expressions: t.Optional[ExpOrStr], 4142 append: bool = True, 4143 dialect: DialectType = None, 4144 copy: bool = True, 4145 **opts, 4146 ) -> Select: 4147 """ 4148 Append to or set the LATERAL expressions. 4149 4150 Example: 4151 >>> Select().select("x").lateral("OUTER explode(y) tbl2 AS z").from_("tbl").sql() 4152 'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z' 4153 4154 Args: 4155 *expressions: the SQL code strings to parse. 4156 If an `Expression` instance is passed, it will be used as-is. 4157 append: if `True`, add to any existing expressions. 4158 Otherwise, this resets the expressions. 4159 dialect: the dialect used to parse the input expressions. 4160 copy: if `False`, modify this expression instance in-place. 4161 opts: other options to use to parse the input expressions. 4162 4163 Returns: 4164 The modified Select expression. 4165 """ 4166 return _apply_list_builder( 4167 *expressions, 4168 instance=self, 4169 arg="laterals", 4170 append=append, 4171 into=Lateral, 4172 prefix="LATERAL VIEW", 4173 dialect=dialect, 4174 copy=copy, 4175 **opts, 4176 ) 4177 4178 def join( 4179 self, 4180 expression: ExpOrStr, 4181 on: t.Optional[ExpOrStr] = None, 4182 using: t.Optional[ExpOrStr | t.Collection[ExpOrStr]] = None, 4183 append: bool = True, 4184 join_type: t.Optional[str] = None, 4185 join_alias: t.Optional[Identifier | str] = None, 4186 dialect: DialectType = None, 4187 copy: bool = True, 4188 **opts, 4189 ) -> Select: 4190 """ 4191 Append to or set the JOIN expressions. 4192 4193 Example: 4194 >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y").sql() 4195 'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y' 4196 4197 >>> Select().select("1").from_("a").join("b", using=["x", "y", "z"]).sql() 4198 'SELECT 1 FROM a JOIN b USING (x, y, z)' 4199 4200 Use `join_type` to change the type of join: 4201 4202 >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y", join_type="left outer").sql() 4203 'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y' 4204 4205 Args: 4206 expression: the SQL code string to parse. 4207 If an `Expression` instance is passed, it will be used as-is. 4208 on: optionally specify the join "on" criteria as a SQL string. 4209 If an `Expression` instance is passed, it will be used as-is. 4210 using: optionally specify the join "using" criteria as a SQL string. 4211 If an `Expression` instance is passed, it will be used as-is. 4212 append: if `True`, add to any existing expressions. 4213 Otherwise, this resets the expressions. 4214 join_type: if set, alter the parsed join type. 4215 join_alias: an optional alias for the joined source. 4216 dialect: the dialect used to parse the input expressions. 4217 copy: if `False`, modify this expression instance in-place. 4218 opts: other options to use to parse the input expressions. 4219 4220 Returns: 4221 Select: the modified expression. 4222 """ 4223 parse_args: t.Dict[str, t.Any] = {"dialect": dialect, **opts} 4224 4225 try: 4226 expression = maybe_parse(expression, into=Join, prefix="JOIN", **parse_args) 4227 except ParseError: 4228 expression = maybe_parse(expression, into=(Join, Expression), **parse_args) 4229 4230 join = expression if isinstance(expression, Join) else Join(this=expression) 4231 4232 if isinstance(join.this, Select): 4233 join.this.replace(join.this.subquery()) 4234 4235 if join_type: 4236 method: t.Optional[Token] 4237 side: t.Optional[Token] 4238 kind: t.Optional[Token] 4239 4240 method, side, kind = maybe_parse(join_type, into="JOIN_TYPE", **parse_args) # type: ignore 4241 4242 if method: 4243 join.set("method", method.text) 4244 if side: 4245 join.set("side", side.text) 4246 if kind: 4247 join.set("kind", kind.text) 4248 4249 if on: 4250 on = and_(*ensure_list(on), dialect=dialect, copy=copy, **opts) 4251 join.set("on", on) 4252 4253 if using: 4254 join = _apply_list_builder( 4255 *ensure_list(using), 4256 instance=join, 4257 arg="using", 4258 append=append, 4259 copy=copy, 4260 into=Identifier, 4261 **opts, 4262 ) 4263 4264 if join_alias: 4265 join.set("this", alias_(join.this, join_alias, table=True)) 4266 4267 return _apply_list_builder( 4268 join, 4269 instance=self, 4270 arg="joins", 4271 append=append, 4272 copy=copy, 4273 **opts, 4274 ) 4275 4276 def having( 4277 self, 4278 *expressions: t.Optional[ExpOrStr], 4279 append: bool = True, 4280 dialect: DialectType = None, 4281 copy: bool = True, 4282 **opts, 4283 ) -> Select: 4284 """ 4285 Append to or set the HAVING expressions. 4286 4287 Example: 4288 >>> Select().select("x", "COUNT(y)").from_("tbl").group_by("x").having("COUNT(y) > 3").sql() 4289 'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3' 4290 4291 Args: 4292 *expressions: the SQL code strings to parse. 4293 If an `Expression` instance is passed, it will be used as-is. 4294 Multiple expressions are combined with an AND operator. 4295 append: if `True`, AND the new expressions to any existing expression. 4296 Otherwise, this resets the expression. 4297 dialect: the dialect used to parse the input expressions. 4298 copy: if `False`, modify this expression instance in-place. 4299 opts: other options to use to parse the input expressions. 4300 4301 Returns: 4302 The modified Select expression. 4303 """ 4304 return _apply_conjunction_builder( 4305 *expressions, 4306 instance=self, 4307 arg="having", 4308 append=append, 4309 into=Having, 4310 dialect=dialect, 4311 copy=copy, 4312 **opts, 4313 ) 4314 4315 def window( 4316 self, 4317 *expressions: t.Optional[ExpOrStr], 4318 append: bool = True, 4319 dialect: DialectType = None, 4320 copy: bool = True, 4321 **opts, 4322 ) -> Select: 4323 return _apply_list_builder( 4324 *expressions, 4325 instance=self, 4326 arg="windows", 4327 append=append, 4328 into=Window, 4329 dialect=dialect, 4330 copy=copy, 4331 **opts, 4332 ) 4333 4334 def qualify( 4335 self, 4336 *expressions: t.Optional[ExpOrStr], 4337 append: bool = True, 4338 dialect: DialectType = None, 4339 copy: bool = True, 4340 **opts, 4341 ) -> Select: 4342 return _apply_conjunction_builder( 4343 *expressions, 4344 instance=self, 4345 arg="qualify", 4346 append=append, 4347 into=Qualify, 4348 dialect=dialect, 4349 copy=copy, 4350 **opts, 4351 ) 4352 4353 def distinct( 4354 self, *ons: t.Optional[ExpOrStr], distinct: bool = True, copy: bool = True 4355 ) -> Select: 4356 """ 4357 Set the OFFSET expression. 4358 4359 Example: 4360 >>> Select().from_("tbl").select("x").distinct().sql() 4361 'SELECT DISTINCT x FROM tbl' 4362 4363 Args: 4364 ons: the expressions to distinct on 4365 distinct: whether the Select should be distinct 4366 copy: if `False`, modify this expression instance in-place. 4367 4368 Returns: 4369 Select: the modified expression. 4370 """ 4371 instance = maybe_copy(self, copy) 4372 on = Tuple(expressions=[maybe_parse(on, copy=copy) for on in ons if on]) if ons else None 4373 instance.set("distinct", Distinct(on=on) if distinct else None) 4374 return instance 4375 4376 def ctas( 4377 self, 4378 table: ExpOrStr, 4379 properties: t.Optional[t.Dict] = None, 4380 dialect: DialectType = None, 4381 copy: bool = True, 4382 **opts, 4383 ) -> Create: 4384 """ 4385 Convert this expression to a CREATE TABLE AS statement. 4386 4387 Example: 4388 >>> Select().select("*").from_("tbl").ctas("x").sql() 4389 'CREATE TABLE x AS SELECT * FROM tbl' 4390 4391 Args: 4392 table: the SQL code string to parse as the table name. 4393 If another `Expression` instance is passed, it will be used as-is. 4394 properties: an optional mapping of table properties 4395 dialect: the dialect used to parse the input table. 4396 copy: if `False`, modify this expression instance in-place. 4397 opts: other options to use to parse the input table. 4398 4399 Returns: 4400 The new Create expression. 4401 """ 4402 instance = maybe_copy(self, copy) 4403 table_expression = maybe_parse(table, into=Table, dialect=dialect, **opts) 4404 4405 properties_expression = None 4406 if properties: 4407 properties_expression = Properties.from_dict(properties) 4408 4409 return Create( 4410 this=table_expression, 4411 kind="TABLE", 4412 expression=instance, 4413 properties=properties_expression, 4414 ) 4415 4416 def lock(self, update: bool = True, copy: bool = True) -> Select: 4417 """ 4418 Set the locking read mode for this expression. 4419 4420 Examples: 4421 >>> Select().select("x").from_("tbl").where("x = 'a'").lock().sql("mysql") 4422 "SELECT x FROM tbl WHERE x = 'a' FOR UPDATE" 4423 4424 >>> Select().select("x").from_("tbl").where("x = 'a'").lock(update=False).sql("mysql") 4425 "SELECT x FROM tbl WHERE x = 'a' FOR SHARE" 4426 4427 Args: 4428 update: if `True`, the locking type will be `FOR UPDATE`, else it will be `FOR SHARE`. 4429 copy: if `False`, modify this expression instance in-place. 4430 4431 Returns: 4432 The modified expression. 4433 """ 4434 inst = maybe_copy(self, copy) 4435 inst.set("locks", [Lock(update=update)]) 4436 4437 return inst 4438 4439 def hint(self, *hints: ExpOrStr, dialect: DialectType = None, copy: bool = True) -> Select: 4440 """ 4441 Set hints for this expression. 4442 4443 Examples: 4444 >>> Select().select("x").from_("tbl").hint("BROADCAST(y)").sql(dialect="spark") 4445 'SELECT /*+ BROADCAST(y) */ x FROM tbl' 4446 4447 Args: 4448 hints: The SQL code strings to parse as the hints. 4449 If an `Expression` instance is passed, it will be used as-is. 4450 dialect: The dialect used to parse the hints. 4451 copy: If `False`, modify this expression instance in-place. 4452 4453 Returns: 4454 The modified expression. 4455 """ 4456 inst = maybe_copy(self, copy) 4457 inst.set( 4458 "hint", Hint(expressions=[maybe_parse(h, copy=copy, dialect=dialect) for h in hints]) 4459 ) 4460 4461 return inst 4462 4463 @property 4464 def named_selects(self) -> t.List[str]: 4465 selects = [] 4466 4467 for e in self.expressions: 4468 if e.alias_or_name: 4469 selects.append(e.output_name) 4470 elif isinstance(e, Aliases): 4471 selects.extend([a.name for a in e.aliases]) 4472 return selects 4473 4474 @property 4475 def is_star(self) -> bool: 4476 return any(expression.is_star for expression in self.expressions) 4477 4478 @property 4479 def selects(self) -> t.List[Expression]: 4480 return self.expressions
3964 def from_( 3965 self, expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 3966 ) -> Select: 3967 """ 3968 Set the FROM expression. 3969 3970 Example: 3971 >>> Select().from_("tbl").select("x").sql() 3972 'SELECT x FROM tbl' 3973 3974 Args: 3975 expression : the SQL code strings to parse. 3976 If a `From` instance is passed, this is used as-is. 3977 If another `Expression` instance is passed, it will be wrapped in a `From`. 3978 dialect: the dialect used to parse the input expression. 3979 copy: if `False`, modify this expression instance in-place. 3980 opts: other options to use to parse the input expressions. 3981 3982 Returns: 3983 The modified Select expression. 3984 """ 3985 return _apply_builder( 3986 expression=expression, 3987 instance=self, 3988 arg="from_", 3989 into=From, 3990 prefix="FROM", 3991 dialect=dialect, 3992 copy=copy, 3993 **opts, 3994 )
Set the FROM expression.
Example:
Arguments:
- expression : the SQL code strings to parse.
If a
Frominstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aFrom. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
3996 def group_by( 3997 self, 3998 *expressions: t.Optional[ExpOrStr], 3999 append: bool = True, 4000 dialect: DialectType = None, 4001 copy: bool = True, 4002 **opts, 4003 ) -> Select: 4004 """ 4005 Set the GROUP BY expression. 4006 4007 Example: 4008 >>> Select().from_("tbl").select("x", "COUNT(1)").group_by("x").sql() 4009 'SELECT x, COUNT(1) FROM tbl GROUP BY x' 4010 4011 Args: 4012 *expressions: the SQL code strings to parse. 4013 If a `Group` instance is passed, this is used as-is. 4014 If another `Expression` instance is passed, it will be wrapped in a `Group`. 4015 If nothing is passed in then a group by is not applied to the expression 4016 append: if `True`, add to any existing expressions. 4017 Otherwise, this flattens all the `Group` expression into a single expression. 4018 dialect: the dialect used to parse the input expression. 4019 copy: if `False`, modify this expression instance in-place. 4020 opts: other options to use to parse the input expressions. 4021 4022 Returns: 4023 The modified Select expression. 4024 """ 4025 if not expressions: 4026 return self if not copy else self.copy() 4027 4028 return _apply_child_list_builder( 4029 *expressions, 4030 instance=self, 4031 arg="group", 4032 append=append, 4033 copy=copy, 4034 prefix="GROUP BY", 4035 into=Group, 4036 dialect=dialect, 4037 **opts, 4038 )
Set the GROUP BY expression.
Example:
Arguments:
- *expressions: the SQL code strings to parse.
If a
Groupinstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aGroup. If nothing is passed in then a group by is not applied to the expression - append: if
True, add to any existing expressions. Otherwise, this flattens all theGroupexpression into a single expression. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
4040 def sort_by( 4041 self, 4042 *expressions: t.Optional[ExpOrStr], 4043 append: bool = True, 4044 dialect: DialectType = None, 4045 copy: bool = True, 4046 **opts, 4047 ) -> Select: 4048 """ 4049 Set the SORT BY expression. 4050 4051 Example: 4052 >>> Select().from_("tbl").select("x").sort_by("x DESC").sql(dialect="hive") 4053 'SELECT x FROM tbl SORT BY x DESC' 4054 4055 Args: 4056 *expressions: the SQL code strings to parse. 4057 If a `Group` instance is passed, this is used as-is. 4058 If another `Expression` instance is passed, it will be wrapped in a `SORT`. 4059 append: if `True`, add to any existing expressions. 4060 Otherwise, this flattens all the `Order` expression into a single expression. 4061 dialect: the dialect used to parse the input expression. 4062 copy: if `False`, modify this expression instance in-place. 4063 opts: other options to use to parse the input expressions. 4064 4065 Returns: 4066 The modified Select expression. 4067 """ 4068 return _apply_child_list_builder( 4069 *expressions, 4070 instance=self, 4071 arg="sort", 4072 append=append, 4073 copy=copy, 4074 prefix="SORT BY", 4075 into=Sort, 4076 dialect=dialect, 4077 **opts, 4078 )
Set the SORT BY expression.
Example:
Arguments:
- *expressions: the SQL code strings to parse.
If a
Groupinstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aSORT. - append: if
True, add to any existing expressions. Otherwise, this flattens all theOrderexpression into a single expression. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
4080 def cluster_by( 4081 self, 4082 *expressions: t.Optional[ExpOrStr], 4083 append: bool = True, 4084 dialect: DialectType = None, 4085 copy: bool = True, 4086 **opts, 4087 ) -> Select: 4088 """ 4089 Set the CLUSTER BY expression. 4090 4091 Example: 4092 >>> Select().from_("tbl").select("x").cluster_by("x DESC").sql(dialect="hive") 4093 'SELECT x FROM tbl CLUSTER BY x DESC' 4094 4095 Args: 4096 *expressions: the SQL code strings to parse. 4097 If a `Group` instance is passed, this is used as-is. 4098 If another `Expression` instance is passed, it will be wrapped in a `Cluster`. 4099 append: if `True`, add to any existing expressions. 4100 Otherwise, this flattens all the `Order` expression into a single expression. 4101 dialect: the dialect used to parse the input expression. 4102 copy: if `False`, modify this expression instance in-place. 4103 opts: other options to use to parse the input expressions. 4104 4105 Returns: 4106 The modified Select expression. 4107 """ 4108 return _apply_child_list_builder( 4109 *expressions, 4110 instance=self, 4111 arg="cluster", 4112 append=append, 4113 copy=copy, 4114 prefix="CLUSTER BY", 4115 into=Cluster, 4116 dialect=dialect, 4117 **opts, 4118 )
Set the CLUSTER BY expression.
Example:
Arguments:
- *expressions: the SQL code strings to parse.
If a
Groupinstance is passed, this is used as-is. If anotherExpressioninstance is passed, it will be wrapped in aCluster. - append: if
True, add to any existing expressions. Otherwise, this flattens all theOrderexpression into a single expression. - dialect: the dialect used to parse the input expression.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
4120 def select( 4121 self, 4122 *expressions: t.Optional[ExpOrStr], 4123 append: bool = True, 4124 dialect: DialectType = None, 4125 copy: bool = True, 4126 **opts, 4127 ) -> Select: 4128 return _apply_list_builder( 4129 *expressions, 4130 instance=self, 4131 arg="expressions", 4132 append=append, 4133 dialect=dialect, 4134 into=Expression, 4135 copy=copy, 4136 **opts, 4137 )
Append to or set the SELECT expressions.
Example:
>>> Select().select("x", "y").sql() 'SELECT x, y'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Query expression.
4139 def lateral( 4140 self, 4141 *expressions: t.Optional[ExpOrStr], 4142 append: bool = True, 4143 dialect: DialectType = None, 4144 copy: bool = True, 4145 **opts, 4146 ) -> Select: 4147 """ 4148 Append to or set the LATERAL expressions. 4149 4150 Example: 4151 >>> Select().select("x").lateral("OUTER explode(y) tbl2 AS z").from_("tbl").sql() 4152 'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z' 4153 4154 Args: 4155 *expressions: the SQL code strings to parse. 4156 If an `Expression` instance is passed, it will be used as-is. 4157 append: if `True`, add to any existing expressions. 4158 Otherwise, this resets the expressions. 4159 dialect: the dialect used to parse the input expressions. 4160 copy: if `False`, modify this expression instance in-place. 4161 opts: other options to use to parse the input expressions. 4162 4163 Returns: 4164 The modified Select expression. 4165 """ 4166 return _apply_list_builder( 4167 *expressions, 4168 instance=self, 4169 arg="laterals", 4170 append=append, 4171 into=Lateral, 4172 prefix="LATERAL VIEW", 4173 dialect=dialect, 4174 copy=copy, 4175 **opts, 4176 )
Append to or set the LATERAL expressions.
Example:
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
4178 def join( 4179 self, 4180 expression: ExpOrStr, 4181 on: t.Optional[ExpOrStr] = None, 4182 using: t.Optional[ExpOrStr | t.Collection[ExpOrStr]] = None, 4183 append: bool = True, 4184 join_type: t.Optional[str] = None, 4185 join_alias: t.Optional[Identifier | str] = None, 4186 dialect: DialectType = None, 4187 copy: bool = True, 4188 **opts, 4189 ) -> Select: 4190 """ 4191 Append to or set the JOIN expressions. 4192 4193 Example: 4194 >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y").sql() 4195 'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y' 4196 4197 >>> Select().select("1").from_("a").join("b", using=["x", "y", "z"]).sql() 4198 'SELECT 1 FROM a JOIN b USING (x, y, z)' 4199 4200 Use `join_type` to change the type of join: 4201 4202 >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y", join_type="left outer").sql() 4203 'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y' 4204 4205 Args: 4206 expression: the SQL code string to parse. 4207 If an `Expression` instance is passed, it will be used as-is. 4208 on: optionally specify the join "on" criteria as a SQL string. 4209 If an `Expression` instance is passed, it will be used as-is. 4210 using: optionally specify the join "using" criteria as a SQL string. 4211 If an `Expression` instance is passed, it will be used as-is. 4212 append: if `True`, add to any existing expressions. 4213 Otherwise, this resets the expressions. 4214 join_type: if set, alter the parsed join type. 4215 join_alias: an optional alias for the joined source. 4216 dialect: the dialect used to parse the input expressions. 4217 copy: if `False`, modify this expression instance in-place. 4218 opts: other options to use to parse the input expressions. 4219 4220 Returns: 4221 Select: the modified expression. 4222 """ 4223 parse_args: t.Dict[str, t.Any] = {"dialect": dialect, **opts} 4224 4225 try: 4226 expression = maybe_parse(expression, into=Join, prefix="JOIN", **parse_args) 4227 except ParseError: 4228 expression = maybe_parse(expression, into=(Join, Expression), **parse_args) 4229 4230 join = expression if isinstance(expression, Join) else Join(this=expression) 4231 4232 if isinstance(join.this, Select): 4233 join.this.replace(join.this.subquery()) 4234 4235 if join_type: 4236 method: t.Optional[Token] 4237 side: t.Optional[Token] 4238 kind: t.Optional[Token] 4239 4240 method, side, kind = maybe_parse(join_type, into="JOIN_TYPE", **parse_args) # type: ignore 4241 4242 if method: 4243 join.set("method", method.text) 4244 if side: 4245 join.set("side", side.text) 4246 if kind: 4247 join.set("kind", kind.text) 4248 4249 if on: 4250 on = and_(*ensure_list(on), dialect=dialect, copy=copy, **opts) 4251 join.set("on", on) 4252 4253 if using: 4254 join = _apply_list_builder( 4255 *ensure_list(using), 4256 instance=join, 4257 arg="using", 4258 append=append, 4259 copy=copy, 4260 into=Identifier, 4261 **opts, 4262 ) 4263 4264 if join_alias: 4265 join.set("this", alias_(join.this, join_alias, table=True)) 4266 4267 return _apply_list_builder( 4268 join, 4269 instance=self, 4270 arg="joins", 4271 append=append, 4272 copy=copy, 4273 **opts, 4274 )
Append to or set the JOIN expressions.
Example:
>>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y").sql() 'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y'>>> Select().select("1").from_("a").join("b", using=["x", "y", "z"]).sql() 'SELECT 1 FROM a JOIN b USING (x, y, z)'Use
join_typeto change the type of join:
Arguments:
- expression: the SQL code string to parse.
If an
Expressioninstance is passed, it will be used as-is. - on: optionally specify the join "on" criteria as a SQL string.
If an
Expressioninstance is passed, it will be used as-is. - using: optionally specify the join "using" criteria as a SQL string.
If an
Expressioninstance is passed, it will be used as-is. - append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - join_type: if set, alter the parsed join type.
- join_alias: an optional alias for the joined source.
- dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
Select: the modified expression.
4276 def having( 4277 self, 4278 *expressions: t.Optional[ExpOrStr], 4279 append: bool = True, 4280 dialect: DialectType = None, 4281 copy: bool = True, 4282 **opts, 4283 ) -> Select: 4284 """ 4285 Append to or set the HAVING expressions. 4286 4287 Example: 4288 >>> Select().select("x", "COUNT(y)").from_("tbl").group_by("x").having("COUNT(y) > 3").sql() 4289 'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3' 4290 4291 Args: 4292 *expressions: the SQL code strings to parse. 4293 If an `Expression` instance is passed, it will be used as-is. 4294 Multiple expressions are combined with an AND operator. 4295 append: if `True`, AND the new expressions to any existing expression. 4296 Otherwise, this resets the expression. 4297 dialect: the dialect used to parse the input expressions. 4298 copy: if `False`, modify this expression instance in-place. 4299 opts: other options to use to parse the input expressions. 4300 4301 Returns: 4302 The modified Select expression. 4303 """ 4304 return _apply_conjunction_builder( 4305 *expressions, 4306 instance=self, 4307 arg="having", 4308 append=append, 4309 into=Having, 4310 dialect=dialect, 4311 copy=copy, 4312 **opts, 4313 )
Append to or set the HAVING expressions.
Example:
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. Multiple expressions are combined with an AND operator. - append: if
True, AND the new expressions to any existing expression. Otherwise, this resets the expression. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Select expression.
4315 def window( 4316 self, 4317 *expressions: t.Optional[ExpOrStr], 4318 append: bool = True, 4319 dialect: DialectType = None, 4320 copy: bool = True, 4321 **opts, 4322 ) -> Select: 4323 return _apply_list_builder( 4324 *expressions, 4325 instance=self, 4326 arg="windows", 4327 append=append, 4328 into=Window, 4329 dialect=dialect, 4330 copy=copy, 4331 **opts, 4332 )
4334 def qualify( 4335 self, 4336 *expressions: t.Optional[ExpOrStr], 4337 append: bool = True, 4338 dialect: DialectType = None, 4339 copy: bool = True, 4340 **opts, 4341 ) -> Select: 4342 return _apply_conjunction_builder( 4343 *expressions, 4344 instance=self, 4345 arg="qualify", 4346 append=append, 4347 into=Qualify, 4348 dialect=dialect, 4349 copy=copy, 4350 **opts, 4351 )
4353 def distinct( 4354 self, *ons: t.Optional[ExpOrStr], distinct: bool = True, copy: bool = True 4355 ) -> Select: 4356 """ 4357 Set the OFFSET expression. 4358 4359 Example: 4360 >>> Select().from_("tbl").select("x").distinct().sql() 4361 'SELECT DISTINCT x FROM tbl' 4362 4363 Args: 4364 ons: the expressions to distinct on 4365 distinct: whether the Select should be distinct 4366 copy: if `False`, modify this expression instance in-place. 4367 4368 Returns: 4369 Select: the modified expression. 4370 """ 4371 instance = maybe_copy(self, copy) 4372 on = Tuple(expressions=[maybe_parse(on, copy=copy) for on in ons if on]) if ons else None 4373 instance.set("distinct", Distinct(on=on) if distinct else None) 4374 return instance
Set the OFFSET expression.
Example:
Arguments:
- ons: the expressions to distinct on
- distinct: whether the Select should be distinct
- copy: if
False, modify this expression instance in-place.
Returns:
Select: the modified expression.
4376 def ctas( 4377 self, 4378 table: ExpOrStr, 4379 properties: t.Optional[t.Dict] = None, 4380 dialect: DialectType = None, 4381 copy: bool = True, 4382 **opts, 4383 ) -> Create: 4384 """ 4385 Convert this expression to a CREATE TABLE AS statement. 4386 4387 Example: 4388 >>> Select().select("*").from_("tbl").ctas("x").sql() 4389 'CREATE TABLE x AS SELECT * FROM tbl' 4390 4391 Args: 4392 table: the SQL code string to parse as the table name. 4393 If another `Expression` instance is passed, it will be used as-is. 4394 properties: an optional mapping of table properties 4395 dialect: the dialect used to parse the input table. 4396 copy: if `False`, modify this expression instance in-place. 4397 opts: other options to use to parse the input table. 4398 4399 Returns: 4400 The new Create expression. 4401 """ 4402 instance = maybe_copy(self, copy) 4403 table_expression = maybe_parse(table, into=Table, dialect=dialect, **opts) 4404 4405 properties_expression = None 4406 if properties: 4407 properties_expression = Properties.from_dict(properties) 4408 4409 return Create( 4410 this=table_expression, 4411 kind="TABLE", 4412 expression=instance, 4413 properties=properties_expression, 4414 )
Convert this expression to a CREATE TABLE AS statement.
Example:
Arguments:
- table: the SQL code string to parse as the table name.
If another
Expressioninstance is passed, it will be used as-is. - properties: an optional mapping of table properties
- dialect: the dialect used to parse the input table.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input table.
Returns:
The new Create expression.
4416 def lock(self, update: bool = True, copy: bool = True) -> Select: 4417 """ 4418 Set the locking read mode for this expression. 4419 4420 Examples: 4421 >>> Select().select("x").from_("tbl").where("x = 'a'").lock().sql("mysql") 4422 "SELECT x FROM tbl WHERE x = 'a' FOR UPDATE" 4423 4424 >>> Select().select("x").from_("tbl").where("x = 'a'").lock(update=False).sql("mysql") 4425 "SELECT x FROM tbl WHERE x = 'a' FOR SHARE" 4426 4427 Args: 4428 update: if `True`, the locking type will be `FOR UPDATE`, else it will be `FOR SHARE`. 4429 copy: if `False`, modify this expression instance in-place. 4430 4431 Returns: 4432 The modified expression. 4433 """ 4434 inst = maybe_copy(self, copy) 4435 inst.set("locks", [Lock(update=update)]) 4436 4437 return inst
Set the locking read mode for this expression.
Examples:
Arguments:
- update: if
True, the locking type will beFOR UPDATE, else it will beFOR SHARE. - copy: if
False, modify this expression instance in-place.
Returns:
The modified expression.
4439 def hint(self, *hints: ExpOrStr, dialect: DialectType = None, copy: bool = True) -> Select: 4440 """ 4441 Set hints for this expression. 4442 4443 Examples: 4444 >>> Select().select("x").from_("tbl").hint("BROADCAST(y)").sql(dialect="spark") 4445 'SELECT /*+ BROADCAST(y) */ x FROM tbl' 4446 4447 Args: 4448 hints: The SQL code strings to parse as the hints. 4449 If an `Expression` instance is passed, it will be used as-is. 4450 dialect: The dialect used to parse the hints. 4451 copy: If `False`, modify this expression instance in-place. 4452 4453 Returns: 4454 The modified expression. 4455 """ 4456 inst = maybe_copy(self, copy) 4457 inst.set( 4458 "hint", Hint(expressions=[maybe_parse(h, copy=copy, dialect=dialect) for h in hints]) 4459 ) 4460 4461 return inst
Set hints for this expression.
Examples:
Arguments:
- hints: The SQL code strings to parse as the hints.
If an
Expressioninstance is passed, it will be used as-is. - dialect: The dialect used to parse the hints.
- copy: If
False, modify this expression instance in-place.
Returns:
The modified expression.
4463 @property 4464 def named_selects(self) -> t.List[str]: 4465 selects = [] 4466 4467 for e in self.expressions: 4468 if e.alias_or_name: 4469 selects.append(e.output_name) 4470 elif isinstance(e, Aliases): 4471 selects.extend([a.name for a in e.aliases]) 4472 return selects
Returns the output names of the query's projections.
4474 @property 4475 def is_star(self) -> bool: 4476 return any(expression.is_star for expression in self.expressions)
Checks whether an expression is a star.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4486class Subquery(DerivedTable, Query): 4487 arg_types = { 4488 "this": True, 4489 "alias": False, 4490 "with_": False, 4491 **QUERY_MODIFIERS, 4492 } 4493 4494 def unnest(self): 4495 """Returns the first non subquery.""" 4496 expression = self 4497 while isinstance(expression, Subquery): 4498 expression = expression.this 4499 return expression 4500 4501 def unwrap(self) -> Subquery: 4502 expression = self 4503 while expression.same_parent and expression.is_wrapper: 4504 expression = t.cast(Subquery, expression.parent) 4505 return expression 4506 4507 def select( 4508 self, 4509 *expressions: t.Optional[ExpOrStr], 4510 append: bool = True, 4511 dialect: DialectType = None, 4512 copy: bool = True, 4513 **opts, 4514 ) -> Subquery: 4515 this = maybe_copy(self, copy) 4516 this.unnest().select(*expressions, append=append, dialect=dialect, copy=False, **opts) 4517 return this 4518 4519 @property 4520 def is_wrapper(self) -> bool: 4521 """ 4522 Whether this Subquery acts as a simple wrapper around another expression. 4523 4524 SELECT * FROM (((SELECT * FROM t))) 4525 ^ 4526 This corresponds to a "wrapper" Subquery node 4527 """ 4528 return all(v is None for k, v in self.args.items() if k != "this") 4529 4530 @property 4531 def is_star(self) -> bool: 4532 return self.this.is_star 4533 4534 @property 4535 def output_name(self) -> str: 4536 return self.alias
4494 def unnest(self): 4495 """Returns the first non subquery.""" 4496 expression = self 4497 while isinstance(expression, Subquery): 4498 expression = expression.this 4499 return expression
Returns the first non subquery.
4507 def select( 4508 self, 4509 *expressions: t.Optional[ExpOrStr], 4510 append: bool = True, 4511 dialect: DialectType = None, 4512 copy: bool = True, 4513 **opts, 4514 ) -> Subquery: 4515 this = maybe_copy(self, copy) 4516 this.unnest().select(*expressions, append=append, dialect=dialect, copy=False, **opts) 4517 return this
Append to or set the SELECT expressions.
Example:
>>> Select().select("x", "y").sql() 'SELECT x, y'
Arguments:
- *expressions: the SQL code strings to parse.
If an
Expressioninstance is passed, it will be used as-is. - append: if
True, add to any existing expressions. Otherwise, this resets the expressions. - dialect: the dialect used to parse the input expressions.
- copy: if
False, modify this expression instance in-place. - opts: other options to use to parse the input expressions.
Returns:
The modified Query expression.
4519 @property 4520 def is_wrapper(self) -> bool: 4521 """ 4522 Whether this Subquery acts as a simple wrapper around another expression. 4523 4524 SELECT * FROM (((SELECT * FROM t))) 4525 ^ 4526 This corresponds to a "wrapper" Subquery node 4527 """ 4528 return all(v is None for k, v in self.args.items() if k != "this")
Whether this Subquery acts as a simple wrapper around another expression.
SELECT * FROM (((SELECT * FROM t))) ^ This corresponds to a "wrapper" Subquery node
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4539class TableSample(Expression): 4540 arg_types = { 4541 "expressions": False, 4542 "method": False, 4543 "bucket_numerator": False, 4544 "bucket_denominator": False, 4545 "bucket_field": False, 4546 "percent": False, 4547 "rows": False, 4548 "size": False, 4549 "seed": False, 4550 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4553class Tag(Expression): 4554 """Tags are used for generating arbitrary sql like SELECT <span>x</span>.""" 4555 4556 arg_types = { 4557 "this": False, 4558 "prefix": False, 4559 "postfix": False, 4560 }
Tags are used for generating arbitrary sql like SELECT x.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4565class Pivot(Expression): 4566 arg_types = { 4567 "this": False, 4568 "alias": False, 4569 "expressions": False, 4570 "fields": False, 4571 "unpivot": False, 4572 "using": False, 4573 "group": False, 4574 "columns": False, 4575 "include_nulls": False, 4576 "default_on_null": False, 4577 "into": False, 4578 "with_": False, 4579 } 4580 4581 @property 4582 def unpivot(self) -> bool: 4583 return bool(self.args.get("unpivot")) 4584 4585 @property 4586 def fields(self) -> t.List[Expression]: 4587 return self.args.get("fields", [])
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4596class Window(Condition): 4597 arg_types = { 4598 "this": True, 4599 "partition_by": False, 4600 "order": False, 4601 "spec": False, 4602 "alias": False, 4603 "over": False, 4604 "first": False, 4605 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4608class WindowSpec(Expression): 4609 arg_types = { 4610 "kind": False, 4611 "start": False, 4612 "start_side": False, 4613 "end": False, 4614 "end_side": False, 4615 "exclude": False, 4616 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4627class Star(Expression): 4628 arg_types = {"except_": False, "replace": False, "rename": False} 4629 4630 @property 4631 def name(self) -> str: 4632 return "*" 4633 4634 @property 4635 def output_name(self) -> str: 4636 return self.name
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4649class Placeholder(Condition): 4650 arg_types = {"this": False, "kind": False, "widget": False, "jdbc": False} 4651 4652 @property 4653 def name(self) -> str: 4654 return self.this or "?"
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4657class Null(Condition): 4658 arg_types: t.Dict[str, t.Any] = {} 4659 4660 @property 4661 def name(self) -> str: 4662 return "NULL" 4663 4664 def to_py(self) -> Lit[None]: 4665 return None
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4673class DataTypeParam(Expression): 4674 arg_types = {"this": True, "expression": False} 4675 4676 @property 4677 def name(self) -> str: 4678 return self.this.name
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4683class DataType(Expression): 4684 arg_types = { 4685 "this": True, 4686 "expressions": False, 4687 "nested": False, 4688 "values": False, 4689 "prefix": False, 4690 "kind": False, 4691 "nullable": False, 4692 } 4693 4694 class Type(AutoName): 4695 ARRAY = auto() 4696 AGGREGATEFUNCTION = auto() 4697 SIMPLEAGGREGATEFUNCTION = auto() 4698 BIGDECIMAL = auto() 4699 BIGINT = auto() 4700 BIGNUM = auto() 4701 BIGSERIAL = auto() 4702 BINARY = auto() 4703 BIT = auto() 4704 BLOB = auto() 4705 BOOLEAN = auto() 4706 BPCHAR = auto() 4707 CHAR = auto() 4708 DATE = auto() 4709 DATE32 = auto() 4710 DATEMULTIRANGE = auto() 4711 DATERANGE = auto() 4712 DATETIME = auto() 4713 DATETIME2 = auto() 4714 DATETIME64 = auto() 4715 DECIMAL = auto() 4716 DECIMAL32 = auto() 4717 DECIMAL64 = auto() 4718 DECIMAL128 = auto() 4719 DECIMAL256 = auto() 4720 DECFLOAT = auto() 4721 DOUBLE = auto() 4722 DYNAMIC = auto() 4723 ENUM = auto() 4724 ENUM8 = auto() 4725 ENUM16 = auto() 4726 FILE = auto() 4727 FIXEDSTRING = auto() 4728 FLOAT = auto() 4729 GEOGRAPHY = auto() 4730 GEOGRAPHYPOINT = auto() 4731 GEOMETRY = auto() 4732 POINT = auto() 4733 RING = auto() 4734 LINESTRING = auto() 4735 MULTILINESTRING = auto() 4736 POLYGON = auto() 4737 MULTIPOLYGON = auto() 4738 HLLSKETCH = auto() 4739 HSTORE = auto() 4740 IMAGE = auto() 4741 INET = auto() 4742 INT = auto() 4743 INT128 = auto() 4744 INT256 = auto() 4745 INT4MULTIRANGE = auto() 4746 INT4RANGE = auto() 4747 INT8MULTIRANGE = auto() 4748 INT8RANGE = auto() 4749 INTERVAL = auto() 4750 IPADDRESS = auto() 4751 IPPREFIX = auto() 4752 IPV4 = auto() 4753 IPV6 = auto() 4754 JSON = auto() 4755 JSONB = auto() 4756 LIST = auto() 4757 LONGBLOB = auto() 4758 LONGTEXT = auto() 4759 LOWCARDINALITY = auto() 4760 MAP = auto() 4761 MEDIUMBLOB = auto() 4762 MEDIUMINT = auto() 4763 MEDIUMTEXT = auto() 4764 MONEY = auto() 4765 NAME = auto() 4766 NCHAR = auto() 4767 NESTED = auto() 4768 NOTHING = auto() 4769 NULL = auto() 4770 NUMMULTIRANGE = auto() 4771 NUMRANGE = auto() 4772 NVARCHAR = auto() 4773 OBJECT = auto() 4774 RANGE = auto() 4775 ROWVERSION = auto() 4776 SERIAL = auto() 4777 SET = auto() 4778 SMALLDATETIME = auto() 4779 SMALLINT = auto() 4780 SMALLMONEY = auto() 4781 SMALLSERIAL = auto() 4782 STRUCT = auto() 4783 SUPER = auto() 4784 TEXT = auto() 4785 TINYBLOB = auto() 4786 TINYTEXT = auto() 4787 TIME = auto() 4788 TIMETZ = auto() 4789 TIME_NS = auto() 4790 TIMESTAMP = auto() 4791 TIMESTAMPNTZ = auto() 4792 TIMESTAMPLTZ = auto() 4793 TIMESTAMPTZ = auto() 4794 TIMESTAMP_S = auto() 4795 TIMESTAMP_MS = auto() 4796 TIMESTAMP_NS = auto() 4797 TINYINT = auto() 4798 TSMULTIRANGE = auto() 4799 TSRANGE = auto() 4800 TSTZMULTIRANGE = auto() 4801 TSTZRANGE = auto() 4802 UBIGINT = auto() 4803 UINT = auto() 4804 UINT128 = auto() 4805 UINT256 = auto() 4806 UMEDIUMINT = auto() 4807 UDECIMAL = auto() 4808 UDOUBLE = auto() 4809 UNION = auto() 4810 UNKNOWN = auto() # Sentinel value, useful for type annotation 4811 USERDEFINED = "USER-DEFINED" 4812 USMALLINT = auto() 4813 UTINYINT = auto() 4814 UUID = auto() 4815 VARBINARY = auto() 4816 VARCHAR = auto() 4817 VARIANT = auto() 4818 VECTOR = auto() 4819 XML = auto() 4820 YEAR = auto() 4821 TDIGEST = auto() 4822 4823 STRUCT_TYPES = { 4824 Type.FILE, 4825 Type.NESTED, 4826 Type.OBJECT, 4827 Type.STRUCT, 4828 Type.UNION, 4829 } 4830 4831 ARRAY_TYPES = { 4832 Type.ARRAY, 4833 Type.LIST, 4834 } 4835 4836 NESTED_TYPES = { 4837 *STRUCT_TYPES, 4838 *ARRAY_TYPES, 4839 Type.MAP, 4840 } 4841 4842 TEXT_TYPES = { 4843 Type.CHAR, 4844 Type.NCHAR, 4845 Type.NVARCHAR, 4846 Type.TEXT, 4847 Type.VARCHAR, 4848 Type.NAME, 4849 } 4850 4851 SIGNED_INTEGER_TYPES = { 4852 Type.BIGINT, 4853 Type.INT, 4854 Type.INT128, 4855 Type.INT256, 4856 Type.MEDIUMINT, 4857 Type.SMALLINT, 4858 Type.TINYINT, 4859 } 4860 4861 UNSIGNED_INTEGER_TYPES = { 4862 Type.UBIGINT, 4863 Type.UINT, 4864 Type.UINT128, 4865 Type.UINT256, 4866 Type.UMEDIUMINT, 4867 Type.USMALLINT, 4868 Type.UTINYINT, 4869 } 4870 4871 INTEGER_TYPES = { 4872 *SIGNED_INTEGER_TYPES, 4873 *UNSIGNED_INTEGER_TYPES, 4874 Type.BIT, 4875 } 4876 4877 FLOAT_TYPES = { 4878 Type.DOUBLE, 4879 Type.FLOAT, 4880 } 4881 4882 REAL_TYPES = { 4883 *FLOAT_TYPES, 4884 Type.BIGDECIMAL, 4885 Type.DECIMAL, 4886 Type.DECIMAL32, 4887 Type.DECIMAL64, 4888 Type.DECIMAL128, 4889 Type.DECIMAL256, 4890 Type.DECFLOAT, 4891 Type.MONEY, 4892 Type.SMALLMONEY, 4893 Type.UDECIMAL, 4894 Type.UDOUBLE, 4895 } 4896 4897 NUMERIC_TYPES = { 4898 *INTEGER_TYPES, 4899 *REAL_TYPES, 4900 } 4901 4902 TEMPORAL_TYPES = { 4903 Type.DATE, 4904 Type.DATE32, 4905 Type.DATETIME, 4906 Type.DATETIME2, 4907 Type.DATETIME64, 4908 Type.SMALLDATETIME, 4909 Type.TIME, 4910 Type.TIMESTAMP, 4911 Type.TIMESTAMPNTZ, 4912 Type.TIMESTAMPLTZ, 4913 Type.TIMESTAMPTZ, 4914 Type.TIMESTAMP_MS, 4915 Type.TIMESTAMP_NS, 4916 Type.TIMESTAMP_S, 4917 Type.TIMETZ, 4918 } 4919 4920 @classmethod 4921 def build( 4922 cls, 4923 dtype: DATA_TYPE, 4924 dialect: DialectType = None, 4925 udt: bool = False, 4926 copy: bool = True, 4927 **kwargs, 4928 ) -> DataType: 4929 """ 4930 Constructs a DataType object. 4931 4932 Args: 4933 dtype: the data type of interest. 4934 dialect: the dialect to use for parsing `dtype`, in case it's a string. 4935 udt: when set to True, `dtype` will be used as-is if it can't be parsed into a 4936 DataType, thus creating a user-defined type. 4937 copy: whether to copy the data type. 4938 kwargs: additional arguments to pass in the constructor of DataType. 4939 4940 Returns: 4941 The constructed DataType object. 4942 """ 4943 from sqlglot import parse_one 4944 4945 if isinstance(dtype, str): 4946 if dtype.upper() == "UNKNOWN": 4947 return DataType(this=DataType.Type.UNKNOWN, **kwargs) 4948 4949 try: 4950 data_type_exp = parse_one( 4951 dtype, read=dialect, into=DataType, error_level=ErrorLevel.IGNORE 4952 ) 4953 except ParseError: 4954 if udt: 4955 return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs) 4956 raise 4957 elif isinstance(dtype, (Identifier, Dot)) and udt: 4958 return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs) 4959 elif isinstance(dtype, DataType.Type): 4960 data_type_exp = DataType(this=dtype) 4961 elif isinstance(dtype, DataType): 4962 return maybe_copy(dtype, copy) 4963 else: 4964 raise ValueError(f"Invalid data type: {type(dtype)}. Expected str or DataType.Type") 4965 4966 return DataType(**{**data_type_exp.args, **kwargs}) 4967 4968 def is_type(self, *dtypes: DATA_TYPE, check_nullable: bool = False) -> bool: 4969 """ 4970 Checks whether this DataType matches one of the provided data types. Nested types or precision 4971 will be compared using "structural equivalence" semantics, so e.g. array<int> != array<float>. 4972 4973 Args: 4974 dtypes: the data types to compare this DataType to. 4975 check_nullable: whether to take the NULLABLE type constructor into account for the comparison. 4976 If false, it means that NULLABLE<INT> is equivalent to INT. 4977 4978 Returns: 4979 True, if and only if there is a type in `dtypes` which is equal to this DataType. 4980 """ 4981 self_is_nullable = self.args.get("nullable") 4982 for dtype in dtypes: 4983 other_type = DataType.build(dtype, copy=False, udt=True) 4984 other_is_nullable = other_type.args.get("nullable") 4985 if ( 4986 other_type.expressions 4987 or (check_nullable and (self_is_nullable or other_is_nullable)) 4988 or self.this == DataType.Type.USERDEFINED 4989 or other_type.this == DataType.Type.USERDEFINED 4990 ): 4991 matches = self == other_type 4992 else: 4993 matches = self.this == other_type.this 4994 4995 if matches: 4996 return True 4997 return False
4920 @classmethod 4921 def build( 4922 cls, 4923 dtype: DATA_TYPE, 4924 dialect: DialectType = None, 4925 udt: bool = False, 4926 copy: bool = True, 4927 **kwargs, 4928 ) -> DataType: 4929 """ 4930 Constructs a DataType object. 4931 4932 Args: 4933 dtype: the data type of interest. 4934 dialect: the dialect to use for parsing `dtype`, in case it's a string. 4935 udt: when set to True, `dtype` will be used as-is if it can't be parsed into a 4936 DataType, thus creating a user-defined type. 4937 copy: whether to copy the data type. 4938 kwargs: additional arguments to pass in the constructor of DataType. 4939 4940 Returns: 4941 The constructed DataType object. 4942 """ 4943 from sqlglot import parse_one 4944 4945 if isinstance(dtype, str): 4946 if dtype.upper() == "UNKNOWN": 4947 return DataType(this=DataType.Type.UNKNOWN, **kwargs) 4948 4949 try: 4950 data_type_exp = parse_one( 4951 dtype, read=dialect, into=DataType, error_level=ErrorLevel.IGNORE 4952 ) 4953 except ParseError: 4954 if udt: 4955 return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs) 4956 raise 4957 elif isinstance(dtype, (Identifier, Dot)) and udt: 4958 return DataType(this=DataType.Type.USERDEFINED, kind=dtype, **kwargs) 4959 elif isinstance(dtype, DataType.Type): 4960 data_type_exp = DataType(this=dtype) 4961 elif isinstance(dtype, DataType): 4962 return maybe_copy(dtype, copy) 4963 else: 4964 raise ValueError(f"Invalid data type: {type(dtype)}. Expected str or DataType.Type") 4965 4966 return DataType(**{**data_type_exp.args, **kwargs})
Constructs a DataType object.
Arguments:
- dtype: the data type of interest.
- dialect: the dialect to use for parsing
dtype, in case it's a string. - udt: when set to True,
dtypewill be used as-is if it can't be parsed into a DataType, thus creating a user-defined type. - copy: whether to copy the data type.
- kwargs: additional arguments to pass in the constructor of DataType.
Returns:
The constructed DataType object.
4968 def is_type(self, *dtypes: DATA_TYPE, check_nullable: bool = False) -> bool: 4969 """ 4970 Checks whether this DataType matches one of the provided data types. Nested types or precision 4971 will be compared using "structural equivalence" semantics, so e.g. array<int> != array<float>. 4972 4973 Args: 4974 dtypes: the data types to compare this DataType to. 4975 check_nullable: whether to take the NULLABLE type constructor into account for the comparison. 4976 If false, it means that NULLABLE<INT> is equivalent to INT. 4977 4978 Returns: 4979 True, if and only if there is a type in `dtypes` which is equal to this DataType. 4980 """ 4981 self_is_nullable = self.args.get("nullable") 4982 for dtype in dtypes: 4983 other_type = DataType.build(dtype, copy=False, udt=True) 4984 other_is_nullable = other_type.args.get("nullable") 4985 if ( 4986 other_type.expressions 4987 or (check_nullable and (self_is_nullable or other_is_nullable)) 4988 or self.this == DataType.Type.USERDEFINED 4989 or other_type.this == DataType.Type.USERDEFINED 4990 ): 4991 matches = self == other_type 4992 else: 4993 matches = self.this == other_type.this 4994 4995 if matches: 4996 return True 4997 return False
Checks whether this DataType matches one of the provided data types. Nested types or precision
will be compared using "structural equivalence" semantics, so e.g. array
Arguments:
- dtypes: the data types to compare this DataType to.
- check_nullable: whether to take the NULLABLE type constructor into account for the comparison.
If false, it means that NULLABLE
is equivalent to INT.
Returns:
True, if and only if there is a type in
dtypeswhich is equal to this DataType.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
4694 class Type(AutoName): 4695 ARRAY = auto() 4696 AGGREGATEFUNCTION = auto() 4697 SIMPLEAGGREGATEFUNCTION = auto() 4698 BIGDECIMAL = auto() 4699 BIGINT = auto() 4700 BIGNUM = auto() 4701 BIGSERIAL = auto() 4702 BINARY = auto() 4703 BIT = auto() 4704 BLOB = auto() 4705 BOOLEAN = auto() 4706 BPCHAR = auto() 4707 CHAR = auto() 4708 DATE = auto() 4709 DATE32 = auto() 4710 DATEMULTIRANGE = auto() 4711 DATERANGE = auto() 4712 DATETIME = auto() 4713 DATETIME2 = auto() 4714 DATETIME64 = auto() 4715 DECIMAL = auto() 4716 DECIMAL32 = auto() 4717 DECIMAL64 = auto() 4718 DECIMAL128 = auto() 4719 DECIMAL256 = auto() 4720 DECFLOAT = auto() 4721 DOUBLE = auto() 4722 DYNAMIC = auto() 4723 ENUM = auto() 4724 ENUM8 = auto() 4725 ENUM16 = auto() 4726 FILE = auto() 4727 FIXEDSTRING = auto() 4728 FLOAT = auto() 4729 GEOGRAPHY = auto() 4730 GEOGRAPHYPOINT = auto() 4731 GEOMETRY = auto() 4732 POINT = auto() 4733 RING = auto() 4734 LINESTRING = auto() 4735 MULTILINESTRING = auto() 4736 POLYGON = auto() 4737 MULTIPOLYGON = auto() 4738 HLLSKETCH = auto() 4739 HSTORE = auto() 4740 IMAGE = auto() 4741 INET = auto() 4742 INT = auto() 4743 INT128 = auto() 4744 INT256 = auto() 4745 INT4MULTIRANGE = auto() 4746 INT4RANGE = auto() 4747 INT8MULTIRANGE = auto() 4748 INT8RANGE = auto() 4749 INTERVAL = auto() 4750 IPADDRESS = auto() 4751 IPPREFIX = auto() 4752 IPV4 = auto() 4753 IPV6 = auto() 4754 JSON = auto() 4755 JSONB = auto() 4756 LIST = auto() 4757 LONGBLOB = auto() 4758 LONGTEXT = auto() 4759 LOWCARDINALITY = auto() 4760 MAP = auto() 4761 MEDIUMBLOB = auto() 4762 MEDIUMINT = auto() 4763 MEDIUMTEXT = auto() 4764 MONEY = auto() 4765 NAME = auto() 4766 NCHAR = auto() 4767 NESTED = auto() 4768 NOTHING = auto() 4769 NULL = auto() 4770 NUMMULTIRANGE = auto() 4771 NUMRANGE = auto() 4772 NVARCHAR = auto() 4773 OBJECT = auto() 4774 RANGE = auto() 4775 ROWVERSION = auto() 4776 SERIAL = auto() 4777 SET = auto() 4778 SMALLDATETIME = auto() 4779 SMALLINT = auto() 4780 SMALLMONEY = auto() 4781 SMALLSERIAL = auto() 4782 STRUCT = auto() 4783 SUPER = auto() 4784 TEXT = auto() 4785 TINYBLOB = auto() 4786 TINYTEXT = auto() 4787 TIME = auto() 4788 TIMETZ = auto() 4789 TIME_NS = auto() 4790 TIMESTAMP = auto() 4791 TIMESTAMPNTZ = auto() 4792 TIMESTAMPLTZ = auto() 4793 TIMESTAMPTZ = auto() 4794 TIMESTAMP_S = auto() 4795 TIMESTAMP_MS = auto() 4796 TIMESTAMP_NS = auto() 4797 TINYINT = auto() 4798 TSMULTIRANGE = auto() 4799 TSRANGE = auto() 4800 TSTZMULTIRANGE = auto() 4801 TSTZRANGE = auto() 4802 UBIGINT = auto() 4803 UINT = auto() 4804 UINT128 = auto() 4805 UINT256 = auto() 4806 UMEDIUMINT = auto() 4807 UDECIMAL = auto() 4808 UDOUBLE = auto() 4809 UNION = auto() 4810 UNKNOWN = auto() # Sentinel value, useful for type annotation 4811 USERDEFINED = "USER-DEFINED" 4812 USMALLINT = auto() 4813 UTINYINT = auto() 4814 UUID = auto() 4815 VARBINARY = auto() 4816 VARCHAR = auto() 4817 VARIANT = auto() 4818 VECTOR = auto() 4819 XML = auto() 4820 YEAR = auto() 4821 TDIGEST = auto()
An enumeration.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5041class Alter(Expression): 5042 arg_types = { 5043 "this": False, 5044 "kind": True, 5045 "actions": True, 5046 "exists": False, 5047 "only": False, 5048 "options": False, 5049 "cluster": False, 5050 "not_valid": False, 5051 "check": False, 5052 "cascade": False, 5053 } 5054 5055 @property 5056 def kind(self) -> t.Optional[str]: 5057 kind = self.args.get("kind") 5058 return kind and kind.upper() 5059 5060 @property 5061 def actions(self) -> t.List[Expression]: 5062 return self.args.get("actions") or []
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5069class Analyze(Expression): 5070 arg_types = { 5071 "kind": False, 5072 "this": False, 5073 "options": False, 5074 "mode": False, 5075 "partition": False, 5076 "expression": False, 5077 "properties": False, 5078 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5081class AnalyzeStatistics(Expression): 5082 arg_types = { 5083 "kind": True, 5084 "option": False, 5085 "this": False, 5086 "expressions": False, 5087 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5090class AnalyzeHistogram(Expression): 5091 arg_types = { 5092 "this": True, 5093 "expressions": True, 5094 "expression": False, 5095 "update_options": False, 5096 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5115class AnalyzeValidate(Expression): 5116 arg_types = { 5117 "kind": True, 5118 "this": False, 5119 "expression": False, 5120 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5135class AddPartition(Expression): 5136 arg_types = {"this": True, "exists": False, "location": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5153class Binary(Condition): 5154 arg_types = {"this": True, "expression": True} 5155 5156 @property 5157 def left(self) -> Expression: 5158 return self.this 5159 5160 @property 5161 def right(self) -> Expression: 5162 return self.expression
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5177class BitwiseLeftShift(Binary): 5178 arg_types = {"this": True, "expression": True, "requires_int128": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5185class BitwiseRightShift(Binary): 5186 arg_types = {"this": True, "expression": True, "requires_int128": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5193class Div(Binary): 5194 arg_types = {"this": True, "expression": True, "typed": False, "safe": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5209class Dot(Binary): 5210 @property 5211 def is_star(self) -> bool: 5212 return self.expression.is_star 5213 5214 @property 5215 def name(self) -> str: 5216 return self.expression.name 5217 5218 @property 5219 def output_name(self) -> str: 5220 return self.name 5221 5222 @classmethod 5223 def build(self, expressions: t.Sequence[Expression]) -> Dot: 5224 """Build a Dot object with a sequence of expressions.""" 5225 if len(expressions) < 2: 5226 raise ValueError("Dot requires >= 2 expressions.") 5227 5228 return t.cast(Dot, reduce(lambda x, y: Dot(this=x, expression=y), expressions)) 5229 5230 @property 5231 def parts(self) -> t.List[Expression]: 5232 """Return the parts of a table / column in order catalog, db, table.""" 5233 this, *parts = self.flatten() 5234 5235 parts.reverse() 5236 5237 for arg in COLUMN_PARTS: 5238 part = this.args.get(arg) 5239 5240 if isinstance(part, Expression): 5241 parts.append(part) 5242 5243 parts.reverse() 5244 return parts
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
5222 @classmethod 5223 def build(self, expressions: t.Sequence[Expression]) -> Dot: 5224 """Build a Dot object with a sequence of expressions.""" 5225 if len(expressions) < 2: 5226 raise ValueError("Dot requires >= 2 expressions.") 5227 5228 return t.cast(Dot, reduce(lambda x, y: Dot(this=x, expression=y), expressions))
Build a Dot object with a sequence of expressions.
5230 @property 5231 def parts(self) -> t.List[Expression]: 5232 """Return the parts of a table / column in order catalog, db, table.""" 5233 this, *parts = self.flatten() 5234 5235 parts.reverse() 5236 5237 for arg in COLUMN_PARTS: 5238 part = this.args.get(arg) 5239 5240 if isinstance(part, Expression): 5241 parts.append(part) 5242 5243 parts.reverse() 5244 return parts
Return the parts of a table / column in order catalog, db, table.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- alias
- alias_column_names
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Kwarg in special functions like func(kwarg => y).
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5368class Paren(Unary): 5369 @property 5370 def output_name(self) -> str: 5371 return self.this.name
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5374class Neg(Unary): 5375 def to_py(self) -> int | Decimal: 5376 if self.is_number: 5377 return self.this.to_py() * -1 5378 return super().to_py()
5375 def to_py(self) -> int | Decimal: 5376 if self.is_number: 5377 return self.this.to_py() * -1 5378 return super().to_py()
Returns a Python object equivalent of the SQL node.
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5381class Alias(Expression): 5382 arg_types = {"this": True, "alias": False} 5383 5384 @property 5385 def output_name(self) -> str: 5386 return self.alias
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5401class Aliases(Expression): 5402 arg_types = {"this": True, "expressions": True} 5403 5404 @property 5405 def aliases(self): 5406 return self.expressions
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5422class FormatPhrase(Expression): 5423 """Format override for a column in Teradata. 5424 Can be expanded to additional dialects as needed 5425 5426 https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/SQL-Data-Types-and-Literals/Data-Type-Formats-and-Format-Phrases/FORMAT 5427 """ 5428 5429 arg_types = {"this": True, "format": True}
Format override for a column in Teradata. Can be expanded to additional dialects as needed
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5432class Between(Predicate): 5433 arg_types = {"this": True, "low": True, "high": True, "symmetric": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5436class Bracket(Condition): 5437 # https://cloud.google.com/bigquery/docs/reference/standard-sql/operators#array_subscript_operator 5438 arg_types = { 5439 "this": True, 5440 "expressions": True, 5441 "offset": False, 5442 "safe": False, 5443 "returns_list_for_maps": False, 5444 } 5445 5446 @property 5447 def output_name(self) -> str: 5448 if len(self.expressions) == 1: 5449 return self.expressions[0].output_name 5450 5451 return super().output_name
5446 @property 5447 def output_name(self) -> str: 5448 if len(self.expressions) == 1: 5449 return self.expressions[0].output_name 5450 5451 return super().output_name
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5458class In(Predicate): 5459 arg_types = { 5460 "this": True, 5461 "expressions": False, 5462 "query": False, 5463 "unnest": False, 5464 "field": False, 5465 "is_global": False, 5466 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5474class TimeUnit(Expression): 5475 """Automatically converts unit arg into a var.""" 5476 5477 arg_types = {"unit": False} 5478 5479 UNABBREVIATED_UNIT_NAME = { 5480 "D": "DAY", 5481 "H": "HOUR", 5482 "M": "MINUTE", 5483 "MS": "MILLISECOND", 5484 "NS": "NANOSECOND", 5485 "Q": "QUARTER", 5486 "S": "SECOND", 5487 "US": "MICROSECOND", 5488 "W": "WEEK", 5489 "Y": "YEAR", 5490 } 5491 5492 VAR_LIKE = (Column, Literal, Var) 5493 5494 def __init__(self, **args): 5495 unit = args.get("unit") 5496 if type(unit) in self.VAR_LIKE and not (isinstance(unit, Column) and len(unit.parts) != 1): 5497 args["unit"] = Var( 5498 this=(self.UNABBREVIATED_UNIT_NAME.get(unit.name) or unit.name).upper() 5499 ) 5500 elif isinstance(unit, Week): 5501 unit.set("this", Var(this=unit.this.name.upper())) 5502 5503 super().__init__(**args) 5504 5505 @property 5506 def unit(self) -> t.Optional[Var | IntervalSpan]: 5507 return self.args.get("unit")
Automatically converts unit arg into a var.
5494 def __init__(self, **args): 5495 unit = args.get("unit") 5496 if type(unit) in self.VAR_LIKE and not (isinstance(unit, Column) and len(unit.parts) != 1): 5497 args["unit"] = Var( 5498 this=(self.UNABBREVIATED_UNIT_NAME.get(unit.name) or unit.name).upper() 5499 ) 5500 elif isinstance(unit, Week): 5501 unit.set("this", Var(this=unit.this.name.upper())) 5502 5503 super().__init__(**args)
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5510class IntervalOp(TimeUnit): 5511 arg_types = {"unit": False, "expression": True} 5512 5513 def interval(self): 5514 return Interval( 5515 this=self.expression.copy(), 5516 unit=self.unit.copy() if self.unit else None, 5517 )
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5545class Func(Condition): 5546 """ 5547 The base class for all function expressions. 5548 5549 Attributes: 5550 is_var_len_args (bool): if set to True the last argument defined in arg_types will be 5551 treated as a variable length argument and the argument's value will be stored as a list. 5552 _sql_names (list): the SQL name (1st item in the list) and aliases (subsequent items) for this 5553 function expression. These values are used to map this node to a name during parsing as 5554 well as to provide the function's name during SQL string generation. By default the SQL 5555 name is set to the expression's class name transformed to snake case. 5556 """ 5557 5558 is_var_len_args = False 5559 5560 @classmethod 5561 def from_arg_list(cls, args): 5562 if cls.is_var_len_args: 5563 all_arg_keys = list(cls.arg_types) 5564 # If this function supports variable length argument treat the last argument as such. 5565 non_var_len_arg_keys = all_arg_keys[:-1] if cls.is_var_len_args else all_arg_keys 5566 num_non_var = len(non_var_len_arg_keys) 5567 5568 args_dict = {arg_key: arg for arg, arg_key in zip(args, non_var_len_arg_keys)} 5569 args_dict[all_arg_keys[-1]] = args[num_non_var:] 5570 else: 5571 args_dict = {arg_key: arg for arg, arg_key in zip(args, cls.arg_types)} 5572 5573 return cls(**args_dict) 5574 5575 @classmethod 5576 def sql_names(cls): 5577 if cls is Func: 5578 raise NotImplementedError( 5579 "SQL name is only supported by concrete function implementations" 5580 ) 5581 if "_sql_names" not in cls.__dict__: 5582 cls._sql_names = [camel_to_snake_case(cls.__name__)] 5583 return cls._sql_names 5584 5585 @classmethod 5586 def sql_name(cls): 5587 sql_names = cls.sql_names() 5588 assert sql_names, f"Expected non-empty 'sql_names' for Func: {cls.__name__}." 5589 return sql_names[0] 5590 5591 @classmethod 5592 def default_parser_mappings(cls): 5593 return {name: cls.from_arg_list for name in cls.sql_names()}
The base class for all function expressions.
Attributes:
- is_var_len_args (bool): if set to True the last argument defined in arg_types will be treated as a variable length argument and the argument's value will be stored as a list.
- _sql_names (list): the SQL name (1st item in the list) and aliases (subsequent items) for this function expression. These values are used to map this node to a name during parsing as well as to provide the function's name during SQL string generation. By default the SQL name is set to the expression's class name transformed to snake case.
5560 @classmethod 5561 def from_arg_list(cls, args): 5562 if cls.is_var_len_args: 5563 all_arg_keys = list(cls.arg_types) 5564 # If this function supports variable length argument treat the last argument as such. 5565 non_var_len_arg_keys = all_arg_keys[:-1] if cls.is_var_len_args else all_arg_keys 5566 num_non_var = len(non_var_len_arg_keys) 5567 5568 args_dict = {arg_key: arg for arg, arg_key in zip(args, non_var_len_arg_keys)} 5569 args_dict[all_arg_keys[-1]] = args[num_non_var:] 5570 else: 5571 args_dict = {arg_key: arg for arg, arg_key in zip(args, cls.arg_types)} 5572 5573 return cls(**args_dict)
5575 @classmethod 5576 def sql_names(cls): 5577 if cls is Func: 5578 raise NotImplementedError( 5579 "SQL name is only supported by concrete function implementations" 5580 ) 5581 if "_sql_names" not in cls.__dict__: 5582 cls._sql_names = [camel_to_snake_case(cls.__name__)] 5583 return cls._sql_names
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5771class ArrayRemove(Func): 5772 arg_types = {"this": True, "expression": True, "null_propagation": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5775class ParameterizedAgg(AggFunc): 5776 arg_types = {"this": True, "expressions": True, "params": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5783class ArgMax(AggFunc): 5784 arg_types = {"this": True, "expression": True, "count": False} 5785 _sql_names = ["ARG_MAX", "ARGMAX", "MAX_BY"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5788class ArgMin(AggFunc): 5789 arg_types = {"this": True, "expression": True, "count": False} 5790 _sql_names = ["ARG_MIN", "ARGMIN", "MIN_BY"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5793class ApproxTopK(AggFunc): 5794 arg_types = {"this": True, "expression": False, "counters": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5826class Minhash(AggFunc): 5827 arg_types = {"this": True, "expressions": True} 5828 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5837class ApproximateSimilarity(AggFunc): 5838 _sql_names = ["APPROXIMATE_SIMILARITY", "APPROXIMATE_JACCARD_INDEX"]
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5841class FarmFingerprint(Func): 5842 arg_types = {"expressions": True} 5843 is_var_len_args = True 5844 _sql_names = ["FARM_FINGERPRINT", "FARMFINGERPRINT64"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5874class Anonymous(Func): 5875 arg_types = {"this": True, "expressions": False} 5876 is_var_len_args = True 5877 5878 @property 5879 def name(self) -> str: 5880 return self.this if isinstance(self.this, str) else self.this.name
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5883class AnonymousAggFunc(AggFunc): 5884 arg_types = {"this": True, "expressions": False} 5885 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5893class CombinedParameterizedAgg(ParameterizedAgg): 5894 arg_types = {"this": True, "expressions": True, "params": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5898class HashAgg(AggFunc): 5899 arg_types = {"this": True, "expressions": False} 5900 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5905class Hll(AggFunc): 5906 arg_types = {"this": True, "expressions": False} 5907 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5910class ApproxDistinct(AggFunc): 5911 arg_types = {"this": True, "accuracy": False} 5912 _sql_names = ["APPROX_DISTINCT", "APPROX_COUNT_DISTINCT"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5919class Array(Func): 5920 arg_types = { 5921 "expressions": False, 5922 "bracket_notation": False, 5923 "struct_name_inheritance": False, 5924 } 5925 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5948class Pad(Func): 5949 arg_types = {"this": True, "expression": True, "fill_pattern": False, "is_left": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5954class ToChar(Func): 5955 arg_types = { 5956 "this": True, 5957 "format": False, 5958 "nlsparam": False, 5959 "is_numeric": False, 5960 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5969class ToNumber(Func): 5970 arg_types = { 5971 "this": True, 5972 "format": False, 5973 "nlsparam": False, 5974 "precision": False, 5975 "scale": False, 5976 "safe": False, 5977 "safe_name": False, 5978 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
5982class ToDouble(Func): 5983 arg_types = { 5984 "this": True, 5985 "format": False, 5986 "safe": False, 5987 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6007class ToFile(Func): 6008 arg_types = { 6009 "this": True, 6010 "path": False, 6011 "safe": False, 6012 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6024class Convert(Func): 6025 arg_types = {"this": True, "expression": True, "style": False, "safe": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6033class ConvertTimezone(Func): 6034 arg_types = { 6035 "source_tz": False, 6036 "target_tz": True, 6037 "timestamp": True, 6038 "options": False, 6039 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6046class GenerateSeries(Func): 6047 arg_types = {"start": True, "end": True, "step": False, "is_end_exclusive": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6070class AIAgg(AggFunc): 6071 arg_types = {"this": True, "expression": True} 6072 _sql_names = ["AI_AGG"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6079class AIClassify(Func): 6080 arg_types = {"this": True, "categories": True, "config": False} 6081 _sql_names = ["AI_CLASSIFY"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6093class ArrayAppend(Func): 6094 arg_types = {"this": True, "expression": True, "null_propagation": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6097class ArrayPrepend(Func): 6098 arg_types = {"this": True, "expression": True, "null_propagation": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6101class ArrayConcat(Func): 6102 _sql_names = ["ARRAY_CONCAT", "ARRAY_CAT"] 6103 arg_types = {"this": True, "expressions": False, "null_propagation": False} 6104 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6115class ArrayInsert(Func): 6116 arg_types = {"this": True, "position": True, "expression": True, "offset": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6119class ArrayConstructCompact(Func): 6120 arg_types = {"expressions": False} 6121 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6124class ArrayContains(Binary, Func): 6125 arg_types = {"this": True, "expression": True, "ensure_variant": False} 6126 _sql_names = ["ARRAY_CONTAINS", "ARRAY_HAS"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6133class ArrayFilter(Func): 6134 arg_types = {"this": True, "expression": True} 6135 _sql_names = ["FILTER", "ARRAY_FILTER"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6150class ArraySlice(Func): 6151 arg_types = {"this": True, "start": True, "end": False, "step": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6154class ArrayToString(Func): 6155 arg_types = {"this": True, "expression": True, "null": False} 6156 _sql_names = ["ARRAY_TO_STRING", "ARRAY_JOIN"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6159class ArrayIntersect(Func): 6160 arg_types = {"expressions": True} 6161 is_var_len_args = True 6162 _sql_names = ["ARRAY_INTERSECT", "ARRAY_INTERSECTION"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6165class StPoint(Func): 6166 arg_types = {"this": True, "expression": True, "null": False} 6167 _sql_names = ["ST_POINT", "ST_MAKEPOINT"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6170class StDistance(Func): 6171 arg_types = {"this": True, "expression": True, "use_spheroid": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6179class StringToArray(Func): 6180 arg_types = {"this": True, "expression": False, "null": False} 6181 _sql_names = ["STRING_TO_ARRAY", "SPLIT_BY_STRING", "STRTOK_TO_ARRAY"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6188class ArraySize(Func): 6189 arg_types = {"this": True, "expression": False} 6190 _sql_names = ["ARRAY_SIZE", "ARRAY_LENGTH"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6252class Case(Func): 6253 arg_types = {"this": False, "ifs": True, "default": False} 6254 6255 def when(self, condition: ExpOrStr, then: ExpOrStr, copy: bool = True, **opts) -> Case: 6256 instance = maybe_copy(self, copy) 6257 instance.append( 6258 "ifs", 6259 If( 6260 this=maybe_parse(condition, copy=copy, **opts), 6261 true=maybe_parse(then, copy=copy, **opts), 6262 ), 6263 ) 6264 return instance 6265 6266 def else_(self, condition: ExpOrStr, copy: bool = True, **opts) -> Case: 6267 instance = maybe_copy(self, copy) 6268 instance.set("default", maybe_parse(condition, copy=copy, **opts)) 6269 return instance
6255 def when(self, condition: ExpOrStr, then: ExpOrStr, copy: bool = True, **opts) -> Case: 6256 instance = maybe_copy(self, copy) 6257 instance.append( 6258 "ifs", 6259 If( 6260 this=maybe_parse(condition, copy=copy, **opts), 6261 true=maybe_parse(then, copy=copy, **opts), 6262 ), 6263 ) 6264 return instance
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6272class Cast(Func): 6273 arg_types = { 6274 "this": True, 6275 "to": True, 6276 "format": False, 6277 "safe": False, 6278 "action": False, 6279 "default": False, 6280 } 6281 6282 @property 6283 def name(self) -> str: 6284 return self.this.name 6285 6286 @property 6287 def to(self) -> DataType: 6288 return self.args["to"] 6289 6290 @property 6291 def output_name(self) -> str: 6292 return self.name 6293 6294 def is_type(self, *dtypes: DATA_TYPE) -> bool: 6295 """ 6296 Checks whether this Cast's DataType matches one of the provided data types. Nested types 6297 like arrays or structs will be compared using "structural equivalence" semantics, so e.g. 6298 array<int> != array<float>. 6299 6300 Args: 6301 dtypes: the data types to compare this Cast's DataType to. 6302 6303 Returns: 6304 True, if and only if there is a type in `dtypes` which is equal to this Cast's DataType. 6305 """ 6306 return self.to.is_type(*dtypes)
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
6294 def is_type(self, *dtypes: DATA_TYPE) -> bool: 6295 """ 6296 Checks whether this Cast's DataType matches one of the provided data types. Nested types 6297 like arrays or structs will be compared using "structural equivalence" semantics, so e.g. 6298 array<int> != array<float>. 6299 6300 Args: 6301 dtypes: the data types to compare this Cast's DataType to. 6302 6303 Returns: 6304 True, if and only if there is a type in `dtypes` which is equal to this Cast's DataType. 6305 """ 6306 return self.to.is_type(*dtypes)
Checks whether this Cast's DataType matches one of the provided data types. Nested types
like arrays or structs will be compared using "structural equivalence" semantics, so e.g.
array
Arguments:
- dtypes: the data types to compare this Cast's DataType to.
Returns:
True, if and only if there is a type in
dtypeswhich is equal to this Cast's DataType.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- alias_or_name
- type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6347class TranslateCharacters(Expression): 6348 arg_types = {"this": True, "expression": True, "with_error": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6359class Ceil(Func): 6360 arg_types = {"this": True, "decimals": False, "to": False} 6361 _sql_names = ["CEIL", "CEILING"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6364class Coalesce(Func): 6365 arg_types = {"this": True, "expressions": False, "is_nvl": False, "is_null": False} 6366 is_var_len_args = True 6367 _sql_names = ["COALESCE", "IFNULL", "NVL"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6370class Chr(Func): 6371 arg_types = {"expressions": True, "charset": False} 6372 is_var_len_args = True 6373 _sql_names = ["CHR", "CHAR"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6376class Concat(Func): 6377 arg_types = {"expressions": True, "safe": False, "coalesce": False} 6378 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6395class Count(AggFunc): 6396 arg_types = {"this": False, "expressions": False, "big_int": False} 6397 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6547class DateAdd(Func, IntervalOp): 6548 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6551class DateBin(Func, IntervalOp): 6552 arg_types = {"this": True, "expression": True, "unit": False, "zone": False, "origin": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6555class DateSub(Func, IntervalOp): 6556 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6559class DateDiff(Func, TimeUnit): 6560 _sql_names = ["DATEDIFF", "DATE_DIFF"] 6561 arg_types = { 6562 "this": True, 6563 "expression": True, 6564 "unit": False, 6565 "zone": False, 6566 "big_int": False, 6567 "date_part_boundary": False, 6568 }
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6571class DateTrunc(Func): 6572 arg_types = {"unit": True, "this": True, "zone": False, "input_type_preserved": False} 6573 6574 def __init__(self, **args): 6575 # Across most dialects it's safe to unabbreviate the unit (e.g. 'Q' -> 'QUARTER') except Oracle 6576 # https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/ROUND-and-TRUNC-Date-Functions.html 6577 unabbreviate = args.pop("unabbreviate", True) 6578 6579 unit = args.get("unit") 6580 if isinstance(unit, TimeUnit.VAR_LIKE) and not ( 6581 isinstance(unit, Column) and len(unit.parts) != 1 6582 ): 6583 unit_name = unit.name.upper() 6584 if unabbreviate and unit_name in TimeUnit.UNABBREVIATED_UNIT_NAME: 6585 unit_name = TimeUnit.UNABBREVIATED_UNIT_NAME[unit_name] 6586 6587 args["unit"] = Literal.string(unit_name) 6588 6589 super().__init__(**args) 6590 6591 @property 6592 def unit(self) -> Expression: 6593 return self.args["unit"]
6574 def __init__(self, **args): 6575 # Across most dialects it's safe to unabbreviate the unit (e.g. 'Q' -> 'QUARTER') except Oracle 6576 # https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/ROUND-and-TRUNC-Date-Functions.html 6577 unabbreviate = args.pop("unabbreviate", True) 6578 6579 unit = args.get("unit") 6580 if isinstance(unit, TimeUnit.VAR_LIKE) and not ( 6581 isinstance(unit, Column) and len(unit.parts) != 1 6582 ): 6583 unit_name = unit.name.upper() 6584 if unabbreviate and unit_name in TimeUnit.UNABBREVIATED_UNIT_NAME: 6585 unit_name = TimeUnit.UNABBREVIATED_UNIT_NAME[unit_name] 6586 6587 args["unit"] = Literal.string(unit_name) 6588 6589 super().__init__(**args)
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6602class DatetimeAdd(Func, IntervalOp): 6603 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6606class DatetimeSub(Func, IntervalOp): 6607 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6610class DatetimeDiff(Func, TimeUnit): 6611 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6614class DatetimeTrunc(Func, TimeUnit): 6615 arg_types = {"this": True, "unit": True, "zone": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6660class MonthsBetween(Func): 6661 arg_types = {"this": True, "expression": True, "roundoff": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6664class MakeInterval(Func): 6665 arg_types = { 6666 "year": False, 6667 "month": False, 6668 "week": False, 6669 "day": False, 6670 "hour": False, 6671 "minute": False, 6672 "second": False, 6673 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6676class LastDay(Func, TimeUnit): 6677 _sql_names = ["LAST_DAY", "LAST_DAY_OF_MONTH"] 6678 arg_types = {"this": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6709class Elt(Func): 6710 arg_types = {"this": True, "expressions": True} 6711 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6718class TimestampAdd(Func, TimeUnit): 6719 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6722class TimestampSub(Func, TimeUnit): 6723 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6726class TimestampDiff(Func, TimeUnit): 6727 _sql_names = ["TIMESTAMPDIFF", "TIMESTAMP_DIFF"] 6728 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6731class TimestampTrunc(Func, TimeUnit): 6732 arg_types = {"this": True, "unit": True, "zone": False, "input_type_preserved": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6735class TimeSlice(Func, TimeUnit): 6736 arg_types = {"this": True, "expression": True, "unit": True, "kind": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6739class TimeAdd(Func, TimeUnit): 6740 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6743class TimeSub(Func, TimeUnit): 6744 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6747class TimeDiff(Func, TimeUnit): 6748 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6755class DateFromParts(Func): 6756 _sql_names = ["DATE_FROM_PARTS", "DATEFROMPARTS"] 6757 arg_types = {"year": True, "month": False, "day": False, "allow_overflow": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6760class TimeFromParts(Func): 6761 _sql_names = ["TIME_FROM_PARTS", "TIMEFROMPARTS"] 6762 arg_types = { 6763 "hour": True, 6764 "min": True, 6765 "sec": True, 6766 "nano": False, 6767 "fractions": False, 6768 "precision": False, 6769 "overflow": False, 6770 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6786class Date(Func): 6787 arg_types = {"this": False, "zone": False, "expressions": False} 6788 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6805class Decrypt(Func): 6806 arg_types = { 6807 "this": True, 6808 "passphrase": True, 6809 "aad": False, 6810 "encryption_method": False, 6811 "safe": False, 6812 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6816class DecryptRaw(Func): 6817 arg_types = { 6818 "this": True, 6819 "key": True, 6820 "iv": True, 6821 "aad": False, 6822 "encryption_method": False, 6823 "aead": False, 6824 "safe": False, 6825 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6842class Encrypt(Func): 6843 arg_types = {"this": True, "passphrase": True, "aad": False, "encryption_method": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6847class EncryptRaw(Func): 6848 arg_types = {"this": True, "key": True, "iv": True, "aad": False, "encryption_method": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6864class Explode(Func, UDTF): 6865 arg_types = {"this": True, "expressions": False} 6866 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6890class Unnest(Func, UDTF): 6891 arg_types = { 6892 "expressions": True, 6893 "alias": False, 6894 "offset": False, 6895 "explode_array": False, 6896 } 6897 6898 @property 6899 def selects(self) -> t.List[Expression]: 6900 columns = super().selects 6901 offset = self.args.get("offset") 6902 if offset: 6903 columns = columns + [to_identifier("offset") if offset is True else offset] 6904 return columns
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6942class Base64Encode(Func): 6943 arg_types = {"this": True, "max_line_length": False, "alphabet": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6971class GapFill(Func): 6972 arg_types = { 6973 "this": True, 6974 "ts_column": True, 6975 "bucket_width": True, 6976 "partitioning_columns": False, 6977 "value_columns": False, 6978 "origin": False, 6979 "ignore_nulls": False, 6980 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
6998class Getbit(Func): 6999 _sql_names = ["GETBIT", "GET_BIT"] 7000 # zero_is_msb means the most significant bit is indexed 0 7001 arg_types = {"this": True, "expression": True, "zero_is_msb": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7004class Greatest(Func): 7005 arg_types = {"this": True, "expressions": False, "ignore_nulls": True} 7006 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7011class OverflowTruncateBehavior(Expression): 7012 arg_types = {"this": False, "with_count": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7015class GroupConcat(AggFunc): 7016 arg_types = {"this": True, "separator": False, "on_overflow": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7073class Xor(Connector, Func): 7074 arg_types = {"this": False, "expression": False, "expressions": False, "round_input": False} 7075 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7078class If(Func): 7079 arg_types = {"this": True, "true": True, "false": False} 7080 _sql_names = ["IF", "IIF"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7121class JSONPath(Expression): 7122 arg_types = {"expressions": True, "escape": False} 7123 7124 @property 7125 def output_name(self) -> str: 7126 last_segment = self.expressions[-1].this 7127 return last_segment if isinstance(last_segment, str) else ""
7124 @property 7125 def output_name(self) -> str: 7126 last_segment = self.expressions[-1].this 7127 return last_segment if isinstance(last_segment, str) else ""
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7154class JSONPathSlice(JSONPathPart): 7155 arg_types = {"start": False, "end": False, "step": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7178class Format(Func): 7179 arg_types = {"this": True, "expressions": False} 7180 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7183class JSONKeys(Func): 7184 arg_types = {"this": True, "expression": False, "expressions": False} 7185 is_var_len_args = True 7186 _sql_names = ["JSON_KEYS"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7194class JSONKeysAtDepth(Func): 7195 arg_types = {"this": True, "expression": False, "mode": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7198class JSONObject(Func): 7199 arg_types = { 7200 "expressions": False, 7201 "null_handling": False, 7202 "unique_keys": False, 7203 "return_type": False, 7204 "encoding": False, 7205 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7208class JSONObjectAgg(AggFunc): 7209 arg_types = { 7210 "expressions": False, 7211 "null_handling": False, 7212 "unique_keys": False, 7213 "return_type": False, 7214 "encoding": False, 7215 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7224class JSONArray(Func): 7225 arg_types = { 7226 "expressions": False, 7227 "null_handling": False, 7228 "return_type": False, 7229 "strict": False, 7230 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7234class JSONArrayAgg(AggFunc): 7235 arg_types = { 7236 "this": True, 7237 "order": False, 7238 "null_handling": False, 7239 "return_type": False, 7240 "strict": False, 7241 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7244class JSONExists(Func): 7245 arg_types = { 7246 "this": True, 7247 "path": True, 7248 "passing": False, 7249 "on_condition": False, 7250 "from_dcolonqmark": False, 7251 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7256class JSONColumnDef(Expression): 7257 arg_types = { 7258 "this": False, 7259 "kind": False, 7260 "path": False, 7261 "nested_schema": False, 7262 "ordinality": False, 7263 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7270class JSONSet(Func): 7271 arg_types = {"this": True, "expressions": True} 7272 is_var_len_args = True 7273 _sql_names = ["JSON_SET"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7277class JSONStripNulls(Func): 7278 arg_types = { 7279 "this": True, 7280 "expression": False, 7281 "include_arrays": False, 7282 "remove_empty": False, 7283 } 7284 _sql_names = ["JSON_STRIP_NULLS"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7288class JSONValue(Expression): 7289 arg_types = { 7290 "this": True, 7291 "path": True, 7292 "returning": False, 7293 "on_condition": False, 7294 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7301class JSONRemove(Func): 7302 arg_types = {"this": True, "expressions": True} 7303 is_var_len_args = True 7304 _sql_names = ["JSON_REMOVE"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7308class JSONTable(Func): 7309 arg_types = { 7310 "this": True, 7311 "schema": True, 7312 "path": False, 7313 "error_handling": False, 7314 "empty_handling": False, 7315 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7320class JSONType(Func): 7321 arg_types = {"this": True, "expression": False} 7322 _sql_names = ["JSON_TYPE"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7326class ObjectInsert(Func): 7327 arg_types = { 7328 "this": True, 7329 "key": True, 7330 "value": True, 7331 "update_flag": False, 7332 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7335class OpenJSONColumnDef(Expression): 7336 arg_types = {"this": True, "kind": True, "path": False, "as_json": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7357class JSONBExists(Func): 7358 arg_types = {"this": True, "path": True} 7359 _sql_names = ["JSONB_EXISTS"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7367class JSONExtract(Binary, Func): 7368 arg_types = { 7369 "this": True, 7370 "expression": True, 7371 "only_json_types": False, 7372 "expressions": False, 7373 "variant_extract": False, 7374 "json_query": False, 7375 "option": False, 7376 "quote": False, 7377 "on_condition": False, 7378 "requires_json": False, 7379 } 7380 _sql_names = ["JSON_EXTRACT"] 7381 is_var_len_args = True 7382 7383 @property 7384 def output_name(self) -> str: 7385 return self.expression.output_name if not self.expressions else ""
7383 @property 7384 def output_name(self) -> str: 7385 return self.expression.output_name if not self.expressions else ""
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7389class JSONExtractQuote(Expression): 7390 arg_types = { 7391 "option": True, 7392 "scalar": False, 7393 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7396class JSONExtractArray(Func): 7397 arg_types = {"this": True, "expression": False} 7398 _sql_names = ["JSON_EXTRACT_ARRAY"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7401class JSONExtractScalar(Binary, Func): 7402 arg_types = { 7403 "this": True, 7404 "expression": True, 7405 "only_json_types": False, 7406 "expressions": False, 7407 "json_type": False, 7408 "scalar_only": False, 7409 } 7410 _sql_names = ["JSON_EXTRACT_SCALAR"] 7411 is_var_len_args = True 7412 7413 @property 7414 def output_name(self) -> str: 7415 return self.expression.output_name
Name of the output column if this expression is a selection.
If the Expression has no output name, an empty string is returned.
Example:
>>> from sqlglot import parse_one >>> parse_one("SELECT a")sqlglot.expressions[0].output_name 'a' >>> parse_one("SELECT b AS c")sqlglot.expressions[0].output_name 'c' >>> parse_one("SELECT 1 + 2")sqlglot.expressions[0].output_name ''
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7422class JSONBExtractScalar(Binary, Func): 7423 arg_types = {"this": True, "expression": True, "json_type": False} 7424 _sql_names = ["JSONB_EXTRACT_SCALAR"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7427class JSONFormat(Func): 7428 arg_types = {"this": False, "options": False, "is_json": False, "to_json": False} 7429 _sql_names = ["JSON_FORMAT"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7432class JSONArrayAppend(Func): 7433 arg_types = {"this": True, "expressions": True} 7434 is_var_len_args = True 7435 _sql_names = ["JSON_ARRAY_APPEND"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7439class JSONArrayContains(Binary, Predicate, Func): 7440 arg_types = {"this": True, "expression": True, "json_type": False} 7441 _sql_names = ["JSON_ARRAY_CONTAINS"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7444class JSONArrayInsert(Func): 7445 arg_types = {"this": True, "expressions": True} 7446 is_var_len_args = True 7447 _sql_names = ["JSON_ARRAY_INSERT"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7458class ParseJSON(Func): 7459 # BigQuery, Snowflake have PARSE_JSON, Presto has JSON_PARSE 7460 # Snowflake also has TRY_PARSE_JSON, which is represented using `safe` 7461 _sql_names = ["PARSE_JSON", "JSON_PARSE"] 7462 arg_types = {"this": True, "expression": False, "safe": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7467class ParseUrl(Func): 7468 arg_types = {"this": True, "part_to_extract": False, "key": False, "permissive": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7483class Least(Func): 7484 arg_types = {"this": True, "expressions": False, "ignore_nulls": True} 7485 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7500class Length(Func): 7501 arg_types = {"this": True, "binary": False, "encoding": False} 7502 _sql_names = ["LENGTH", "LEN", "CHAR_LENGTH", "CHARACTER_LENGTH"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7513class Levenshtein(Func): 7514 arg_types = { 7515 "this": True, 7516 "expression": False, 7517 "ins_cost": False, 7518 "del_cost": False, 7519 "sub_cost": False, 7520 "max_dist": False, 7521 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7544class Map(Func): 7545 arg_types = {"keys": False, "values": False} 7546 7547 @property 7548 def keys(self) -> t.List[Expression]: 7549 keys = self.args.get("keys") 7550 return keys.expressions if keys else [] 7551 7552 @property 7553 def values(self) -> t.List[Expression]: 7554 values = self.args.get("values") 7555 return values.expressions if values else []
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7575class MapDelete(Func): 7576 arg_types = {"this": True, "expressions": True} 7577 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7580class MapInsert(Func): 7581 arg_types = {"this": True, "key": False, "value": True, "update_flag": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7588class MapPick(Func): 7589 arg_types = {"this": True, "expressions": True} 7590 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7614class VarMap(Func): 7615 arg_types = {"keys": True, "values": True} 7616 is_var_len_args = True 7617 7618 @property 7619 def keys(self) -> t.List[Expression]: 7620 return self.args["keys"].expressions 7621 7622 @property 7623 def values(self) -> t.List[Expression]: 7624 return self.args["values"].expressions
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7628class MatchAgainst(Func): 7629 arg_types = {"this": True, "expressions": True, "modifier": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7632class Max(AggFunc): 7633 arg_types = {"this": True, "expressions": False} 7634 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7644class MD5Digest(Func): 7645 arg_types = {"this": True, "expressions": False} 7646 is_var_len_args = True 7647 _sql_names = ["MD5_DIGEST"]
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7668class Min(AggFunc): 7669 arg_types = {"this": True, "expressions": False} 7670 is_var_len_args = True
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7681class AddMonths(Func): 7682 arg_types = {"this": True, "expression": True, "preserve_end_of_month": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7716class Overlay(Func): 7717 arg_types = {"this": True, "expression": True, "from_": True, "for_": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7721class Predict(Func): 7722 arg_types = {"this": True, "expression": True, "params_struct": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7726class MLTranslate(Func): 7727 arg_types = {"this": True, "expression": True, "params_struct": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7731class FeaturesAtTime(Func): 7732 arg_types = {"this": True, "time": False, "num_rows": False, "ignore_feature_nulls": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7736class GenerateEmbedding(Func): 7737 arg_types = {"this": True, "expression": True, "params_struct": False, "is_text": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7740class MLForecast(Func): 7741 arg_types = {"this": True, "expression": False, "params_struct": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7751class VectorSearch(Func): 7752 arg_types = { 7753 "this": True, 7754 "column_to_search": True, 7755 "query_table": True, 7756 "query_column_to_search": False, 7757 "top_k": False, 7758 "distance_type": False, 7759 "options": False, 7760 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7788class ApproxQuantile(Quantile): 7789 arg_types = { 7790 "this": True, 7791 "quantile": True, 7792 "accuracy": False, 7793 "weight": False, 7794 "error_tolerance": False, 7795 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7814class Rand(Func): 7815 _sql_names = ["RAND", "RANDOM"] 7816 arg_types = {"this": False, "lower": False, "upper": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7840class ReadCSV(Func): 7841 _sql_names = ["READ_CSV"] 7842 is_var_len_args = True 7843 arg_types = {"this": True, "expressions": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7851class Reduce(Func): 7852 arg_types = {"this": True, "initial": True, "merge": True, "finish": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7855class RegexpExtract(Func): 7856 arg_types = { 7857 "this": True, 7858 "expression": True, 7859 "position": False, 7860 "occurrence": False, 7861 "parameters": False, 7862 "group": False, 7863 "null_if_pos_overflow": False, # for transpilation target behavior 7864 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7867class RegexpExtractAll(Func): 7868 arg_types = { 7869 "this": True, 7870 "expression": True, 7871 "group": False, 7872 "parameters": False, 7873 "position": False, 7874 "occurrence": False, 7875 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7878class RegexpReplace(Func): 7879 arg_types = { 7880 "this": True, 7881 "expression": True, 7882 "replacement": False, 7883 "position": False, 7884 "occurrence": False, 7885 "modifiers": False, 7886 "single_replace": False, 7887 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7890class RegexpLike(Binary, Func): 7891 arg_types = {"this": True, "expression": True, "flag": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7894class RegexpILike(Binary, Func): 7895 arg_types = {"this": True, "expression": True, "flag": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7898class RegexpFullMatch(Binary, Func): 7899 arg_types = {"this": True, "expression": True, "options": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7902class RegexpInstr(Func): 7903 arg_types = { 7904 "this": True, 7905 "expression": True, 7906 "position": False, 7907 "occurrence": False, 7908 "option": False, 7909 "parameters": False, 7910 "group": False, 7911 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7920class RegexpCount(Func): 7921 arg_types = { 7922 "this": True, 7923 "expression": True, 7924 "position": False, 7925 "parameters": False, 7926 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
7988class Round(Func): 7989 arg_types = { 7990 "this": True, 7991 "decimals": False, 7992 "truncate": False, 7993 "casts_non_integer_decimals": False, 7994 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8090class Substring(Func): 8091 _sql_names = ["SUBSTRING", "SUBSTR"] 8092 arg_types = {"this": True, "start": False, "length": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8095class SubstringIndex(Func): 8096 """ 8097 SUBSTRING_INDEX(str, delim, count) 8098 8099 *count* > 0 → left slice before the *count*-th delimiter 8100 *count* < 0 → right slice after the |count|-th delimiter 8101 """ 8102 8103 arg_types = {"this": True, "delimiter": True, "count": True}
SUBSTRING_INDEX(str, delim, count)
count > 0 → left slice before the count-th delimiter count < 0 → right slice after the |count|-th delimiter
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8110class StartsWith(Func): 8111 _sql_names = ["STARTS_WITH", "STARTSWITH"] 8112 arg_types = {"this": True, "expression": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8115class EndsWith(Func): 8116 _sql_names = ["ENDS_WITH", "ENDSWITH"] 8117 arg_types = {"this": True, "expression": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8120class StrPosition(Func): 8121 arg_types = { 8122 "this": True, 8123 "substr": True, 8124 "position": False, 8125 "occurrence": False, 8126 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8131class Search(Func): 8132 arg_types = { 8133 "this": True, # data_to_search / search_data 8134 "expression": True, # search_query / search_string 8135 "json_scope": False, # BigQuery: JSON_VALUES | JSON_KEYS | JSON_KEYS_AND_VALUES 8136 "analyzer": False, # Both: analyzer / ANALYZER 8137 "analyzer_options": False, # BigQuery: analyzer_options_values 8138 "search_mode": False, # Snowflake: OR | AND 8139 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8151class StrToTime(Func): 8152 arg_types = {"this": True, "format": True, "zone": False, "safe": False, "target_type": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8163class StrToMap(Func): 8164 arg_types = { 8165 "this": True, 8166 "pair_delim": False, 8167 "key_value_delim": False, 8168 "duplicate_resolution_callback": False, 8169 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8180class Space(Func): 8181 """ 8182 SPACE(n) → string consisting of n blank characters 8183 """ 8184 8185 pass
SPACE(n) → string consisting of n blank characters
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8199class Stuff(Func): 8200 _sql_names = ["STUFF", "INSERT"] 8201 arg_types = {"this": True, "start": True, "length": True, "expression": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8229class TimeToStr(Func): 8230 arg_types = {"this": True, "format": True, "culture": False, "zone": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8253class Trim(Func): 8254 arg_types = { 8255 "this": True, 8256 "expression": False, 8257 "position": False, 8258 "collation": False, 8259 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8262class TsOrDsAdd(Func, TimeUnit): 8263 # return_type is used to correctly cast the arguments of this expression when transpiling it 8264 arg_types = {"this": True, "expression": True, "unit": False, "return_type": False} 8265 8266 @property 8267 def return_type(self) -> DataType: 8268 return DataType.build(self.args.get("return_type") or DataType.Type.DATE)
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8271class TsOrDsDiff(Func, TimeUnit): 8272 arg_types = {"this": True, "expression": True, "unit": False}
Inherited Members
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8307class Uniform(Func): 8308 arg_types = {"this": True, "expression": True, "gen": False, "seed": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8322class UnixToTime(Func): 8323 arg_types = { 8324 "this": True, 8325 "scale": False, 8326 "zone": False, 8327 "hours": False, 8328 "minutes": False, 8329 "format": False, 8330 "target_type": False, 8331 } 8332 8333 SECONDS = Literal.number(0) 8334 DECIS = Literal.number(1) 8335 CENTIS = Literal.number(2) 8336 MILLIS = Literal.number(3) 8337 DECIMILLIS = Literal.number(4) 8338 CENTIMILLIS = Literal.number(5) 8339 MICROS = Literal.number(6) 8340 DECIMICROS = Literal.number(7) 8341 CENTIMICROS = Literal.number(8) 8342 NANOS = Literal.number(9)
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8361class Uuid(Func): 8362 _sql_names = ["UUID", "GEN_RANDOM_UUID", "GENERATE_UUID", "UUID_STRING"] 8363 8364 arg_types = {"this": False, "name": False, "is_string": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8378class TimestampFromParts(Func): 8379 _sql_names = ["TIMESTAMP_FROM_PARTS", "TIMESTAMPFROMPARTS"] 8380 arg_types = { 8381 **TIMESTAMP_PARTS, 8382 "zone": False, 8383 "milli": False, 8384 "this": False, 8385 "expression": False, 8386 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8389class TimestampLtzFromParts(Func): 8390 _sql_names = ["TIMESTAMP_LTZ_FROM_PARTS", "TIMESTAMPLTZFROMPARTS"] 8391 arg_types = TIMESTAMP_PARTS.copy()
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8394class TimestampTzFromParts(Func): 8395 _sql_names = ["TIMESTAMP_TZ_FROM_PARTS", "TIMESTAMPTZFROMPARTS"] 8396 arg_types = { 8397 **TIMESTAMP_PARTS, 8398 "zone": False, 8399 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8406class Corr(Binary, AggFunc): 8407 # Correlation divides by variance(column). If a column has 0 variance, the denominator 8408 # is 0 - some dialects return NaN (DuckDB) while others return NULL (Snowflake). 8409 # `null_on_zero_variance` is set to True at parse time for dialects that return NULL. 8410 arg_types = {"this": True, "expression": True, "null_on_zero_variance": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8435class WidthBucket(Func): 8436 arg_types = { 8437 "this": True, 8438 "min_value": False, 8439 "max_value": False, 8440 "num_buckets": False, 8441 "threshold": False, 8442 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8465class XMLElement(Func): 8466 _sql_names = ["XMLELEMENT"] 8467 arg_types = {"this": True, "expressions": False, "evalname": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8470class XMLGet(Func): 8471 _sql_names = ["XMLGET"] 8472 arg_types = {"this": True, "expression": True, "instance": False}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8475class XMLTable(Func): 8476 arg_types = { 8477 "this": True, 8478 "namespaces": False, 8479 "passing": False, 8480 "columns": False, 8481 "by_ref": False, 8482 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8506class Merge(DML): 8507 arg_types = { 8508 "this": True, 8509 "using": True, 8510 "on": False, 8511 "using_cond": False, 8512 "whens": True, 8513 "with_": False, 8514 "returning": False, 8515 }
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8518class When(Expression): 8519 arg_types = {"matched": True, "source": False, "condition": False, "then": True}
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8522class Whens(Expression): 8523 """Wraps around one or more WHEN [NOT] MATCHED [...] clauses.""" 8524 8525 arg_types = {"expressions": True}
Wraps around one or more WHEN [NOT] MATCHED [...] clauses.
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
Inherited Members
- Expression
- Expression
- arg_types
- args
- parent
- arg_key
- index
- comments
- this
- expression
- expressions
- text
- is_string
- is_number
- to_py
- is_int
- is_star
- alias
- alias_column_names
- name
- alias_or_name
- output_name
- type
- is_type
- is_leaf
- meta
- copy
- add_comments
- pop_comments
- append
- set
- depth
- iter_expressions
- find
- find_all
- find_ancestor
- parent_select
- same_parent
- root
- walk
- dfs
- bfs
- unnest
- unalias
- unnest_operands
- flatten
- to_s
- sql
- transform
- replace
- pop
- assert_is
- error_messages
- dump
- load
- and_
- or_
- not_
- update_positions
- as_
- isin
- between
- is_
- like
- ilike
- eq
- neq
- rlike
- div
- asc
- desc
8585def maybe_parse( 8586 sql_or_expression: ExpOrStr, 8587 *, 8588 into: t.Optional[IntoType] = None, 8589 dialect: DialectType = None, 8590 prefix: t.Optional[str] = None, 8591 copy: bool = False, 8592 **opts, 8593) -> Expression: 8594 """Gracefully handle a possible string or expression. 8595 8596 Example: 8597 >>> maybe_parse("1") 8598 Literal(this=1, is_string=False) 8599 >>> maybe_parse(to_identifier("x")) 8600 Identifier(this=x, quoted=False) 8601 8602 Args: 8603 sql_or_expression: the SQL code string or an expression 8604 into: the SQLGlot Expression to parse into 8605 dialect: the dialect used to parse the input expressions (in the case that an 8606 input expression is a SQL string). 8607 prefix: a string to prefix the sql with before it gets parsed 8608 (automatically includes a space) 8609 copy: whether to copy the expression. 8610 **opts: other options to use to parse the input expressions (again, in the case 8611 that an input expression is a SQL string). 8612 8613 Returns: 8614 Expression: the parsed or given expression. 8615 """ 8616 if isinstance(sql_or_expression, Expression): 8617 if copy: 8618 return sql_or_expression.copy() 8619 return sql_or_expression 8620 8621 if sql_or_expression is None: 8622 raise ParseError("SQL cannot be None") 8623 8624 import sqlglot 8625 8626 sql = str(sql_or_expression) 8627 if prefix: 8628 sql = f"{prefix} {sql}" 8629 8630 return sqlglot.parse_one(sql, read=dialect, into=into, **opts)
Gracefully handle a possible string or expression.
Example:
>>> maybe_parse("1") Literal(this=1, is_string=False) >>> maybe_parse(to_identifier("x")) Identifier(this=x, quoted=False)
Arguments:
- sql_or_expression: the SQL code string or an expression
- into: the SQLGlot Expression to parse into
- dialect: the dialect used to parse the input expressions (in the case that an input expression is a SQL string).
- prefix: a string to prefix the sql with before it gets parsed (automatically includes a space)
- copy: whether to copy the expression.
- **opts: other options to use to parse the input expressions (again, in the case that an input expression is a SQL string).
Returns:
Expression: the parsed or given expression.
8897def union( 8898 *expressions: ExpOrStr, 8899 distinct: bool = True, 8900 dialect: DialectType = None, 8901 copy: bool = True, 8902 **opts, 8903) -> Union: 8904 """ 8905 Initializes a syntax tree for the `UNION` operation. 8906 8907 Example: 8908 >>> union("SELECT * FROM foo", "SELECT * FROM bla").sql() 8909 'SELECT * FROM foo UNION SELECT * FROM bla' 8910 8911 Args: 8912 expressions: the SQL code strings, corresponding to the `UNION`'s operands. 8913 If `Expression` instances are passed, they will be used as-is. 8914 distinct: set the DISTINCT flag if and only if this is true. 8915 dialect: the dialect used to parse the input expression. 8916 copy: whether to copy the expression. 8917 opts: other options to use to parse the input expressions. 8918 8919 Returns: 8920 The new Union instance. 8921 """ 8922 assert len(expressions) >= 2, "At least two expressions are required by `union`." 8923 return _apply_set_operation( 8924 *expressions, set_operation=Union, distinct=distinct, dialect=dialect, copy=copy, **opts 8925 )
Initializes a syntax tree for the UNION operation.
Example:
>>> union("SELECT * FROM foo", "SELECT * FROM bla").sql() 'SELECT * FROM foo UNION SELECT * FROM bla'
Arguments:
- expressions: the SQL code strings, corresponding to the
UNION's operands. IfExpressioninstances are passed, they will be used as-is. - distinct: set the DISTINCT flag if and only if this is true.
- dialect: the dialect used to parse the input expression.
- copy: whether to copy the expression.
- opts: other options to use to parse the input expressions.
Returns:
The new Union instance.
8928def intersect( 8929 *expressions: ExpOrStr, 8930 distinct: bool = True, 8931 dialect: DialectType = None, 8932 copy: bool = True, 8933 **opts, 8934) -> Intersect: 8935 """ 8936 Initializes a syntax tree for the `INTERSECT` operation. 8937 8938 Example: 8939 >>> intersect("SELECT * FROM foo", "SELECT * FROM bla").sql() 8940 'SELECT * FROM foo INTERSECT SELECT * FROM bla' 8941 8942 Args: 8943 expressions: the SQL code strings, corresponding to the `INTERSECT`'s operands. 8944 If `Expression` instances are passed, they will be used as-is. 8945 distinct: set the DISTINCT flag if and only if this is true. 8946 dialect: the dialect used to parse the input expression. 8947 copy: whether to copy the expression. 8948 opts: other options to use to parse the input expressions. 8949 8950 Returns: 8951 The new Intersect instance. 8952 """ 8953 assert len(expressions) >= 2, "At least two expressions are required by `intersect`." 8954 return _apply_set_operation( 8955 *expressions, set_operation=Intersect, distinct=distinct, dialect=dialect, copy=copy, **opts 8956 )
Initializes a syntax tree for the INTERSECT operation.
Example:
>>> intersect("SELECT * FROM foo", "SELECT * FROM bla").sql() 'SELECT * FROM foo INTERSECT SELECT * FROM bla'
Arguments:
- expressions: the SQL code strings, corresponding to the
INTERSECT's operands. IfExpressioninstances are passed, they will be used as-is. - distinct: set the DISTINCT flag if and only if this is true.
- dialect: the dialect used to parse the input expression.
- copy: whether to copy the expression.
- opts: other options to use to parse the input expressions.
Returns:
The new Intersect instance.
8959def except_( 8960 *expressions: ExpOrStr, 8961 distinct: bool = True, 8962 dialect: DialectType = None, 8963 copy: bool = True, 8964 **opts, 8965) -> Except: 8966 """ 8967 Initializes a syntax tree for the `EXCEPT` operation. 8968 8969 Example: 8970 >>> except_("SELECT * FROM foo", "SELECT * FROM bla").sql() 8971 'SELECT * FROM foo EXCEPT SELECT * FROM bla' 8972 8973 Args: 8974 expressions: the SQL code strings, corresponding to the `EXCEPT`'s operands. 8975 If `Expression` instances are passed, they will be used as-is. 8976 distinct: set the DISTINCT flag if and only if this is true. 8977 dialect: the dialect used to parse the input expression. 8978 copy: whether to copy the expression. 8979 opts: other options to use to parse the input expressions. 8980 8981 Returns: 8982 The new Except instance. 8983 """ 8984 assert len(expressions) >= 2, "At least two expressions are required by `except_`." 8985 return _apply_set_operation( 8986 *expressions, set_operation=Except, distinct=distinct, dialect=dialect, copy=copy, **opts 8987 )
Initializes a syntax tree for the EXCEPT operation.
Example:
>>> except_("SELECT * FROM foo", "SELECT * FROM bla").sql() 'SELECT * FROM foo EXCEPT SELECT * FROM bla'
Arguments:
- expressions: the SQL code strings, corresponding to the
EXCEPT's operands. IfExpressioninstances are passed, they will be used as-is. - distinct: set the DISTINCT flag if and only if this is true.
- dialect: the dialect used to parse the input expression.
- copy: whether to copy the expression.
- opts: other options to use to parse the input expressions.
Returns:
The new Except instance.
8990def select(*expressions: ExpOrStr, dialect: DialectType = None, **opts) -> Select: 8991 """ 8992 Initializes a syntax tree from one or multiple SELECT expressions. 8993 8994 Example: 8995 >>> select("col1", "col2").from_("tbl").sql() 8996 'SELECT col1, col2 FROM tbl' 8997 8998 Args: 8999 *expressions: the SQL code string to parse as the expressions of a 9000 SELECT statement. If an Expression instance is passed, this is used as-is. 9001 dialect: the dialect used to parse the input expressions (in the case that an 9002 input expression is a SQL string). 9003 **opts: other options to use to parse the input expressions (again, in the case 9004 that an input expression is a SQL string). 9005 9006 Returns: 9007 Select: the syntax tree for the SELECT statement. 9008 """ 9009 return Select().select(*expressions, dialect=dialect, **opts)
Initializes a syntax tree from one or multiple SELECT expressions.
Example:
>>> select("col1", "col2").from_("tbl").sql() 'SELECT col1, col2 FROM tbl'
Arguments:
- *expressions: the SQL code string to parse as the expressions of a SELECT statement. If an Expression instance is passed, this is used as-is.
- dialect: the dialect used to parse the input expressions (in the case that an input expression is a SQL string).
- **opts: other options to use to parse the input expressions (again, in the case that an input expression is a SQL string).
Returns:
Select: the syntax tree for the SELECT statement.
9012def from_(expression: ExpOrStr, dialect: DialectType = None, **opts) -> Select: 9013 """ 9014 Initializes a syntax tree from a FROM expression. 9015 9016 Example: 9017 >>> from_("tbl").select("col1", "col2").sql() 9018 'SELECT col1, col2 FROM tbl' 9019 9020 Args: 9021 *expression: the SQL code string to parse as the FROM expressions of a 9022 SELECT statement. If an Expression instance is passed, this is used as-is. 9023 dialect: the dialect used to parse the input expression (in the case that the 9024 input expression is a SQL string). 9025 **opts: other options to use to parse the input expressions (again, in the case 9026 that the input expression is a SQL string). 9027 9028 Returns: 9029 Select: the syntax tree for the SELECT statement. 9030 """ 9031 return Select().from_(expression, dialect=dialect, **opts)
Initializes a syntax tree from a FROM expression.
Example:
>>> from_("tbl").select("col1", "col2").sql() 'SELECT col1, col2 FROM tbl'
Arguments:
- *expression: the SQL code string to parse as the FROM expressions of a SELECT statement. If an Expression instance is passed, this is used as-is.
- dialect: the dialect used to parse the input expression (in the case that the input expression is a SQL string).
- **opts: other options to use to parse the input expressions (again, in the case that the input expression is a SQL string).
Returns:
Select: the syntax tree for the SELECT statement.
9034def update( 9035 table: str | Table, 9036 properties: t.Optional[dict] = None, 9037 where: t.Optional[ExpOrStr] = None, 9038 from_: t.Optional[ExpOrStr] = None, 9039 with_: t.Optional[t.Dict[str, ExpOrStr]] = None, 9040 dialect: DialectType = None, 9041 **opts, 9042) -> Update: 9043 """ 9044 Creates an update statement. 9045 9046 Example: 9047 >>> update("my_table", {"x": 1, "y": "2", "z": None}, from_="baz_cte", where="baz_cte.id > 1 and my_table.id = baz_cte.id", with_={"baz_cte": "SELECT id FROM foo"}).sql() 9048 "WITH baz_cte AS (SELECT id FROM foo) UPDATE my_table SET x = 1, y = '2', z = NULL FROM baz_cte WHERE baz_cte.id > 1 AND my_table.id = baz_cte.id" 9049 9050 Args: 9051 properties: dictionary of properties to SET which are 9052 auto converted to sql objects eg None -> NULL 9053 where: sql conditional parsed into a WHERE statement 9054 from_: sql statement parsed into a FROM statement 9055 with_: dictionary of CTE aliases / select statements to include in a WITH clause. 9056 dialect: the dialect used to parse the input expressions. 9057 **opts: other options to use to parse the input expressions. 9058 9059 Returns: 9060 Update: the syntax tree for the UPDATE statement. 9061 """ 9062 update_expr = Update(this=maybe_parse(table, into=Table, dialect=dialect)) 9063 if properties: 9064 update_expr.set( 9065 "expressions", 9066 [ 9067 EQ(this=maybe_parse(k, dialect=dialect, **opts), expression=convert(v)) 9068 for k, v in properties.items() 9069 ], 9070 ) 9071 if from_: 9072 update_expr.set( 9073 "from_", 9074 maybe_parse(from_, into=From, dialect=dialect, prefix="FROM", **opts), 9075 ) 9076 if isinstance(where, Condition): 9077 where = Where(this=where) 9078 if where: 9079 update_expr.set( 9080 "where", 9081 maybe_parse(where, into=Where, dialect=dialect, prefix="WHERE", **opts), 9082 ) 9083 if with_: 9084 cte_list = [ 9085 alias_(CTE(this=maybe_parse(qry, dialect=dialect, **opts)), alias, table=True) 9086 for alias, qry in with_.items() 9087 ] 9088 update_expr.set( 9089 "with_", 9090 With(expressions=cte_list), 9091 ) 9092 return update_expr
Creates an update statement.
Example:
>>> update("my_table", {"x": 1, "y": "2", "z": None}, from_="baz_cte", where="baz_cte.id > 1 and my_table.id = baz_cte.id", with_={"baz_cte": "SELECT id FROM foo"}).sql() "WITH baz_cte AS (SELECT id FROM foo) UPDATE my_table SET x = 1, y = '2', z = NULL FROM baz_cte WHERE baz_cte.id > 1 AND my_table.id = baz_cte.id"
Arguments:
- properties: dictionary of properties to SET which are auto converted to sql objects eg None -> NULL
- where: sql conditional parsed into a WHERE statement
- from_: sql statement parsed into a FROM statement
- with_: dictionary of CTE aliases / select statements to include in a WITH clause.
- dialect: the dialect used to parse the input expressions.
- **opts: other options to use to parse the input expressions.
Returns:
Update: the syntax tree for the UPDATE statement.
9095def delete( 9096 table: ExpOrStr, 9097 where: t.Optional[ExpOrStr] = None, 9098 returning: t.Optional[ExpOrStr] = None, 9099 dialect: DialectType = None, 9100 **opts, 9101) -> Delete: 9102 """ 9103 Builds a delete statement. 9104 9105 Example: 9106 >>> delete("my_table", where="id > 1").sql() 9107 'DELETE FROM my_table WHERE id > 1' 9108 9109 Args: 9110 where: sql conditional parsed into a WHERE statement 9111 returning: sql conditional parsed into a RETURNING statement 9112 dialect: the dialect used to parse the input expressions. 9113 **opts: other options to use to parse the input expressions. 9114 9115 Returns: 9116 Delete: the syntax tree for the DELETE statement. 9117 """ 9118 delete_expr = Delete().delete(table, dialect=dialect, copy=False, **opts) 9119 if where: 9120 delete_expr = delete_expr.where(where, dialect=dialect, copy=False, **opts) 9121 if returning: 9122 delete_expr = delete_expr.returning(returning, dialect=dialect, copy=False, **opts) 9123 return delete_expr
Builds a delete statement.
Example:
>>> delete("my_table", where="id > 1").sql() 'DELETE FROM my_table WHERE id > 1'
Arguments:
- where: sql conditional parsed into a WHERE statement
- returning: sql conditional parsed into a RETURNING statement
- dialect: the dialect used to parse the input expressions.
- **opts: other options to use to parse the input expressions.
Returns:
Delete: the syntax tree for the DELETE statement.
9126def insert( 9127 expression: ExpOrStr, 9128 into: ExpOrStr, 9129 columns: t.Optional[t.Sequence[str | Identifier]] = None, 9130 overwrite: t.Optional[bool] = None, 9131 returning: t.Optional[ExpOrStr] = None, 9132 dialect: DialectType = None, 9133 copy: bool = True, 9134 **opts, 9135) -> Insert: 9136 """ 9137 Builds an INSERT statement. 9138 9139 Example: 9140 >>> insert("VALUES (1, 2, 3)", "tbl").sql() 9141 'INSERT INTO tbl VALUES (1, 2, 3)' 9142 9143 Args: 9144 expression: the sql string or expression of the INSERT statement 9145 into: the tbl to insert data to. 9146 columns: optionally the table's column names. 9147 overwrite: whether to INSERT OVERWRITE or not. 9148 returning: sql conditional parsed into a RETURNING statement 9149 dialect: the dialect used to parse the input expressions. 9150 copy: whether to copy the expression. 9151 **opts: other options to use to parse the input expressions. 9152 9153 Returns: 9154 Insert: the syntax tree for the INSERT statement. 9155 """ 9156 expr = maybe_parse(expression, dialect=dialect, copy=copy, **opts) 9157 this: Table | Schema = maybe_parse(into, into=Table, dialect=dialect, copy=copy, **opts) 9158 9159 if columns: 9160 this = Schema(this=this, expressions=[to_identifier(c, copy=copy) for c in columns]) 9161 9162 insert = Insert(this=this, expression=expr, overwrite=overwrite) 9163 9164 if returning: 9165 insert = insert.returning(returning, dialect=dialect, copy=False, **opts) 9166 9167 return insert
Builds an INSERT statement.
Example:
>>> insert("VALUES (1, 2, 3)", "tbl").sql() 'INSERT INTO tbl VALUES (1, 2, 3)'
Arguments:
- expression: the sql string or expression of the INSERT statement
- into: the tbl to insert data to.
- columns: optionally the table's column names.
- overwrite: whether to INSERT OVERWRITE or not.
- returning: sql conditional parsed into a RETURNING statement
- dialect: the dialect used to parse the input expressions.
- copy: whether to copy the expression.
- **opts: other options to use to parse the input expressions.
Returns:
Insert: the syntax tree for the INSERT statement.
9170def merge( 9171 *when_exprs: ExpOrStr, 9172 into: ExpOrStr, 9173 using: ExpOrStr, 9174 on: ExpOrStr, 9175 returning: t.Optional[ExpOrStr] = None, 9176 dialect: DialectType = None, 9177 copy: bool = True, 9178 **opts, 9179) -> Merge: 9180 """ 9181 Builds a MERGE statement. 9182 9183 Example: 9184 >>> merge("WHEN MATCHED THEN UPDATE SET col1 = source_table.col1", 9185 ... "WHEN NOT MATCHED THEN INSERT (col1) VALUES (source_table.col1)", 9186 ... into="my_table", 9187 ... using="source_table", 9188 ... on="my_table.id = source_table.id").sql() 9189 'MERGE INTO my_table USING source_table ON my_table.id = source_table.id WHEN MATCHED THEN UPDATE SET col1 = source_table.col1 WHEN NOT MATCHED THEN INSERT (col1) VALUES (source_table.col1)' 9190 9191 Args: 9192 *when_exprs: The WHEN clauses specifying actions for matched and unmatched rows. 9193 into: The target table to merge data into. 9194 using: The source table to merge data from. 9195 on: The join condition for the merge. 9196 returning: The columns to return from the merge. 9197 dialect: The dialect used to parse the input expressions. 9198 copy: Whether to copy the expression. 9199 **opts: Other options to use to parse the input expressions. 9200 9201 Returns: 9202 Merge: The syntax tree for the MERGE statement. 9203 """ 9204 expressions: t.List[Expression] = [] 9205 for when_expr in when_exprs: 9206 expression = maybe_parse(when_expr, dialect=dialect, copy=copy, into=Whens, **opts) 9207 expressions.extend([expression] if isinstance(expression, When) else expression.expressions) 9208 9209 merge = Merge( 9210 this=maybe_parse(into, dialect=dialect, copy=copy, **opts), 9211 using=maybe_parse(using, dialect=dialect, copy=copy, **opts), 9212 on=maybe_parse(on, dialect=dialect, copy=copy, **opts), 9213 whens=Whens(expressions=expressions), 9214 ) 9215 if returning: 9216 merge = merge.returning(returning, dialect=dialect, copy=False, **opts) 9217 9218 if isinstance(using_clause := merge.args.get("using"), Alias): 9219 using_clause.replace(alias_(using_clause.this, using_clause.args["alias"], table=True)) 9220 9221 return merge
Builds a MERGE statement.
Example:
>>> merge("WHEN MATCHED THEN UPDATE SET col1 = source_table.col1", ... "WHEN NOT MATCHED THEN INSERT (col1) VALUES (source_table.col1)", ... into="my_table", ... using="source_table", ... on="my_table.id = source_table.id").sql() 'MERGE INTO my_table USING source_table ON my_table.id = source_table.id WHEN MATCHED THEN UPDATE SET col1 = source_table.col1 WHEN NOT MATCHED THEN INSERT (col1) VALUES (source_table.col1)'
Arguments:
- *when_exprs: The WHEN clauses specifying actions for matched and unmatched rows.
- into: The target table to merge data into.
- using: The source table to merge data from.
- on: The join condition for the merge.
- returning: The columns to return from the merge.
- dialect: The dialect used to parse the input expressions.
- copy: Whether to copy the expression.
- **opts: Other options to use to parse the input expressions.
Returns:
Merge: The syntax tree for the MERGE statement.
9224def condition( 9225 expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts 9226) -> Condition: 9227 """ 9228 Initialize a logical condition expression. 9229 9230 Example: 9231 >>> condition("x=1").sql() 9232 'x = 1' 9233 9234 This is helpful for composing larger logical syntax trees: 9235 >>> where = condition("x=1") 9236 >>> where = where.and_("y=1") 9237 >>> Select().from_("tbl").select("*").where(where).sql() 9238 'SELECT * FROM tbl WHERE x = 1 AND y = 1' 9239 9240 Args: 9241 *expression: the SQL code string to parse. 9242 If an Expression instance is passed, this is used as-is. 9243 dialect: the dialect used to parse the input expression (in the case that the 9244 input expression is a SQL string). 9245 copy: Whether to copy `expression` (only applies to expressions). 9246 **opts: other options to use to parse the input expressions (again, in the case 9247 that the input expression is a SQL string). 9248 9249 Returns: 9250 The new Condition instance 9251 """ 9252 return maybe_parse( 9253 expression, 9254 into=Condition, 9255 dialect=dialect, 9256 copy=copy, 9257 **opts, 9258 )
Initialize a logical condition expression.
Example:
>>> condition("x=1").sql() 'x = 1'This is helpful for composing larger logical syntax trees:
Arguments:
- *expression: the SQL code string to parse. If an Expression instance is passed, this is used as-is.
- dialect: the dialect used to parse the input expression (in the case that the input expression is a SQL string).
- copy: Whether to copy
expression(only applies to expressions). - **opts: other options to use to parse the input expressions (again, in the case that the input expression is a SQL string).
Returns:
The new Condition instance
9261def and_( 9262 *expressions: t.Optional[ExpOrStr], 9263 dialect: DialectType = None, 9264 copy: bool = True, 9265 wrap: bool = True, 9266 **opts, 9267) -> Condition: 9268 """ 9269 Combine multiple conditions with an AND logical operator. 9270 9271 Example: 9272 >>> and_("x=1", and_("y=1", "z=1")).sql() 9273 'x = 1 AND (y = 1 AND z = 1)' 9274 9275 Args: 9276 *expressions: the SQL code strings to parse. 9277 If an Expression instance is passed, this is used as-is. 9278 dialect: the dialect used to parse the input expression. 9279 copy: whether to copy `expressions` (only applies to Expressions). 9280 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 9281 precedence issues, but can be turned off when the produced AST is too deep and 9282 causes recursion-related issues. 9283 **opts: other options to use to parse the input expressions. 9284 9285 Returns: 9286 The new condition 9287 """ 9288 return t.cast(Condition, _combine(expressions, And, dialect, copy=copy, wrap=wrap, **opts))
Combine multiple conditions with an AND logical operator.
Example:
>>> and_("x=1", and_("y=1", "z=1")).sql() 'x = 1 AND (y = 1 AND z = 1)'
Arguments:
- *expressions: the SQL code strings to parse. If an Expression instance is passed, this is used as-is.
- dialect: the dialect used to parse the input expression.
- copy: whether to copy
expressions(only applies to Expressions). - wrap: whether to wrap the operands in
Parens. This is true by default to avoid precedence issues, but can be turned off when the produced AST is too deep and causes recursion-related issues. - **opts: other options to use to parse the input expressions.
Returns:
The new condition
9291def or_( 9292 *expressions: t.Optional[ExpOrStr], 9293 dialect: DialectType = None, 9294 copy: bool = True, 9295 wrap: bool = True, 9296 **opts, 9297) -> Condition: 9298 """ 9299 Combine multiple conditions with an OR logical operator. 9300 9301 Example: 9302 >>> or_("x=1", or_("y=1", "z=1")).sql() 9303 'x = 1 OR (y = 1 OR z = 1)' 9304 9305 Args: 9306 *expressions: the SQL code strings to parse. 9307 If an Expression instance is passed, this is used as-is. 9308 dialect: the dialect used to parse the input expression. 9309 copy: whether to copy `expressions` (only applies to Expressions). 9310 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 9311 precedence issues, but can be turned off when the produced AST is too deep and 9312 causes recursion-related issues. 9313 **opts: other options to use to parse the input expressions. 9314 9315 Returns: 9316 The new condition 9317 """ 9318 return t.cast(Condition, _combine(expressions, Or, dialect, copy=copy, wrap=wrap, **opts))
Combine multiple conditions with an OR logical operator.
Example:
>>> or_("x=1", or_("y=1", "z=1")).sql() 'x = 1 OR (y = 1 OR z = 1)'
Arguments:
- *expressions: the SQL code strings to parse. If an Expression instance is passed, this is used as-is.
- dialect: the dialect used to parse the input expression.
- copy: whether to copy
expressions(only applies to Expressions). - wrap: whether to wrap the operands in
Parens. This is true by default to avoid precedence issues, but can be turned off when the produced AST is too deep and causes recursion-related issues. - **opts: other options to use to parse the input expressions.
Returns:
The new condition
9321def xor( 9322 *expressions: t.Optional[ExpOrStr], 9323 dialect: DialectType = None, 9324 copy: bool = True, 9325 wrap: bool = True, 9326 **opts, 9327) -> Condition: 9328 """ 9329 Combine multiple conditions with an XOR logical operator. 9330 9331 Example: 9332 >>> xor("x=1", xor("y=1", "z=1")).sql() 9333 'x = 1 XOR (y = 1 XOR z = 1)' 9334 9335 Args: 9336 *expressions: the SQL code strings to parse. 9337 If an Expression instance is passed, this is used as-is. 9338 dialect: the dialect used to parse the input expression. 9339 copy: whether to copy `expressions` (only applies to Expressions). 9340 wrap: whether to wrap the operands in `Paren`s. This is true by default to avoid 9341 precedence issues, but can be turned off when the produced AST is too deep and 9342 causes recursion-related issues. 9343 **opts: other options to use to parse the input expressions. 9344 9345 Returns: 9346 The new condition 9347 """ 9348 return t.cast(Condition, _combine(expressions, Xor, dialect, copy=copy, wrap=wrap, **opts))
Combine multiple conditions with an XOR logical operator.
Example:
>>> xor("x=1", xor("y=1", "z=1")).sql() 'x = 1 XOR (y = 1 XOR z = 1)'
Arguments:
- *expressions: the SQL code strings to parse. If an Expression instance is passed, this is used as-is.
- dialect: the dialect used to parse the input expression.
- copy: whether to copy
expressions(only applies to Expressions). - wrap: whether to wrap the operands in
Parens. This is true by default to avoid precedence issues, but can be turned off when the produced AST is too deep and causes recursion-related issues. - **opts: other options to use to parse the input expressions.
Returns:
The new condition
9351def not_(expression: ExpOrStr, dialect: DialectType = None, copy: bool = True, **opts) -> Not: 9352 """ 9353 Wrap a condition with a NOT operator. 9354 9355 Example: 9356 >>> not_("this_suit='black'").sql() 9357 "NOT this_suit = 'black'" 9358 9359 Args: 9360 expression: the SQL code string to parse. 9361 If an Expression instance is passed, this is used as-is. 9362 dialect: the dialect used to parse the input expression. 9363 copy: whether to copy the expression or not. 9364 **opts: other options to use to parse the input expressions. 9365 9366 Returns: 9367 The new condition. 9368 """ 9369 this = condition( 9370 expression, 9371 dialect=dialect, 9372 copy=copy, 9373 **opts, 9374 ) 9375 return Not(this=_wrap(this, Connector))
Wrap a condition with a NOT operator.
Example:
>>> not_("this_suit='black'").sql() "NOT this_suit = 'black'"
Arguments:
- expression: the SQL code string to parse. If an Expression instance is passed, this is used as-is.
- dialect: the dialect used to parse the input expression.
- copy: whether to copy the expression or not.
- **opts: other options to use to parse the input expressions.
Returns:
The new condition.
9378def paren(expression: ExpOrStr, copy: bool = True) -> Paren: 9379 """ 9380 Wrap an expression in parentheses. 9381 9382 Example: 9383 >>> paren("5 + 3").sql() 9384 '(5 + 3)' 9385 9386 Args: 9387 expression: the SQL code string to parse. 9388 If an Expression instance is passed, this is used as-is. 9389 copy: whether to copy the expression or not. 9390 9391 Returns: 9392 The wrapped expression. 9393 """ 9394 return Paren(this=maybe_parse(expression, copy=copy))
Wrap an expression in parentheses.
Example:
>>> paren("5 + 3").sql() '(5 + 3)'
Arguments:
- expression: the SQL code string to parse. If an Expression instance is passed, this is used as-is.
- copy: whether to copy the expression or not.
Returns:
The wrapped expression.
9410def to_identifier(name, quoted=None, copy=True): 9411 """Builds an identifier. 9412 9413 Args: 9414 name: The name to turn into an identifier. 9415 quoted: Whether to force quote the identifier. 9416 copy: Whether to copy name if it's an Identifier. 9417 9418 Returns: 9419 The identifier ast node. 9420 """ 9421 9422 if name is None: 9423 return None 9424 9425 if isinstance(name, Identifier): 9426 identifier = maybe_copy(name, copy) 9427 elif isinstance(name, str): 9428 identifier = Identifier( 9429 this=name, 9430 quoted=not SAFE_IDENTIFIER_RE.match(name) if quoted is None else quoted, 9431 ) 9432 else: 9433 raise ValueError(f"Name needs to be a string or an Identifier, got: {name.__class__}") 9434 return identifier
Builds an identifier.
Arguments:
- name: The name to turn into an identifier.
- quoted: Whether to force quote the identifier.
- copy: Whether to copy name if it's an Identifier.
Returns:
The identifier ast node.
9437def parse_identifier(name: str | Identifier, dialect: DialectType = None) -> Identifier: 9438 """ 9439 Parses a given string into an identifier. 9440 9441 Args: 9442 name: The name to parse into an identifier. 9443 dialect: The dialect to parse against. 9444 9445 Returns: 9446 The identifier ast node. 9447 """ 9448 try: 9449 expression = maybe_parse(name, dialect=dialect, into=Identifier) 9450 except (ParseError, TokenError): 9451 expression = to_identifier(name) 9452 9453 return expression
Parses a given string into an identifier.
Arguments:
- name: The name to parse into an identifier.
- dialect: The dialect to parse against.
Returns:
The identifier ast node.
9472def to_interval(interval: str | Literal) -> Interval: 9473 """Builds an interval expression from a string like '1 day' or '5 months'.""" 9474 if isinstance(interval, Literal): 9475 if not interval.is_string: 9476 raise ValueError("Invalid interval string.") 9477 9478 interval = interval.this 9479 9480 interval = maybe_parse(f"INTERVAL {interval}") 9481 assert isinstance(interval, Interval) 9482 return interval
Builds an interval expression from a string like '1 day' or '5 months'.
9485def to_table( 9486 sql_path: str | Table, dialect: DialectType = None, copy: bool = True, **kwargs 9487) -> Table: 9488 """ 9489 Create a table expression from a `[catalog].[schema].[table]` sql path. Catalog and schema are optional. 9490 If a table is passed in then that table is returned. 9491 9492 Args: 9493 sql_path: a `[catalog].[schema].[table]` string. 9494 dialect: the source dialect according to which the table name will be parsed. 9495 copy: Whether to copy a table if it is passed in. 9496 kwargs: the kwargs to instantiate the resulting `Table` expression with. 9497 9498 Returns: 9499 A table expression. 9500 """ 9501 if isinstance(sql_path, Table): 9502 return maybe_copy(sql_path, copy=copy) 9503 9504 try: 9505 table = maybe_parse(sql_path, into=Table, dialect=dialect) 9506 except ParseError: 9507 catalog, db, this = split_num_words(sql_path, ".", 3) 9508 9509 if not this: 9510 raise 9511 9512 table = table_(this, db=db, catalog=catalog) 9513 9514 for k, v in kwargs.items(): 9515 table.set(k, v) 9516 9517 return table
Create a table expression from a [catalog].[schema].[table] sql path. Catalog and schema are optional.
If a table is passed in then that table is returned.
Arguments:
- sql_path: a
[catalog].[schema].[table]string. - dialect: the source dialect according to which the table name will be parsed.
- copy: Whether to copy a table if it is passed in.
- kwargs: the kwargs to instantiate the resulting
Tableexpression with.
Returns:
A table expression.
9520def to_column( 9521 sql_path: str | Column, 9522 quoted: t.Optional[bool] = None, 9523 dialect: DialectType = None, 9524 copy: bool = True, 9525 **kwargs, 9526) -> Column: 9527 """ 9528 Create a column from a `[table].[column]` sql path. Table is optional. 9529 If a column is passed in then that column is returned. 9530 9531 Args: 9532 sql_path: a `[table].[column]` string. 9533 quoted: Whether or not to force quote identifiers. 9534 dialect: the source dialect according to which the column name will be parsed. 9535 copy: Whether to copy a column if it is passed in. 9536 kwargs: the kwargs to instantiate the resulting `Column` expression with. 9537 9538 Returns: 9539 A column expression. 9540 """ 9541 if isinstance(sql_path, Column): 9542 return maybe_copy(sql_path, copy=copy) 9543 9544 try: 9545 col = maybe_parse(sql_path, into=Column, dialect=dialect) 9546 except ParseError: 9547 return column(*reversed(sql_path.split(".")), quoted=quoted, **kwargs) 9548 9549 for k, v in kwargs.items(): 9550 col.set(k, v) 9551 9552 if quoted: 9553 for i in col.find_all(Identifier): 9554 i.set("quoted", True) 9555 9556 return col
Create a column from a [table].[column] sql path. Table is optional.
If a column is passed in then that column is returned.
Arguments:
- sql_path: a
[table].[column]string. - quoted: Whether or not to force quote identifiers.
- dialect: the source dialect according to which the column name will be parsed.
- copy: Whether to copy a column if it is passed in.
- kwargs: the kwargs to instantiate the resulting
Columnexpression with.
Returns:
A column expression.
9559def alias_( 9560 expression: ExpOrStr, 9561 alias: t.Optional[str | Identifier], 9562 table: bool | t.Sequence[str | Identifier] = False, 9563 quoted: t.Optional[bool] = None, 9564 dialect: DialectType = None, 9565 copy: bool = True, 9566 **opts, 9567): 9568 """Create an Alias expression. 9569 9570 Example: 9571 >>> alias_('foo', 'bar').sql() 9572 'foo AS bar' 9573 9574 >>> alias_('(select 1, 2)', 'bar', table=['a', 'b']).sql() 9575 '(SELECT 1, 2) AS bar(a, b)' 9576 9577 Args: 9578 expression: the SQL code strings to parse. 9579 If an Expression instance is passed, this is used as-is. 9580 alias: the alias name to use. If the name has 9581 special characters it is quoted. 9582 table: Whether to create a table alias, can also be a list of columns. 9583 quoted: whether to quote the alias 9584 dialect: the dialect used to parse the input expression. 9585 copy: Whether to copy the expression. 9586 **opts: other options to use to parse the input expressions. 9587 9588 Returns: 9589 Alias: the aliased expression 9590 """ 9591 exp = maybe_parse(expression, dialect=dialect, copy=copy, **opts) 9592 alias = to_identifier(alias, quoted=quoted) 9593 9594 if table: 9595 table_alias = TableAlias(this=alias) 9596 exp.set("alias", table_alias) 9597 9598 if not isinstance(table, bool): 9599 for column in table: 9600 table_alias.append("columns", to_identifier(column, quoted=quoted)) 9601 9602 return exp 9603 9604 # We don't set the "alias" arg for Window expressions, because that would add an IDENTIFIER node in 9605 # the AST, representing a "named_window" [1] construct (eg. bigquery). What we want is an ALIAS node 9606 # for the complete Window expression. 9607 # 9608 # [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls 9609 9610 if "alias" in exp.arg_types and not isinstance(exp, Window): 9611 exp.set("alias", alias) 9612 return exp 9613 return Alias(this=exp, alias=alias)
Create an Alias expression.
Example:
>>> alias_('foo', 'bar').sql() 'foo AS bar'>>> alias_('(select 1, 2)', 'bar', table=['a', 'b']).sql() '(SELECT 1, 2) AS bar(a, b)'
Arguments:
- expression: the SQL code strings to parse. If an Expression instance is passed, this is used as-is.
- alias: the alias name to use. If the name has special characters it is quoted.
- table: Whether to create a table alias, can also be a list of columns.
- quoted: whether to quote the alias
- dialect: the dialect used to parse the input expression.
- copy: Whether to copy the expression.
- **opts: other options to use to parse the input expressions.
Returns:
Alias: the aliased expression
9616def subquery( 9617 expression: ExpOrStr, 9618 alias: t.Optional[Identifier | str] = None, 9619 dialect: DialectType = None, 9620 **opts, 9621) -> Select: 9622 """ 9623 Build a subquery expression that's selected from. 9624 9625 Example: 9626 >>> subquery('select x from tbl', 'bar').select('x').sql() 9627 'SELECT x FROM (SELECT x FROM tbl) AS bar' 9628 9629 Args: 9630 expression: the SQL code strings to parse. 9631 If an Expression instance is passed, this is used as-is. 9632 alias: the alias name to use. 9633 dialect: the dialect used to parse the input expression. 9634 **opts: other options to use to parse the input expressions. 9635 9636 Returns: 9637 A new Select instance with the subquery expression included. 9638 """ 9639 9640 expression = maybe_parse(expression, dialect=dialect, **opts).subquery(alias, **opts) 9641 return Select().from_(expression, dialect=dialect, **opts)
Build a subquery expression that's selected from.
Example:
>>> subquery('select x from tbl', 'bar').select('x').sql() 'SELECT x FROM (SELECT x FROM tbl) AS bar'
Arguments:
- expression: the SQL code strings to parse. If an Expression instance is passed, this is used as-is.
- alias: the alias name to use.
- dialect: the dialect used to parse the input expression.
- **opts: other options to use to parse the input expressions.
Returns:
A new Select instance with the subquery expression included.
9672def column( 9673 col, 9674 table=None, 9675 db=None, 9676 catalog=None, 9677 *, 9678 fields=None, 9679 quoted=None, 9680 copy=True, 9681): 9682 """ 9683 Build a Column. 9684 9685 Args: 9686 col: Column name. 9687 table: Table name. 9688 db: Database name. 9689 catalog: Catalog name. 9690 fields: Additional fields using dots. 9691 quoted: Whether to force quotes on the column's identifiers. 9692 copy: Whether to copy identifiers if passed in. 9693 9694 Returns: 9695 The new Column instance. 9696 """ 9697 if not isinstance(col, Star): 9698 col = to_identifier(col, quoted=quoted, copy=copy) 9699 9700 this = Column( 9701 this=col, 9702 table=to_identifier(table, quoted=quoted, copy=copy), 9703 db=to_identifier(db, quoted=quoted, copy=copy), 9704 catalog=to_identifier(catalog, quoted=quoted, copy=copy), 9705 ) 9706 9707 if fields: 9708 this = Dot.build( 9709 (this, *(to_identifier(field, quoted=quoted, copy=copy) for field in fields)) 9710 ) 9711 return this
Build a Column.
Arguments:
- col: Column name.
- table: Table name.
- db: Database name.
- catalog: Catalog name.
- fields: Additional fields using dots.
- quoted: Whether to force quotes on the column's identifiers.
- copy: Whether to copy identifiers if passed in.
Returns:
The new Column instance.
9714def cast( 9715 expression: ExpOrStr, to: DATA_TYPE, copy: bool = True, dialect: DialectType = None, **opts 9716) -> Cast: 9717 """Cast an expression to a data type. 9718 9719 Example: 9720 >>> cast('x + 1', 'int').sql() 9721 'CAST(x + 1 AS INT)' 9722 9723 Args: 9724 expression: The expression to cast. 9725 to: The datatype to cast to. 9726 copy: Whether to copy the supplied expressions. 9727 dialect: The target dialect. This is used to prevent a re-cast in the following scenario: 9728 - The expression to be cast is already a exp.Cast expression 9729 - The existing cast is to a type that is logically equivalent to new type 9730 9731 For example, if :expression='CAST(x as DATETIME)' and :to=Type.TIMESTAMP, 9732 but in the target dialect DATETIME is mapped to TIMESTAMP, then we will NOT return `CAST(x (as DATETIME) as TIMESTAMP)` 9733 and instead just return the original expression `CAST(x as DATETIME)`. 9734 9735 This is to prevent it being output as a double cast `CAST(x (as TIMESTAMP) as TIMESTAMP)` once the DATETIME -> TIMESTAMP 9736 mapping is applied in the target dialect generator. 9737 9738 Returns: 9739 The new Cast instance. 9740 """ 9741 expr = maybe_parse(expression, copy=copy, dialect=dialect, **opts) 9742 data_type = DataType.build(to, copy=copy, dialect=dialect, **opts) 9743 9744 # dont re-cast if the expression is already a cast to the correct type 9745 if isinstance(expr, Cast): 9746 from sqlglot.dialects.dialect import Dialect 9747 9748 target_dialect = Dialect.get_or_raise(dialect) 9749 type_mapping = target_dialect.generator_class.TYPE_MAPPING 9750 9751 existing_cast_type: DataType.Type = expr.to.this 9752 new_cast_type: DataType.Type = data_type.this 9753 types_are_equivalent = type_mapping.get( 9754 existing_cast_type, existing_cast_type.value 9755 ) == type_mapping.get(new_cast_type, new_cast_type.value) 9756 9757 if expr.is_type(data_type) or types_are_equivalent: 9758 return expr 9759 9760 expr = Cast(this=expr, to=data_type) 9761 expr.type = data_type 9762 9763 return expr
Cast an expression to a data type.
Example:
>>> cast('x + 1', 'int').sql() 'CAST(x + 1 AS INT)'
Arguments:
- expression: The expression to cast.
- to: The datatype to cast to.
- copy: Whether to copy the supplied expressions.
dialect: The target dialect. This is used to prevent a re-cast in the following scenario:
- The expression to be cast is already a exp.Cast expression
- The existing cast is to a type that is logically equivalent to new type
For example, if :expression='CAST(x as DATETIME)' and :to=Type.TIMESTAMP, but in the target dialect DATETIME is mapped to TIMESTAMP, then we will NOT return
CAST(x (as DATETIME) as TIMESTAMP)and instead just return the original expressionCAST(x as DATETIME).This is to prevent it being output as a double cast
CAST(x (as TIMESTAMP) as TIMESTAMP)once the DATETIME -> TIMESTAMP mapping is applied in the target dialect generator.
Returns:
The new Cast instance.
9766def table_( 9767 table: Identifier | str, 9768 db: t.Optional[Identifier | str] = None, 9769 catalog: t.Optional[Identifier | str] = None, 9770 quoted: t.Optional[bool] = None, 9771 alias: t.Optional[Identifier | str] = None, 9772) -> Table: 9773 """Build a Table. 9774 9775 Args: 9776 table: Table name. 9777 db: Database name. 9778 catalog: Catalog name. 9779 quote: Whether to force quotes on the table's identifiers. 9780 alias: Table's alias. 9781 9782 Returns: 9783 The new Table instance. 9784 """ 9785 return Table( 9786 this=to_identifier(table, quoted=quoted) if table else None, 9787 db=to_identifier(db, quoted=quoted) if db else None, 9788 catalog=to_identifier(catalog, quoted=quoted) if catalog else None, 9789 alias=TableAlias(this=to_identifier(alias)) if alias else None, 9790 )
Build a Table.
Arguments:
- table: Table name.
- db: Database name.
- catalog: Catalog name.
- quote: Whether to force quotes on the table's identifiers.
- alias: Table's alias.
Returns:
The new Table instance.
9793def values( 9794 values: t.Iterable[t.Tuple[t.Any, ...]], 9795 alias: t.Optional[str] = None, 9796 columns: t.Optional[t.Iterable[str] | t.Dict[str, DataType]] = None, 9797) -> Values: 9798 """Build VALUES statement. 9799 9800 Example: 9801 >>> values([(1, '2')]).sql() 9802 "VALUES (1, '2')" 9803 9804 Args: 9805 values: values statements that will be converted to SQL 9806 alias: optional alias 9807 columns: Optional list of ordered column names or ordered dictionary of column names to types. 9808 If either are provided then an alias is also required. 9809 9810 Returns: 9811 Values: the Values expression object 9812 """ 9813 if columns and not alias: 9814 raise ValueError("Alias is required when providing columns") 9815 9816 return Values( 9817 expressions=[convert(tup) for tup in values], 9818 alias=( 9819 TableAlias(this=to_identifier(alias), columns=[to_identifier(x) for x in columns]) 9820 if columns 9821 else (TableAlias(this=to_identifier(alias)) if alias else None) 9822 ), 9823 )
Build VALUES statement.
Example:
>>> values([(1, '2')]).sql() "VALUES (1, '2')"
Arguments:
- values: values statements that will be converted to SQL
- alias: optional alias
- columns: Optional list of ordered column names or ordered dictionary of column names to types. If either are provided then an alias is also required.
Returns:
Values: the Values expression object
9826def var(name: t.Optional[ExpOrStr]) -> Var: 9827 """Build a SQL variable. 9828 9829 Example: 9830 >>> repr(var('x')) 9831 'Var(this=x)' 9832 9833 >>> repr(var(column('x', table='y'))) 9834 'Var(this=x)' 9835 9836 Args: 9837 name: The name of the var or an expression who's name will become the var. 9838 9839 Returns: 9840 The new variable node. 9841 """ 9842 if not name: 9843 raise ValueError("Cannot convert empty name into var.") 9844 9845 if isinstance(name, Expression): 9846 name = name.name 9847 return Var(this=name)
Build a SQL variable.
Example:
>>> repr(var('x')) 'Var(this=x)'>>> repr(var(column('x', table='y'))) 'Var(this=x)'
Arguments:
- name: The name of the var or an expression who's name will become the var.
Returns:
The new variable node.
9850def rename_table( 9851 old_name: str | Table, 9852 new_name: str | Table, 9853 dialect: DialectType = None, 9854) -> Alter: 9855 """Build ALTER TABLE... RENAME... expression 9856 9857 Args: 9858 old_name: The old name of the table 9859 new_name: The new name of the table 9860 dialect: The dialect to parse the table. 9861 9862 Returns: 9863 Alter table expression 9864 """ 9865 old_table = to_table(old_name, dialect=dialect) 9866 new_table = to_table(new_name, dialect=dialect) 9867 return Alter( 9868 this=old_table, 9869 kind="TABLE", 9870 actions=[ 9871 AlterRename(this=new_table), 9872 ], 9873 )
Build ALTER TABLE... RENAME... expression
Arguments:
- old_name: The old name of the table
- new_name: The new name of the table
- dialect: The dialect to parse the table.
Returns:
Alter table expression
9876def rename_column( 9877 table_name: str | Table, 9878 old_column_name: str | Column, 9879 new_column_name: str | Column, 9880 exists: t.Optional[bool] = None, 9881 dialect: DialectType = None, 9882) -> Alter: 9883 """Build ALTER TABLE... RENAME COLUMN... expression 9884 9885 Args: 9886 table_name: Name of the table 9887 old_column: The old name of the column 9888 new_column: The new name of the column 9889 exists: Whether to add the `IF EXISTS` clause 9890 dialect: The dialect to parse the table/column. 9891 9892 Returns: 9893 Alter table expression 9894 """ 9895 table = to_table(table_name, dialect=dialect) 9896 old_column = to_column(old_column_name, dialect=dialect) 9897 new_column = to_column(new_column_name, dialect=dialect) 9898 return Alter( 9899 this=table, 9900 kind="TABLE", 9901 actions=[ 9902 RenameColumn(this=old_column, to=new_column, exists=exists), 9903 ], 9904 )
Build ALTER TABLE... RENAME COLUMN... expression
Arguments:
- table_name: Name of the table
- old_column: The old name of the column
- new_column: The new name of the column
- exists: Whether to add the
IF EXISTSclause - dialect: The dialect to parse the table/column.
Returns:
Alter table expression
9907def convert(value: t.Any, copy: bool = False) -> Expression: 9908 """Convert a python value into an expression object. 9909 9910 Raises an error if a conversion is not possible. 9911 9912 Args: 9913 value: A python object. 9914 copy: Whether to copy `value` (only applies to Expressions and collections). 9915 9916 Returns: 9917 The equivalent expression object. 9918 """ 9919 if isinstance(value, Expression): 9920 return maybe_copy(value, copy) 9921 if isinstance(value, str): 9922 return Literal.string(value) 9923 if isinstance(value, bool): 9924 return Boolean(this=value) 9925 if value is None or (isinstance(value, float) and math.isnan(value)): 9926 return null() 9927 if isinstance(value, numbers.Number): 9928 return Literal.number(value) 9929 if isinstance(value, bytes): 9930 return HexString(this=value.hex()) 9931 if isinstance(value, datetime.datetime): 9932 datetime_literal = Literal.string(value.isoformat(sep=" ")) 9933 9934 tz = None 9935 if value.tzinfo: 9936 # this works for zoneinfo.ZoneInfo, pytz.timezone and datetime.datetime.utc to return IANA timezone names like "America/Los_Angeles" 9937 # instead of abbreviations like "PDT". This is for consistency with other timezone handling functions in SQLGlot 9938 tz = Literal.string(str(value.tzinfo)) 9939 9940 return TimeStrToTime(this=datetime_literal, zone=tz) 9941 if isinstance(value, datetime.date): 9942 date_literal = Literal.string(value.strftime("%Y-%m-%d")) 9943 return DateStrToDate(this=date_literal) 9944 if isinstance(value, datetime.time): 9945 time_literal = Literal.string(value.isoformat()) 9946 return TsOrDsToTime(this=time_literal) 9947 if isinstance(value, tuple): 9948 if hasattr(value, "_fields"): 9949 return Struct( 9950 expressions=[ 9951 PropertyEQ( 9952 this=to_identifier(k), expression=convert(getattr(value, k), copy=copy) 9953 ) 9954 for k in value._fields 9955 ] 9956 ) 9957 return Tuple(expressions=[convert(v, copy=copy) for v in value]) 9958 if isinstance(value, list): 9959 return Array(expressions=[convert(v, copy=copy) for v in value]) 9960 if isinstance(value, dict): 9961 return Map( 9962 keys=Array(expressions=[convert(k, copy=copy) for k in value]), 9963 values=Array(expressions=[convert(v, copy=copy) for v in value.values()]), 9964 ) 9965 if hasattr(value, "__dict__"): 9966 return Struct( 9967 expressions=[ 9968 PropertyEQ(this=to_identifier(k), expression=convert(v, copy=copy)) 9969 for k, v in value.__dict__.items() 9970 ] 9971 ) 9972 raise ValueError(f"Cannot convert {value}")
Convert a python value into an expression object.
Raises an error if a conversion is not possible.
Arguments:
- value: A python object.
- copy: Whether to copy
value(only applies to Expressions and collections).
Returns:
The equivalent expression object.
9975def replace_children(expression: Expression, fun: t.Callable, *args, **kwargs) -> None: 9976 """ 9977 Replace children of an expression with the result of a lambda fun(child) -> exp. 9978 """ 9979 for k, v in tuple(expression.args.items()): 9980 is_list_arg = type(v) is list 9981 9982 child_nodes = v if is_list_arg else [v] 9983 new_child_nodes = [] 9984 9985 for cn in child_nodes: 9986 if isinstance(cn, Expression): 9987 for child_node in ensure_collection(fun(cn, *args, **kwargs)): 9988 new_child_nodes.append(child_node) 9989 else: 9990 new_child_nodes.append(cn) 9991 9992 expression.set(k, new_child_nodes if is_list_arg else seq_get(new_child_nodes, 0))
Replace children of an expression with the result of a lambda fun(child) -> exp.
9995def replace_tree( 9996 expression: Expression, 9997 fun: t.Callable, 9998 prune: t.Optional[t.Callable[[Expression], bool]] = None, 9999) -> Expression: 10000 """ 10001 Replace an entire tree with the result of function calls on each node. 10002 10003 This will be traversed in reverse dfs, so leaves first. 10004 If new nodes are created as a result of function calls, they will also be traversed. 10005 """ 10006 stack = list(expression.dfs(prune=prune)) 10007 10008 while stack: 10009 node = stack.pop() 10010 new_node = fun(node) 10011 10012 if new_node is not node: 10013 node.replace(new_node) 10014 10015 if isinstance(new_node, Expression): 10016 stack.append(new_node) 10017 10018 return new_node
Replace an entire tree with the result of function calls on each node.
This will be traversed in reverse dfs, so leaves first. If new nodes are created as a result of function calls, they will also be traversed.
10021def find_tables(expression: Expression) -> t.Set[Table]: 10022 """ 10023 Find all tables referenced in a query. 10024 10025 Args: 10026 expressions: The query to find the tables in. 10027 10028 Returns: 10029 A set of all the tables. 10030 """ 10031 from sqlglot.optimizer.scope import traverse_scope 10032 10033 return { 10034 table 10035 for scope in traverse_scope(expression) 10036 for table in scope.tables 10037 if table.name and table.name not in scope.cte_sources 10038 }
Find all tables referenced in a query.
Arguments:
- expressions: The query to find the tables in.
Returns:
A set of all the tables.
10041def column_table_names(expression: Expression, exclude: str = "") -> t.Set[str]: 10042 """ 10043 Return all table names referenced through columns in an expression. 10044 10045 Example: 10046 >>> import sqlglot 10047 >>> sorted(column_table_names(sqlglot.parse_one("a.b AND c.d AND c.e"))) 10048 ['a', 'c'] 10049 10050 Args: 10051 expression: expression to find table names. 10052 exclude: a table name to exclude 10053 10054 Returns: 10055 A list of unique names. 10056 """ 10057 return { 10058 table 10059 for table in (column.table for column in expression.find_all(Column)) 10060 if table and table != exclude 10061 }
Return all table names referenced through columns in an expression.
Example:
>>> import sqlglot >>> sorted(column_table_names(sqlglot.parse_one("a.b AND c.d AND c.e"))) ['a', 'c']
Arguments:
- expression: expression to find table names.
- exclude: a table name to exclude
Returns:
A list of unique names.
10064def table_name(table: Table | str, dialect: DialectType = None, identify: bool = False) -> str: 10065 """Get the full name of a table as a string. 10066 10067 Args: 10068 table: Table expression node or string. 10069 dialect: The dialect to generate the table name for. 10070 identify: Determines when an identifier should be quoted. Possible values are: 10071 False (default): Never quote, except in cases where it's mandatory by the dialect. 10072 True: Always quote. 10073 10074 Examples: 10075 >>> from sqlglot import exp, parse_one 10076 >>> table_name(parse_one("select * from a.b.c").find(exp.Table)) 10077 'a.b.c' 10078 10079 Returns: 10080 The table name. 10081 """ 10082 10083 table = maybe_parse(table, into=Table, dialect=dialect) 10084 10085 if not table: 10086 raise ValueError(f"Cannot parse {table}") 10087 10088 return ".".join( 10089 ( 10090 part.sql(dialect=dialect, identify=True, copy=False, comments=False) 10091 if identify or not SAFE_IDENTIFIER_RE.match(part.name) 10092 else part.name 10093 ) 10094 for part in table.parts 10095 )
Get the full name of a table as a string.
Arguments:
- table: Table expression node or string.
- dialect: The dialect to generate the table name for.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True: Always quote.
Examples:
>>> from sqlglot import exp, parse_one >>> table_name(parse_one("select * from a.b.c").find(exp.Table)) 'a.b.c'
Returns:
The table name.
10098def normalize_table_name(table: str | Table, dialect: DialectType = None, copy: bool = True) -> str: 10099 """Returns a case normalized table name without quotes. 10100 10101 Args: 10102 table: the table to normalize 10103 dialect: the dialect to use for normalization rules 10104 copy: whether to copy the expression. 10105 10106 Examples: 10107 >>> normalize_table_name("`A-B`.c", dialect="bigquery") 10108 'A-B.c' 10109 """ 10110 from sqlglot.optimizer.normalize_identifiers import normalize_identifiers 10111 10112 return ".".join( 10113 p.name 10114 for p in normalize_identifiers( 10115 to_table(table, dialect=dialect, copy=copy), dialect=dialect 10116 ).parts 10117 )
Returns a case normalized table name without quotes.
Arguments:
- table: the table to normalize
- dialect: the dialect to use for normalization rules
- copy: whether to copy the expression.
Examples:
>>> normalize_table_name("`A-B`.c", dialect="bigquery") 'A-B.c'
10120def replace_tables( 10121 expression: E, mapping: t.Dict[str, str], dialect: DialectType = None, copy: bool = True 10122) -> E: 10123 """Replace all tables in expression according to the mapping. 10124 10125 Args: 10126 expression: expression node to be transformed and replaced. 10127 mapping: mapping of table names. 10128 dialect: the dialect of the mapping table 10129 copy: whether to copy the expression. 10130 10131 Examples: 10132 >>> from sqlglot import exp, parse_one 10133 >>> replace_tables(parse_one("select * from a.b"), {"a.b": "c"}).sql() 10134 'SELECT * FROM c /* a.b */' 10135 10136 Returns: 10137 The mapped expression. 10138 """ 10139 10140 mapping = {normalize_table_name(k, dialect=dialect): v for k, v in mapping.items()} 10141 10142 def _replace_tables(node: Expression) -> Expression: 10143 if isinstance(node, Table) and node.meta.get("replace") is not False: 10144 original = normalize_table_name(node, dialect=dialect) 10145 new_name = mapping.get(original) 10146 10147 if new_name: 10148 table = to_table( 10149 new_name, 10150 **{k: v for k, v in node.args.items() if k not in TABLE_PARTS}, 10151 dialect=dialect, 10152 ) 10153 table.add_comments([original]) 10154 return table 10155 return node 10156 10157 return expression.transform(_replace_tables, copy=copy) # type: ignore
Replace all tables in expression according to the mapping.
Arguments:
- expression: expression node to be transformed and replaced.
- mapping: mapping of table names.
- dialect: the dialect of the mapping table
- copy: whether to copy the expression.
Examples:
>>> from sqlglot import exp, parse_one >>> replace_tables(parse_one("select * from a.b"), {"a.b": "c"}).sql() 'SELECT * FROM c /* a.b */'
Returns:
The mapped expression.
10160def replace_placeholders(expression: Expression, *args, **kwargs) -> Expression: 10161 """Replace placeholders in an expression. 10162 10163 Args: 10164 expression: expression node to be transformed and replaced. 10165 args: positional names that will substitute unnamed placeholders in the given order. 10166 kwargs: keyword arguments that will substitute named placeholders. 10167 10168 Examples: 10169 >>> from sqlglot import exp, parse_one 10170 >>> replace_placeholders( 10171 ... parse_one("select * from :tbl where ? = ?"), 10172 ... exp.to_identifier("str_col"), "b", tbl=exp.to_identifier("foo") 10173 ... ).sql() 10174 "SELECT * FROM foo WHERE str_col = 'b'" 10175 10176 Returns: 10177 The mapped expression. 10178 """ 10179 10180 def _replace_placeholders(node: Expression, args, **kwargs) -> Expression: 10181 if isinstance(node, Placeholder): 10182 if node.this: 10183 new_name = kwargs.get(node.this) 10184 if new_name is not None: 10185 return convert(new_name) 10186 else: 10187 try: 10188 return convert(next(args)) 10189 except StopIteration: 10190 pass 10191 return node 10192 10193 return expression.transform(_replace_placeholders, iter(args), **kwargs)
Replace placeholders in an expression.
Arguments:
- expression: expression node to be transformed and replaced.
- args: positional names that will substitute unnamed placeholders in the given order.
- kwargs: keyword arguments that will substitute named placeholders.
Examples:
>>> from sqlglot import exp, parse_one >>> replace_placeholders( ... parse_one("select * from :tbl where ? = ?"), ... exp.to_identifier("str_col"), "b", tbl=exp.to_identifier("foo") ... ).sql() "SELECT * FROM foo WHERE str_col = 'b'"
Returns:
The mapped expression.
10196def expand( 10197 expression: Expression, 10198 sources: t.Dict[str, Query | t.Callable[[], Query]], 10199 dialect: DialectType = None, 10200 copy: bool = True, 10201) -> Expression: 10202 """Transforms an expression by expanding all referenced sources into subqueries. 10203 10204 Examples: 10205 >>> from sqlglot import parse_one 10206 >>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y")}).sql() 10207 'SELECT * FROM (SELECT * FROM y) AS z /* source: x */' 10208 10209 >>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y"), "y": parse_one("select * from z")}).sql() 10210 'SELECT * FROM (SELECT * FROM (SELECT * FROM z) AS y /* source: y */) AS z /* source: x */' 10211 10212 Args: 10213 expression: The expression to expand. 10214 sources: A dict of name to query or a callable that provides a query on demand. 10215 dialect: The dialect of the sources dict or the callable. 10216 copy: Whether to copy the expression during transformation. Defaults to True. 10217 10218 Returns: 10219 The transformed expression. 10220 """ 10221 normalized_sources = {normalize_table_name(k, dialect=dialect): v for k, v in sources.items()} 10222 10223 def _expand(node: Expression): 10224 if isinstance(node, Table): 10225 name = normalize_table_name(node, dialect=dialect) 10226 source = normalized_sources.get(name) 10227 10228 if source: 10229 # Create a subquery with the same alias (or table name if no alias) 10230 parsed_source = source() if callable(source) else source 10231 subquery = parsed_source.subquery(node.alias or name) 10232 subquery.comments = [f"source: {name}"] 10233 10234 # Continue expanding within the subquery 10235 return subquery.transform(_expand, copy=False) 10236 10237 return node 10238 10239 return expression.transform(_expand, copy=copy)
Transforms an expression by expanding all referenced sources into subqueries.
Examples:
>>> from sqlglot import parse_one >>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y")}).sql() 'SELECT * FROM (SELECT * FROM y) AS z /* source: x */'>>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y"), "y": parse_one("select * from z")}).sql() 'SELECT * FROM (SELECT * FROM (SELECT * FROM z) AS y /* source: y */) AS z /* source: x */'
Arguments:
- expression: The expression to expand.
- sources: A dict of name to query or a callable that provides a query on demand.
- dialect: The dialect of the sources dict or the callable.
- copy: Whether to copy the expression during transformation. Defaults to True.
Returns:
The transformed expression.
10242def func(name: str, *args, copy: bool = True, dialect: DialectType = None, **kwargs) -> Func: 10243 """ 10244 Returns a Func expression. 10245 10246 Examples: 10247 >>> func("abs", 5).sql() 10248 'ABS(5)' 10249 10250 >>> func("cast", this=5, to=DataType.build("DOUBLE")).sql() 10251 'CAST(5 AS DOUBLE)' 10252 10253 Args: 10254 name: the name of the function to build. 10255 args: the args used to instantiate the function of interest. 10256 copy: whether to copy the argument expressions. 10257 dialect: the source dialect. 10258 kwargs: the kwargs used to instantiate the function of interest. 10259 10260 Note: 10261 The arguments `args` and `kwargs` are mutually exclusive. 10262 10263 Returns: 10264 An instance of the function of interest, or an anonymous function, if `name` doesn't 10265 correspond to an existing `sqlglot.expressions.Func` class. 10266 """ 10267 if args and kwargs: 10268 raise ValueError("Can't use both args and kwargs to instantiate a function.") 10269 10270 from sqlglot.dialects.dialect import Dialect 10271 10272 dialect = Dialect.get_or_raise(dialect) 10273 10274 converted: t.List[Expression] = [maybe_parse(arg, dialect=dialect, copy=copy) for arg in args] 10275 kwargs = {key: maybe_parse(value, dialect=dialect, copy=copy) for key, value in kwargs.items()} 10276 10277 constructor = dialect.parser_class.FUNCTIONS.get(name.upper()) 10278 if constructor: 10279 if converted: 10280 if "dialect" in constructor.__code__.co_varnames: 10281 function = constructor(converted, dialect=dialect) 10282 else: 10283 function = constructor(converted) 10284 elif constructor.__name__ == "from_arg_list": 10285 function = constructor.__self__(**kwargs) # type: ignore 10286 else: 10287 constructor = FUNCTION_BY_NAME.get(name.upper()) 10288 if constructor: 10289 function = constructor(**kwargs) 10290 else: 10291 raise ValueError( 10292 f"Unable to convert '{name}' into a Func. Either manually construct " 10293 "the Func expression of interest or parse the function call." 10294 ) 10295 else: 10296 kwargs = kwargs or {"expressions": converted} 10297 function = Anonymous(this=name, **kwargs) 10298 10299 for error_message in function.error_messages(converted): 10300 raise ValueError(error_message) 10301 10302 return function
Returns a Func expression.
Examples:
>>> func("abs", 5).sql() 'ABS(5)'>>> func("cast", this=5, to=DataType.build("DOUBLE")).sql() 'CAST(5 AS DOUBLE)'
Arguments:
- name: the name of the function to build.
- args: the args used to instantiate the function of interest.
- copy: whether to copy the argument expressions.
- dialect: the source dialect.
- kwargs: the kwargs used to instantiate the function of interest.
Note:
The arguments
argsandkwargsare mutually exclusive.
Returns:
An instance of the function of interest, or an anonymous function, if
namedoesn't correspond to an existingsqlglot.expressions.Funcclass.
10305def case( 10306 expression: t.Optional[ExpOrStr] = None, 10307 **opts, 10308) -> Case: 10309 """ 10310 Initialize a CASE statement. 10311 10312 Example: 10313 case().when("a = 1", "foo").else_("bar") 10314 10315 Args: 10316 expression: Optionally, the input expression (not all dialects support this) 10317 **opts: Extra keyword arguments for parsing `expression` 10318 """ 10319 if expression is not None: 10320 this = maybe_parse(expression, **opts) 10321 else: 10322 this = None 10323 return Case(this=this, ifs=[])
Initialize a CASE statement.
Example:
case().when("a = 1", "foo").else_("bar")
Arguments:
- expression: Optionally, the input expression (not all dialects support this)
- **opts: Extra keyword arguments for parsing
expression
10326def array( 10327 *expressions: ExpOrStr, copy: bool = True, dialect: DialectType = None, **kwargs 10328) -> Array: 10329 """ 10330 Returns an array. 10331 10332 Examples: 10333 >>> array(1, 'x').sql() 10334 'ARRAY(1, x)' 10335 10336 Args: 10337 expressions: the expressions to add to the array. 10338 copy: whether to copy the argument expressions. 10339 dialect: the source dialect. 10340 kwargs: the kwargs used to instantiate the function of interest. 10341 10342 Returns: 10343 An array expression. 10344 """ 10345 return Array( 10346 expressions=[ 10347 maybe_parse(expression, copy=copy, dialect=dialect, **kwargs) 10348 for expression in expressions 10349 ] 10350 )
Returns an array.
Examples:
>>> array(1, 'x').sql() 'ARRAY(1, x)'
Arguments:
- expressions: the expressions to add to the array.
- copy: whether to copy the argument expressions.
- dialect: the source dialect.
- kwargs: the kwargs used to instantiate the function of interest.
Returns:
An array expression.
10353def tuple_( 10354 *expressions: ExpOrStr, copy: bool = True, dialect: DialectType = None, **kwargs 10355) -> Tuple: 10356 """ 10357 Returns an tuple. 10358 10359 Examples: 10360 >>> tuple_(1, 'x').sql() 10361 '(1, x)' 10362 10363 Args: 10364 expressions: the expressions to add to the tuple. 10365 copy: whether to copy the argument expressions. 10366 dialect: the source dialect. 10367 kwargs: the kwargs used to instantiate the function of interest. 10368 10369 Returns: 10370 A tuple expression. 10371 """ 10372 return Tuple( 10373 expressions=[ 10374 maybe_parse(expression, copy=copy, dialect=dialect, **kwargs) 10375 for expression in expressions 10376 ] 10377 )
Returns an tuple.
Examples:
>>> tuple_(1, 'x').sql() '(1, x)'
Arguments:
- expressions: the expressions to add to the tuple.
- copy: whether to copy the argument expressions.
- dialect: the source dialect.
- kwargs: the kwargs used to instantiate the function of interest.
Returns:
A tuple expression.
10380def true() -> Boolean: 10381 """ 10382 Returns a true Boolean expression. 10383 """ 10384 return Boolean(this=True)
Returns a true Boolean expression.
10387def false() -> Boolean: 10388 """ 10389 Returns a false Boolean expression. 10390 """ 10391 return Boolean(this=False)
Returns a false Boolean expression.
Returns a Null expression.