sqlglot.dialects.doris
1from __future__ import annotations 2 3import typing as t 4 5from sqlglot import exp 6from sqlglot.dialects.dialect import ( 7 approx_count_distinct_sql, 8 property_sql, 9 rename_func, 10 time_format, 11 unit_to_str, 12) 13from sqlglot.dialects.mysql import MySQL 14from sqlglot.helper import seq_get 15from sqlglot.tokens import TokenType 16 17 18def _lag_lead_sql(self, expression: exp.Lag | exp.Lead) -> str: 19 return self.func( 20 "LAG" if isinstance(expression, exp.Lag) else "LEAD", 21 expression.this, 22 expression.args.get("offset") or exp.Literal.number(1), 23 expression.args.get("default") or exp.null(), 24 ) 25 26 27# Accept both DATE_TRUNC(datetime, unit) and DATE_TRUNC(unit, datetime) 28def _build_date_trunc(args: t.List[exp.Expression]) -> exp.Expression: 29 a0, a1 = seq_get(args, 0), seq_get(args, 1) 30 31 def _is_unit_like(e: exp.Expression | None) -> bool: 32 if not (isinstance(e, exp.Literal) and e.is_string): 33 return False 34 text = e.this 35 return not any(ch.isdigit() for ch in text) 36 37 # Determine which argument is the unit 38 unit, this = (a0, a1) if _is_unit_like(a0) else (a1, a0) 39 40 return exp.TimestampTrunc(this=this, unit=unit) 41 42 43class Doris(MySQL): 44 DATE_FORMAT = "'yyyy-MM-dd'" 45 DATEINT_FORMAT = "'yyyyMMdd'" 46 TIME_FORMAT = "'yyyy-MM-dd HH:mm:ss'" 47 48 class Parser(MySQL.Parser): 49 FUNCTIONS = { 50 **MySQL.Parser.FUNCTIONS, 51 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 52 "DATE_TRUNC": _build_date_trunc, 53 "L2_DISTANCE": exp.EuclideanDistance.from_arg_list, 54 "MONTHS_ADD": exp.AddMonths.from_arg_list, 55 "REGEXP": exp.RegexpLike.from_arg_list, 56 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 57 } 58 59 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 60 FUNCTION_PARSERS.pop("GROUP_CONCAT") 61 62 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 63 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 64 65 PROPERTY_PARSERS = { 66 **MySQL.Parser.PROPERTY_PARSERS, 67 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 68 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 69 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 70 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 71 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 72 "BUILD": lambda self: self._parse_build_property(), 73 "REFRESH": lambda self: self._parse_refresh_property(), 74 } 75 76 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 77 self._match_text_seq("FROM") 78 start = self._parse_wrapped(self._parse_string) 79 self._match_text_seq("TO") 80 end = self._parse_wrapped(self._parse_string) 81 self._match_text_seq("INTERVAL") 82 number = self._parse_number() 83 unit = self._parse_var(any_token=True) 84 every = self.expression(exp.Interval, this=number, unit=unit) 85 return self.expression( 86 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 87 ) 88 89 def _parse_partition_definition(self) -> exp.Partition: 90 self._match_text_seq("PARTITION") 91 92 name = self._parse_id_var() 93 self._match_text_seq("VALUES") 94 95 if self._match_text_seq("LESS", "THAN"): 96 values = self._parse_wrapped_csv(self._parse_expression) 97 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 98 values = [exp.var("MAXVALUE")] 99 100 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 101 return self.expression(exp.Partition, expressions=[part_range]) 102 103 self._match(TokenType.L_BRACKET) 104 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 105 106 self._match(TokenType.R_BRACKET) 107 self._match(TokenType.R_PAREN) 108 109 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 110 return self.expression(exp.Partition, expressions=[part_range]) 111 112 def _parse_partition_definition_list(self) -> exp.Partition: 113 # PARTITION <name> VALUES IN (<value_csv>) 114 self._match_text_seq("PARTITION") 115 name = self._parse_id_var() 116 self._match_text_seq("VALUES", "IN") 117 values = self._parse_wrapped_csv(self._parse_expression) 118 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 119 return self.expression(exp.Partition, expressions=[part_list]) 120 121 def _parse_partition_by_opt_range( 122 self, 123 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 124 if self._match_text_seq("LIST"): 125 return self.expression( 126 exp.PartitionByListProperty, 127 partition_expressions=self._parse_wrapped_id_vars(), 128 create_expressions=self._parse_wrapped_csv( 129 self._parse_partition_definition_list 130 ), 131 ) 132 133 if not self._match_text_seq("RANGE"): 134 return super()._parse_partitioned_by() 135 136 partition_expressions = self._parse_wrapped_id_vars() 137 self._match_l_paren() 138 139 if self._match_text_seq("FROM", advance=False): 140 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 141 elif self._match_text_seq("PARTITION", advance=False): 142 create_expressions = self._parse_csv(self._parse_partition_definition) 143 else: 144 create_expressions = None 145 146 self._match_r_paren() 147 148 return self.expression( 149 exp.PartitionByRangeProperty, 150 partition_expressions=partition_expressions, 151 create_expressions=create_expressions, 152 ) 153 154 def _parse_build_property(self) -> exp.BuildProperty: 155 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 156 157 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 158 method = self._parse_var(upper=True) 159 160 self._match(TokenType.ON) 161 162 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 163 every = self._match_text_seq("EVERY") and self._parse_number() 164 unit = self._parse_var(any_token=True) if every else None 165 starts = self._match_text_seq("STARTS") and self._parse_string() 166 167 return self.expression( 168 exp.RefreshTriggerProperty, 169 method=method, 170 kind=kind, 171 every=every, 172 unit=unit, 173 starts=starts, 174 ) 175 176 class Generator(MySQL.Generator): 177 LAST_DAY_SUPPORTS_DATE_PART = False 178 VARCHAR_REQUIRES_SIZE = False 179 WITH_PROPERTIES_PREFIX = "PROPERTIES" 180 RENAME_TABLE_WITH_DB = False 181 182 TYPE_MAPPING = { 183 **MySQL.Generator.TYPE_MAPPING, 184 exp.DataType.Type.TEXT: "STRING", 185 exp.DataType.Type.TIMESTAMP: "DATETIME", 186 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 187 } 188 189 PROPERTIES_LOCATION = { 190 **MySQL.Generator.PROPERTIES_LOCATION, 191 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 192 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 193 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 197 } 198 199 CAST_MAPPING = {} 200 TIMESTAMP_FUNC_TYPES = set() 201 202 TRANSFORMS = { 203 **MySQL.Generator.TRANSFORMS, 204 exp.AddMonths: rename_func("MONTHS_ADD"), 205 exp.ApproxDistinct: approx_count_distinct_sql, 206 exp.ArgMax: rename_func("MAX_BY"), 207 exp.ArgMin: rename_func("MIN_BY"), 208 exp.ArrayAgg: rename_func("COLLECT_LIST"), 209 exp.ArrayToString: rename_func("ARRAY_JOIN"), 210 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 211 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 212 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 213 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 214 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 215 exp.GroupConcat: lambda self, e: self.func( 216 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 217 ), 218 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 219 exp.Lag: _lag_lead_sql, 220 exp.Lead: _lag_lead_sql, 221 exp.Map: rename_func("ARRAY_MAP"), 222 exp.Property: property_sql, 223 exp.RegexpLike: rename_func("REGEXP"), 224 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 225 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 226 exp.Split: rename_func("SPLIT_BY_STRING"), 227 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 228 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 229 exp.TimeStrToDate: rename_func("TO_DATE"), 230 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 231 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 232 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 233 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 234 exp.UnixToStr: lambda self, e: self.func( 235 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 236 ), 237 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 238 } 239 240 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 241 RESERVED_KEYWORDS = { 242 "account_lock", 243 "account_unlock", 244 "add", 245 "adddate", 246 "admin", 247 "after", 248 "agg_state", 249 "aggregate", 250 "alias", 251 "all", 252 "alter", 253 "analyze", 254 "analyzed", 255 "and", 256 "anti", 257 "append", 258 "array", 259 "array_range", 260 "as", 261 "asc", 262 "at", 263 "authors", 264 "auto", 265 "auto_increment", 266 "backend", 267 "backends", 268 "backup", 269 "begin", 270 "belong", 271 "between", 272 "bigint", 273 "bin", 274 "binary", 275 "binlog", 276 "bitand", 277 "bitmap", 278 "bitmap_union", 279 "bitor", 280 "bitxor", 281 "blob", 282 "boolean", 283 "brief", 284 "broker", 285 "buckets", 286 "build", 287 "builtin", 288 "bulk", 289 "by", 290 "cached", 291 "call", 292 "cancel", 293 "case", 294 "cast", 295 "catalog", 296 "catalogs", 297 "chain", 298 "char", 299 "character", 300 "charset", 301 "check", 302 "clean", 303 "cluster", 304 "clusters", 305 "collate", 306 "collation", 307 "collect", 308 "column", 309 "columns", 310 "comment", 311 "commit", 312 "committed", 313 "compact", 314 "complete", 315 "config", 316 "connection", 317 "connection_id", 318 "consistent", 319 "constraint", 320 "constraints", 321 "convert", 322 "copy", 323 "count", 324 "create", 325 "creation", 326 "cron", 327 "cross", 328 "cube", 329 "current", 330 "current_catalog", 331 "current_date", 332 "current_time", 333 "current_timestamp", 334 "current_user", 335 "data", 336 "database", 337 "databases", 338 "date", 339 "date_add", 340 "date_ceil", 341 "date_diff", 342 "date_floor", 343 "date_sub", 344 "dateadd", 345 "datediff", 346 "datetime", 347 "datetimev2", 348 "datev2", 349 "datetimev1", 350 "datev1", 351 "day", 352 "days_add", 353 "days_sub", 354 "decimal", 355 "decimalv2", 356 "decimalv3", 357 "decommission", 358 "default", 359 "deferred", 360 "delete", 361 "demand", 362 "desc", 363 "describe", 364 "diagnose", 365 "disk", 366 "distinct", 367 "distinctpc", 368 "distinctpcsa", 369 "distributed", 370 "distribution", 371 "div", 372 "do", 373 "doris_internal_table_id", 374 "double", 375 "drop", 376 "dropp", 377 "dual", 378 "duplicate", 379 "dynamic", 380 "else", 381 "enable", 382 "encryptkey", 383 "encryptkeys", 384 "end", 385 "ends", 386 "engine", 387 "engines", 388 "enter", 389 "errors", 390 "events", 391 "every", 392 "except", 393 "exclude", 394 "execute", 395 "exists", 396 "expired", 397 "explain", 398 "export", 399 "extended", 400 "external", 401 "extract", 402 "failed_login_attempts", 403 "false", 404 "fast", 405 "feature", 406 "fields", 407 "file", 408 "filter", 409 "first", 410 "float", 411 "follower", 412 "following", 413 "for", 414 "foreign", 415 "force", 416 "format", 417 "free", 418 "from", 419 "frontend", 420 "frontends", 421 "full", 422 "function", 423 "functions", 424 "generic", 425 "global", 426 "grant", 427 "grants", 428 "graph", 429 "group", 430 "grouping", 431 "groups", 432 "hash", 433 "having", 434 "hdfs", 435 "help", 436 "histogram", 437 "hll", 438 "hll_union", 439 "hostname", 440 "hour", 441 "hub", 442 "identified", 443 "if", 444 "ignore", 445 "immediate", 446 "in", 447 "incremental", 448 "index", 449 "indexes", 450 "infile", 451 "inner", 452 "insert", 453 "install", 454 "int", 455 "integer", 456 "intermediate", 457 "intersect", 458 "interval", 459 "into", 460 "inverted", 461 "ipv4", 462 "ipv6", 463 "is", 464 "is_not_null_pred", 465 "is_null_pred", 466 "isnull", 467 "isolation", 468 "job", 469 "jobs", 470 "join", 471 "json", 472 "jsonb", 473 "key", 474 "keys", 475 "kill", 476 "label", 477 "largeint", 478 "last", 479 "lateral", 480 "ldap", 481 "ldap_admin_password", 482 "left", 483 "less", 484 "level", 485 "like", 486 "limit", 487 "lines", 488 "link", 489 "list", 490 "load", 491 "local", 492 "localtime", 493 "localtimestamp", 494 "location", 495 "lock", 496 "logical", 497 "low_priority", 498 "manual", 499 "map", 500 "match", 501 "match_all", 502 "match_any", 503 "match_phrase", 504 "match_phrase_edge", 505 "match_phrase_prefix", 506 "match_regexp", 507 "materialized", 508 "max", 509 "maxvalue", 510 "memo", 511 "merge", 512 "migrate", 513 "migrations", 514 "min", 515 "minus", 516 "minute", 517 "modify", 518 "month", 519 "mtmv", 520 "name", 521 "names", 522 "natural", 523 "negative", 524 "never", 525 "next", 526 "ngram_bf", 527 "no", 528 "non_nullable", 529 "not", 530 "null", 531 "nulls", 532 "observer", 533 "of", 534 "offset", 535 "on", 536 "only", 537 "open", 538 "optimized", 539 "or", 540 "order", 541 "outer", 542 "outfile", 543 "over", 544 "overwrite", 545 "parameter", 546 "parsed", 547 "partition", 548 "partitions", 549 "password", 550 "password_expire", 551 "password_history", 552 "password_lock_time", 553 "password_reuse", 554 "path", 555 "pause", 556 "percent", 557 "period", 558 "permissive", 559 "physical", 560 "plan", 561 "process", 562 "plugin", 563 "plugins", 564 "policy", 565 "preceding", 566 "prepare", 567 "primary", 568 "proc", 569 "procedure", 570 "processlist", 571 "profile", 572 "properties", 573 "property", 574 "quantile_state", 575 "quantile_union", 576 "query", 577 "quota", 578 "random", 579 "range", 580 "read", 581 "real", 582 "rebalance", 583 "recover", 584 "recycle", 585 "refresh", 586 "references", 587 "regexp", 588 "release", 589 "rename", 590 "repair", 591 "repeatable", 592 "replace", 593 "replace_if_not_null", 594 "replica", 595 "repositories", 596 "repository", 597 "resource", 598 "resources", 599 "restore", 600 "restrictive", 601 "resume", 602 "returns", 603 "revoke", 604 "rewritten", 605 "right", 606 "rlike", 607 "role", 608 "roles", 609 "rollback", 610 "rollup", 611 "routine", 612 "row", 613 "rows", 614 "s3", 615 "sample", 616 "schedule", 617 "scheduler", 618 "schema", 619 "schemas", 620 "second", 621 "select", 622 "semi", 623 "sequence", 624 "serializable", 625 "session", 626 "set", 627 "sets", 628 "shape", 629 "show", 630 "signed", 631 "skew", 632 "smallint", 633 "snapshot", 634 "soname", 635 "split", 636 "sql_block_rule", 637 "start", 638 "starts", 639 "stats", 640 "status", 641 "stop", 642 "storage", 643 "stream", 644 "streaming", 645 "string", 646 "struct", 647 "subdate", 648 "sum", 649 "superuser", 650 "switch", 651 "sync", 652 "system", 653 "table", 654 "tables", 655 "tablesample", 656 "tablet", 657 "tablets", 658 "task", 659 "tasks", 660 "temporary", 661 "terminated", 662 "text", 663 "than", 664 "then", 665 "time", 666 "timestamp", 667 "timestampadd", 668 "timestampdiff", 669 "tinyint", 670 "to", 671 "transaction", 672 "trash", 673 "tree", 674 "triggers", 675 "trim", 676 "true", 677 "truncate", 678 "type", 679 "type_cast", 680 "types", 681 "unbounded", 682 "uncommitted", 683 "uninstall", 684 "union", 685 "unique", 686 "unlock", 687 "unsigned", 688 "update", 689 "use", 690 "user", 691 "using", 692 "value", 693 "values", 694 "varchar", 695 "variables", 696 "variant", 697 "vault", 698 "verbose", 699 "version", 700 "view", 701 "warnings", 702 "week", 703 "when", 704 "where", 705 "whitelist", 706 "with", 707 "work", 708 "workload", 709 "write", 710 "xor", 711 "year", 712 } 713 714 def uniquekeyproperty_sql( 715 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 716 ) -> str: 717 create_stmt = expression.find_ancestor(exp.Create) 718 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 719 return super().uniquekeyproperty_sql(expression, prefix="KEY") 720 721 return super().uniquekeyproperty_sql(expression) 722 723 def partition_sql(self, expression: exp.Partition) -> str: 724 parent = expression.parent 725 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 726 return ", ".join(self.sql(e) for e in expression.expressions) 727 return super().partition_sql(expression) 728 729 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 730 name = self.sql(expression, "this") 731 values = expression.expressions 732 733 if len(values) != 1: 734 # Multiple values: use VALUES [ ... ) 735 if values and isinstance(values[0], list): 736 values_sql = ", ".join( 737 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 738 ) 739 else: 740 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 741 742 return f"PARTITION {name} VALUES [{values_sql})" 743 744 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 745 746 def partitionbyrangepropertydynamic_sql( 747 self, expression: exp.PartitionByRangePropertyDynamic 748 ) -> str: 749 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 750 start = self.sql(expression, "start") 751 end = self.sql(expression, "end") 752 every = expression.args.get("every") 753 754 if every: 755 number = self.sql(every, "this") 756 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 757 else: 758 interval = "" 759 760 return f"FROM ({start}) TO ({end}) {interval}" 761 762 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 763 partition_expressions = self.expressions( 764 expression, key="partition_expressions", indent=False 765 ) 766 create_sql = self.expressions(expression, key="create_expressions", indent=False) 767 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 768 769 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 770 partition_expressions = self.expressions( 771 expression, key="partition_expressions", indent=False 772 ) 773 create_sql = self.expressions(expression, key="create_expressions", indent=False) 774 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 775 776 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 777 name = self.sql(expression, "this") 778 values = self.expressions(expression, indent=False) 779 return f"PARTITION {name} VALUES IN ({values})" 780 781 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 782 node = expression.this 783 if isinstance(node, exp.Schema): 784 parts = ", ".join(self.sql(e) for e in node.expressions) 785 return f"PARTITION BY ({parts})" 786 return f"PARTITION BY ({self.sql(node)})" 787 788 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 789 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 790 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 791 if not isinstance(ancestor, exp.Select): 792 sep = " " 793 return super().table_sql(expression, sep=sep) 794 795 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 796 return super().alterrename_sql(expression, include_to=False)
44class Doris(MySQL): 45 DATE_FORMAT = "'yyyy-MM-dd'" 46 DATEINT_FORMAT = "'yyyyMMdd'" 47 TIME_FORMAT = "'yyyy-MM-dd HH:mm:ss'" 48 49 class Parser(MySQL.Parser): 50 FUNCTIONS = { 51 **MySQL.Parser.FUNCTIONS, 52 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 53 "DATE_TRUNC": _build_date_trunc, 54 "L2_DISTANCE": exp.EuclideanDistance.from_arg_list, 55 "MONTHS_ADD": exp.AddMonths.from_arg_list, 56 "REGEXP": exp.RegexpLike.from_arg_list, 57 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 58 } 59 60 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 61 FUNCTION_PARSERS.pop("GROUP_CONCAT") 62 63 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 64 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 65 66 PROPERTY_PARSERS = { 67 **MySQL.Parser.PROPERTY_PARSERS, 68 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 69 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 70 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 71 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 72 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 73 "BUILD": lambda self: self._parse_build_property(), 74 "REFRESH": lambda self: self._parse_refresh_property(), 75 } 76 77 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 78 self._match_text_seq("FROM") 79 start = self._parse_wrapped(self._parse_string) 80 self._match_text_seq("TO") 81 end = self._parse_wrapped(self._parse_string) 82 self._match_text_seq("INTERVAL") 83 number = self._parse_number() 84 unit = self._parse_var(any_token=True) 85 every = self.expression(exp.Interval, this=number, unit=unit) 86 return self.expression( 87 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 88 ) 89 90 def _parse_partition_definition(self) -> exp.Partition: 91 self._match_text_seq("PARTITION") 92 93 name = self._parse_id_var() 94 self._match_text_seq("VALUES") 95 96 if self._match_text_seq("LESS", "THAN"): 97 values = self._parse_wrapped_csv(self._parse_expression) 98 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 99 values = [exp.var("MAXVALUE")] 100 101 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 102 return self.expression(exp.Partition, expressions=[part_range]) 103 104 self._match(TokenType.L_BRACKET) 105 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 106 107 self._match(TokenType.R_BRACKET) 108 self._match(TokenType.R_PAREN) 109 110 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 111 return self.expression(exp.Partition, expressions=[part_range]) 112 113 def _parse_partition_definition_list(self) -> exp.Partition: 114 # PARTITION <name> VALUES IN (<value_csv>) 115 self._match_text_seq("PARTITION") 116 name = self._parse_id_var() 117 self._match_text_seq("VALUES", "IN") 118 values = self._parse_wrapped_csv(self._parse_expression) 119 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 120 return self.expression(exp.Partition, expressions=[part_list]) 121 122 def _parse_partition_by_opt_range( 123 self, 124 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 125 if self._match_text_seq("LIST"): 126 return self.expression( 127 exp.PartitionByListProperty, 128 partition_expressions=self._parse_wrapped_id_vars(), 129 create_expressions=self._parse_wrapped_csv( 130 self._parse_partition_definition_list 131 ), 132 ) 133 134 if not self._match_text_seq("RANGE"): 135 return super()._parse_partitioned_by() 136 137 partition_expressions = self._parse_wrapped_id_vars() 138 self._match_l_paren() 139 140 if self._match_text_seq("FROM", advance=False): 141 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 142 elif self._match_text_seq("PARTITION", advance=False): 143 create_expressions = self._parse_csv(self._parse_partition_definition) 144 else: 145 create_expressions = None 146 147 self._match_r_paren() 148 149 return self.expression( 150 exp.PartitionByRangeProperty, 151 partition_expressions=partition_expressions, 152 create_expressions=create_expressions, 153 ) 154 155 def _parse_build_property(self) -> exp.BuildProperty: 156 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 157 158 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 159 method = self._parse_var(upper=True) 160 161 self._match(TokenType.ON) 162 163 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 164 every = self._match_text_seq("EVERY") and self._parse_number() 165 unit = self._parse_var(any_token=True) if every else None 166 starts = self._match_text_seq("STARTS") and self._parse_string() 167 168 return self.expression( 169 exp.RefreshTriggerProperty, 170 method=method, 171 kind=kind, 172 every=every, 173 unit=unit, 174 starts=starts, 175 ) 176 177 class Generator(MySQL.Generator): 178 LAST_DAY_SUPPORTS_DATE_PART = False 179 VARCHAR_REQUIRES_SIZE = False 180 WITH_PROPERTIES_PREFIX = "PROPERTIES" 181 RENAME_TABLE_WITH_DB = False 182 183 TYPE_MAPPING = { 184 **MySQL.Generator.TYPE_MAPPING, 185 exp.DataType.Type.TEXT: "STRING", 186 exp.DataType.Type.TIMESTAMP: "DATETIME", 187 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 188 } 189 190 PROPERTIES_LOCATION = { 191 **MySQL.Generator.PROPERTIES_LOCATION, 192 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 193 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 197 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 198 } 199 200 CAST_MAPPING = {} 201 TIMESTAMP_FUNC_TYPES = set() 202 203 TRANSFORMS = { 204 **MySQL.Generator.TRANSFORMS, 205 exp.AddMonths: rename_func("MONTHS_ADD"), 206 exp.ApproxDistinct: approx_count_distinct_sql, 207 exp.ArgMax: rename_func("MAX_BY"), 208 exp.ArgMin: rename_func("MIN_BY"), 209 exp.ArrayAgg: rename_func("COLLECT_LIST"), 210 exp.ArrayToString: rename_func("ARRAY_JOIN"), 211 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 212 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 213 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 214 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 215 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 216 exp.GroupConcat: lambda self, e: self.func( 217 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 218 ), 219 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 220 exp.Lag: _lag_lead_sql, 221 exp.Lead: _lag_lead_sql, 222 exp.Map: rename_func("ARRAY_MAP"), 223 exp.Property: property_sql, 224 exp.RegexpLike: rename_func("REGEXP"), 225 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 226 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 227 exp.Split: rename_func("SPLIT_BY_STRING"), 228 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 229 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 230 exp.TimeStrToDate: rename_func("TO_DATE"), 231 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 232 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 233 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 234 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 235 exp.UnixToStr: lambda self, e: self.func( 236 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 237 ), 238 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 239 } 240 241 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 242 RESERVED_KEYWORDS = { 243 "account_lock", 244 "account_unlock", 245 "add", 246 "adddate", 247 "admin", 248 "after", 249 "agg_state", 250 "aggregate", 251 "alias", 252 "all", 253 "alter", 254 "analyze", 255 "analyzed", 256 "and", 257 "anti", 258 "append", 259 "array", 260 "array_range", 261 "as", 262 "asc", 263 "at", 264 "authors", 265 "auto", 266 "auto_increment", 267 "backend", 268 "backends", 269 "backup", 270 "begin", 271 "belong", 272 "between", 273 "bigint", 274 "bin", 275 "binary", 276 "binlog", 277 "bitand", 278 "bitmap", 279 "bitmap_union", 280 "bitor", 281 "bitxor", 282 "blob", 283 "boolean", 284 "brief", 285 "broker", 286 "buckets", 287 "build", 288 "builtin", 289 "bulk", 290 "by", 291 "cached", 292 "call", 293 "cancel", 294 "case", 295 "cast", 296 "catalog", 297 "catalogs", 298 "chain", 299 "char", 300 "character", 301 "charset", 302 "check", 303 "clean", 304 "cluster", 305 "clusters", 306 "collate", 307 "collation", 308 "collect", 309 "column", 310 "columns", 311 "comment", 312 "commit", 313 "committed", 314 "compact", 315 "complete", 316 "config", 317 "connection", 318 "connection_id", 319 "consistent", 320 "constraint", 321 "constraints", 322 "convert", 323 "copy", 324 "count", 325 "create", 326 "creation", 327 "cron", 328 "cross", 329 "cube", 330 "current", 331 "current_catalog", 332 "current_date", 333 "current_time", 334 "current_timestamp", 335 "current_user", 336 "data", 337 "database", 338 "databases", 339 "date", 340 "date_add", 341 "date_ceil", 342 "date_diff", 343 "date_floor", 344 "date_sub", 345 "dateadd", 346 "datediff", 347 "datetime", 348 "datetimev2", 349 "datev2", 350 "datetimev1", 351 "datev1", 352 "day", 353 "days_add", 354 "days_sub", 355 "decimal", 356 "decimalv2", 357 "decimalv3", 358 "decommission", 359 "default", 360 "deferred", 361 "delete", 362 "demand", 363 "desc", 364 "describe", 365 "diagnose", 366 "disk", 367 "distinct", 368 "distinctpc", 369 "distinctpcsa", 370 "distributed", 371 "distribution", 372 "div", 373 "do", 374 "doris_internal_table_id", 375 "double", 376 "drop", 377 "dropp", 378 "dual", 379 "duplicate", 380 "dynamic", 381 "else", 382 "enable", 383 "encryptkey", 384 "encryptkeys", 385 "end", 386 "ends", 387 "engine", 388 "engines", 389 "enter", 390 "errors", 391 "events", 392 "every", 393 "except", 394 "exclude", 395 "execute", 396 "exists", 397 "expired", 398 "explain", 399 "export", 400 "extended", 401 "external", 402 "extract", 403 "failed_login_attempts", 404 "false", 405 "fast", 406 "feature", 407 "fields", 408 "file", 409 "filter", 410 "first", 411 "float", 412 "follower", 413 "following", 414 "for", 415 "foreign", 416 "force", 417 "format", 418 "free", 419 "from", 420 "frontend", 421 "frontends", 422 "full", 423 "function", 424 "functions", 425 "generic", 426 "global", 427 "grant", 428 "grants", 429 "graph", 430 "group", 431 "grouping", 432 "groups", 433 "hash", 434 "having", 435 "hdfs", 436 "help", 437 "histogram", 438 "hll", 439 "hll_union", 440 "hostname", 441 "hour", 442 "hub", 443 "identified", 444 "if", 445 "ignore", 446 "immediate", 447 "in", 448 "incremental", 449 "index", 450 "indexes", 451 "infile", 452 "inner", 453 "insert", 454 "install", 455 "int", 456 "integer", 457 "intermediate", 458 "intersect", 459 "interval", 460 "into", 461 "inverted", 462 "ipv4", 463 "ipv6", 464 "is", 465 "is_not_null_pred", 466 "is_null_pred", 467 "isnull", 468 "isolation", 469 "job", 470 "jobs", 471 "join", 472 "json", 473 "jsonb", 474 "key", 475 "keys", 476 "kill", 477 "label", 478 "largeint", 479 "last", 480 "lateral", 481 "ldap", 482 "ldap_admin_password", 483 "left", 484 "less", 485 "level", 486 "like", 487 "limit", 488 "lines", 489 "link", 490 "list", 491 "load", 492 "local", 493 "localtime", 494 "localtimestamp", 495 "location", 496 "lock", 497 "logical", 498 "low_priority", 499 "manual", 500 "map", 501 "match", 502 "match_all", 503 "match_any", 504 "match_phrase", 505 "match_phrase_edge", 506 "match_phrase_prefix", 507 "match_regexp", 508 "materialized", 509 "max", 510 "maxvalue", 511 "memo", 512 "merge", 513 "migrate", 514 "migrations", 515 "min", 516 "minus", 517 "minute", 518 "modify", 519 "month", 520 "mtmv", 521 "name", 522 "names", 523 "natural", 524 "negative", 525 "never", 526 "next", 527 "ngram_bf", 528 "no", 529 "non_nullable", 530 "not", 531 "null", 532 "nulls", 533 "observer", 534 "of", 535 "offset", 536 "on", 537 "only", 538 "open", 539 "optimized", 540 "or", 541 "order", 542 "outer", 543 "outfile", 544 "over", 545 "overwrite", 546 "parameter", 547 "parsed", 548 "partition", 549 "partitions", 550 "password", 551 "password_expire", 552 "password_history", 553 "password_lock_time", 554 "password_reuse", 555 "path", 556 "pause", 557 "percent", 558 "period", 559 "permissive", 560 "physical", 561 "plan", 562 "process", 563 "plugin", 564 "plugins", 565 "policy", 566 "preceding", 567 "prepare", 568 "primary", 569 "proc", 570 "procedure", 571 "processlist", 572 "profile", 573 "properties", 574 "property", 575 "quantile_state", 576 "quantile_union", 577 "query", 578 "quota", 579 "random", 580 "range", 581 "read", 582 "real", 583 "rebalance", 584 "recover", 585 "recycle", 586 "refresh", 587 "references", 588 "regexp", 589 "release", 590 "rename", 591 "repair", 592 "repeatable", 593 "replace", 594 "replace_if_not_null", 595 "replica", 596 "repositories", 597 "repository", 598 "resource", 599 "resources", 600 "restore", 601 "restrictive", 602 "resume", 603 "returns", 604 "revoke", 605 "rewritten", 606 "right", 607 "rlike", 608 "role", 609 "roles", 610 "rollback", 611 "rollup", 612 "routine", 613 "row", 614 "rows", 615 "s3", 616 "sample", 617 "schedule", 618 "scheduler", 619 "schema", 620 "schemas", 621 "second", 622 "select", 623 "semi", 624 "sequence", 625 "serializable", 626 "session", 627 "set", 628 "sets", 629 "shape", 630 "show", 631 "signed", 632 "skew", 633 "smallint", 634 "snapshot", 635 "soname", 636 "split", 637 "sql_block_rule", 638 "start", 639 "starts", 640 "stats", 641 "status", 642 "stop", 643 "storage", 644 "stream", 645 "streaming", 646 "string", 647 "struct", 648 "subdate", 649 "sum", 650 "superuser", 651 "switch", 652 "sync", 653 "system", 654 "table", 655 "tables", 656 "tablesample", 657 "tablet", 658 "tablets", 659 "task", 660 "tasks", 661 "temporary", 662 "terminated", 663 "text", 664 "than", 665 "then", 666 "time", 667 "timestamp", 668 "timestampadd", 669 "timestampdiff", 670 "tinyint", 671 "to", 672 "transaction", 673 "trash", 674 "tree", 675 "triggers", 676 "trim", 677 "true", 678 "truncate", 679 "type", 680 "type_cast", 681 "types", 682 "unbounded", 683 "uncommitted", 684 "uninstall", 685 "union", 686 "unique", 687 "unlock", 688 "unsigned", 689 "update", 690 "use", 691 "user", 692 "using", 693 "value", 694 "values", 695 "varchar", 696 "variables", 697 "variant", 698 "vault", 699 "verbose", 700 "version", 701 "view", 702 "warnings", 703 "week", 704 "when", 705 "where", 706 "whitelist", 707 "with", 708 "work", 709 "workload", 710 "write", 711 "xor", 712 "year", 713 } 714 715 def uniquekeyproperty_sql( 716 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 717 ) -> str: 718 create_stmt = expression.find_ancestor(exp.Create) 719 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 720 return super().uniquekeyproperty_sql(expression, prefix="KEY") 721 722 return super().uniquekeyproperty_sql(expression) 723 724 def partition_sql(self, expression: exp.Partition) -> str: 725 parent = expression.parent 726 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 727 return ", ".join(self.sql(e) for e in expression.expressions) 728 return super().partition_sql(expression) 729 730 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 731 name = self.sql(expression, "this") 732 values = expression.expressions 733 734 if len(values) != 1: 735 # Multiple values: use VALUES [ ... ) 736 if values and isinstance(values[0], list): 737 values_sql = ", ".join( 738 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 739 ) 740 else: 741 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 742 743 return f"PARTITION {name} VALUES [{values_sql})" 744 745 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 746 747 def partitionbyrangepropertydynamic_sql( 748 self, expression: exp.PartitionByRangePropertyDynamic 749 ) -> str: 750 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 751 start = self.sql(expression, "start") 752 end = self.sql(expression, "end") 753 every = expression.args.get("every") 754 755 if every: 756 number = self.sql(every, "this") 757 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 758 else: 759 interval = "" 760 761 return f"FROM ({start}) TO ({end}) {interval}" 762 763 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 764 partition_expressions = self.expressions( 765 expression, key="partition_expressions", indent=False 766 ) 767 create_sql = self.expressions(expression, key="create_expressions", indent=False) 768 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 769 770 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 771 partition_expressions = self.expressions( 772 expression, key="partition_expressions", indent=False 773 ) 774 create_sql = self.expressions(expression, key="create_expressions", indent=False) 775 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 776 777 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 778 name = self.sql(expression, "this") 779 values = self.expressions(expression, indent=False) 780 return f"PARTITION {name} VALUES IN ({values})" 781 782 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 783 node = expression.this 784 if isinstance(node, exp.Schema): 785 parts = ", ".join(self.sql(e) for e in node.expressions) 786 return f"PARTITION BY ({parts})" 787 return f"PARTITION BY ({self.sql(node)})" 788 789 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 790 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 791 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 792 if not isinstance(ancestor, exp.Select): 793 sep = " " 794 return super().table_sql(expression, sep=sep) 795 796 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 797 return super().alterrename_sql(expression, include_to=False)
UNESCAPED_SEQUENCES: Dict[str, str] =
{'\\a': '\x07', '\\b': '\x08', '\\f': '\x0c', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\v': '\x0b', '\\\\': '\\'}
Mapping of an escaped sequence (\n
) to its unescaped version (
).
tokenizer_class =
<class 'sqlglot.tokens.Tokenizer'>
parser_class =
<class 'Doris.Parser'>
generator_class =
<class 'Doris.Generator'>
TIME_TRIE: Dict =
{'%': {'M': {0: True}, 'c': {0: True}, 'e': {0: True}, 'h': {0: True}, 'i': {0: True}, 's': {0: True}, 'u': {0: True}, 'k': {0: True}, 'l': {0: True}, 'T': {0: True}, 'W': {0: True}}}
FORMAT_TRIE: Dict =
{'%': {'M': {0: True}, 'c': {0: True}, 'e': {0: True}, 'h': {0: True}, 'i': {0: True}, 's': {0: True}, 'u': {0: True}, 'k': {0: True}, 'l': {0: True}, 'T': {0: True}, 'W': {0: True}}}
INVERSE_TIME_MAPPING: Dict[str, str] =
{'%B': '%M', '%-m': '%c', '%-d': '%e', '%I': '%h', '%M': '%i', '%S': '%s', '%W': '%u', '%-H': '%k', '%-I': '%l', '%H:%M:%S': '%T', '%A': '%W'}
INVERSE_TIME_TRIE: Dict =
{'%': {'B': {0: True}, '-': {'m': {0: True}, 'd': {0: True}, 'H': {0: True}, 'I': {0: True}}, 'I': {0: True}, 'M': {0: True}, 'S': {0: True}, 'W': {0: True}, 'H': {':': {'%': {'M': {':': {'%': {'S': {0: True}}}}}}}, 'A': {0: True}}}
49 class Parser(MySQL.Parser): 50 FUNCTIONS = { 51 **MySQL.Parser.FUNCTIONS, 52 "COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list, 53 "DATE_TRUNC": _build_date_trunc, 54 "L2_DISTANCE": exp.EuclideanDistance.from_arg_list, 55 "MONTHS_ADD": exp.AddMonths.from_arg_list, 56 "REGEXP": exp.RegexpLike.from_arg_list, 57 "TO_DATE": exp.TsOrDsToDate.from_arg_list, 58 } 59 60 FUNCTION_PARSERS = MySQL.Parser.FUNCTION_PARSERS.copy() 61 FUNCTION_PARSERS.pop("GROUP_CONCAT") 62 63 NO_PAREN_FUNCTIONS = MySQL.Parser.NO_PAREN_FUNCTIONS.copy() 64 NO_PAREN_FUNCTIONS.pop(TokenType.CURRENT_DATE) 65 66 PROPERTY_PARSERS = { 67 **MySQL.Parser.PROPERTY_PARSERS, 68 "PROPERTIES": lambda self: self._parse_wrapped_properties(), 69 "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 70 # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False 71 "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty), 72 "PARTITION BY": lambda self: self._parse_partition_by_opt_range(), 73 "BUILD": lambda self: self._parse_build_property(), 74 "REFRESH": lambda self: self._parse_refresh_property(), 75 } 76 77 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 78 self._match_text_seq("FROM") 79 start = self._parse_wrapped(self._parse_string) 80 self._match_text_seq("TO") 81 end = self._parse_wrapped(self._parse_string) 82 self._match_text_seq("INTERVAL") 83 number = self._parse_number() 84 unit = self._parse_var(any_token=True) 85 every = self.expression(exp.Interval, this=number, unit=unit) 86 return self.expression( 87 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 88 ) 89 90 def _parse_partition_definition(self) -> exp.Partition: 91 self._match_text_seq("PARTITION") 92 93 name = self._parse_id_var() 94 self._match_text_seq("VALUES") 95 96 if self._match_text_seq("LESS", "THAN"): 97 values = self._parse_wrapped_csv(self._parse_expression) 98 if len(values) == 1 and values[0].name.upper() == "MAXVALUE": 99 values = [exp.var("MAXVALUE")] 100 101 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 102 return self.expression(exp.Partition, expressions=[part_range]) 103 104 self._match(TokenType.L_BRACKET) 105 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 106 107 self._match(TokenType.R_BRACKET) 108 self._match(TokenType.R_PAREN) 109 110 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 111 return self.expression(exp.Partition, expressions=[part_range]) 112 113 def _parse_partition_definition_list(self) -> exp.Partition: 114 # PARTITION <name> VALUES IN (<value_csv>) 115 self._match_text_seq("PARTITION") 116 name = self._parse_id_var() 117 self._match_text_seq("VALUES", "IN") 118 values = self._parse_wrapped_csv(self._parse_expression) 119 part_list = self.expression(exp.PartitionList, this=name, expressions=values) 120 return self.expression(exp.Partition, expressions=[part_list]) 121 122 def _parse_partition_by_opt_range( 123 self, 124 ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty: 125 if self._match_text_seq("LIST"): 126 return self.expression( 127 exp.PartitionByListProperty, 128 partition_expressions=self._parse_wrapped_id_vars(), 129 create_expressions=self._parse_wrapped_csv( 130 self._parse_partition_definition_list 131 ), 132 ) 133 134 if not self._match_text_seq("RANGE"): 135 return super()._parse_partitioned_by() 136 137 partition_expressions = self._parse_wrapped_id_vars() 138 self._match_l_paren() 139 140 if self._match_text_seq("FROM", advance=False): 141 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 142 elif self._match_text_seq("PARTITION", advance=False): 143 create_expressions = self._parse_csv(self._parse_partition_definition) 144 else: 145 create_expressions = None 146 147 self._match_r_paren() 148 149 return self.expression( 150 exp.PartitionByRangeProperty, 151 partition_expressions=partition_expressions, 152 create_expressions=create_expressions, 153 ) 154 155 def _parse_build_property(self) -> exp.BuildProperty: 156 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 157 158 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 159 method = self._parse_var(upper=True) 160 161 self._match(TokenType.ON) 162 163 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 164 every = self._match_text_seq("EVERY") and self._parse_number() 165 unit = self._parse_var(any_token=True) if every else None 166 starts = self._match_text_seq("STARTS") and self._parse_string() 167 168 return self.expression( 169 exp.RefreshTriggerProperty, 170 method=method, 171 kind=kind, 172 every=every, 173 unit=unit, 174 starts=starts, 175 )
Parser consumes a list of tokens produced by the Tokenizer and produces a parsed syntax tree.
Arguments:
- error_level: The desired error level. Default: ErrorLevel.IMMEDIATE
- error_message_context: The amount of context to capture from a query string when displaying the error message (in number of characters). Default: 100
- max_errors: Maximum number of error messages to include in a raised ParseError. This is only relevant if error_level is ErrorLevel.RAISE. Default: 3
FUNCTIONS =
{'AI_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AIAgg'>>, 'AI_CLASSIFY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AIClassify'>>, 'AI_SUMMARIZE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AISummarizeAgg'>>, 'ABS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Abs'>>, 'ACOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Acos'>>, 'ACOSH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Acosh'>>, 'ADD_MONTHS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AddMonths'>>, 'AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.And'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnonymousAggFunc'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'APPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Apply'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantile'>>, 'APPROX_QUANTILES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantiles'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopK'>>, 'APPROX_TOP_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopSum'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARGMAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'MAX_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARGMIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'MIN_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARRAY': <function Parser.<lambda>>, 'ARRAY_AGG': <function Parser.<lambda>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAll'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAny'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CONCAT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcatAgg'>>, 'ARRAY_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFirst'>>, 'ARRAY_INTERSECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_INTERSECTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayLast'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, 'ARRAY_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayRemove'>>, 'ARRAY_REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayReverse'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySlice'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ascii'>>, 'ASIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asin'>>, 'ASINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asinh'>>, 'ATAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan'>>, 'ATAN2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan2'>>, 'ATANH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atanh'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'BITWISE_AND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BITWISE_COUNT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCountAgg'>>, 'BITWISE_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseOrAgg'>>, 'BITWISE_XOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseXorAgg'>>, 'BYTE_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ByteLength'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHR': <function Parser.<lambda>>, 'CHAR': <function Parser.<lambda>>, 'COALESCE': <function build_coalesce>, 'IFNULL': <function build_coalesce>, 'NVL': <function build_coalesce>, 'CODE_POINTS_TO_BYTES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToBytes'>>, 'CODE_POINTS_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToString'>>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COLUMNS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Columns'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedAggFunc'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedParameterizedAgg'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConnectByRoot'>>, 'CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, 'CONVERT_TO_CHARSET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConvertToCharset'>>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COSINE_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CosineDistance'>>, 'COT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cot'>>, 'COTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coth'>>, 'COUNT': <function Parser.<lambda>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COVAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarPop'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarSamp'>>, 'CSC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csc'>>, 'CSCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csch'>>, 'CUME_DIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CumeDist'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTime'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'CURRENT_TIMESTAMP_L_T_Z': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestampLTZ'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'DATE': <function MySQL.Parser.<lambda>>, 'DATE_ADD': <function build_date_delta_with_interval.<locals>._builder>, 'DATE_BIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateBin'>>, 'DATEDIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateDiff'>>, 'DATE_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateDiff'>>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromParts'>>, 'DATE_FROM_UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateFromUnixDate'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateStrToDate'>>, 'DATE_SUB': <function build_date_delta_with_interval.<locals>._builder>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateToDi'>>, 'DATE_TRUNC': <function _build_date_trunc>, 'DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Datetime'>>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeAdd'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeDiff'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeSub'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeTrunc'>>, 'DAY': <function MySQL.Parser.<lambda>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAYOFMONTH': <function MySQL.Parser.<lambda>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK': <function MySQL.Parser.<lambda>>, 'DAYOFWEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'ISODOW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DAYOFYEAR': <function MySQL.Parser.<lambda>>, 'DECODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decode'>>, 'DECODE_CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecodeCase'>>, 'DENSE_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DenseRank'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DiToDate'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'ENDS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'ENDSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'EUCLIDEAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EuclideanDistance'>>, 'EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exists'>>, 'EXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exp'>>, 'EXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Explode'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodeOuter'>>, 'EXPLODING_GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodingGenerateSeries'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, 'FARM_FINGERPRINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FARMFINGERPRINT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FEATURES_AT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FeaturesAtTime'>>, 'FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.First'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FirstValue'>>, 'FLATTEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Flatten'>>, 'FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Float64'>>, 'FLOOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Floor'>>, 'FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase'>>, 'FROM_BASE32': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase32'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase64'>>, 'FROM_ISO8601_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromISO8601Timestamp'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <function Parser.<lambda>>, 'GENERATE_EMBEDDING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateEmbedding'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, 'GET_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GetExtract'>>, 'GREATEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Greatest'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'GROUPING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Grouping'>>, 'HEX': <function build_hex>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'IIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'INITCAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Initcap'>>, 'INLINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Inline'>>, 'INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Int64'>>, 'IS_ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsAscii'>>, 'IS_INF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'ISINF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'IS_NAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'ISNAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArray'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAgg'>>, 'JSON_ARRAY_APPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAppend'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayContains'>>, 'JSON_ARRAY_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayInsert'>>, 'JSONB_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContains'>>, 'J_S_O_N_B_CONTAINS_ALL_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>>, 'J_S_O_N_B_CONTAINS_ANY_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAnyTopKeys'>>, 'J_S_O_N_B_DELETE_AT_PATH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBDeleteAtPath'>>, 'JSONB_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExists'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtract'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtractScalar'>>, 'J_S_O_N_B_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBObjectAgg'>>, 'J_S_O_N_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBool'>>, 'J_S_O_N_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONCast'>>, 'J_S_O_N_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExists'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExtractArray'>>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONFormat'>>, 'J_S_O_N_KEYS_AT_DEPTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONKeysAtDepth'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObject'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObjectAgg'>>, 'JSON_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONRemove'>>, 'JSON_SET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONSet'>>, 'JSON_STRIP_NULLS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONStripNulls'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONTable'>>, 'JSON_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONType'>>, 'J_S_O_N_VALUE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONValueArray'>>, 'JUSTIFY_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyDays'>>, 'JUSTIFY_HOURS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyHours'>>, 'JUSTIFY_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyInterval'>>, 'LAG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lag'>>, 'LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Last'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastValue'>>, 'LAX_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxBool'>>, 'LAX_FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxFloat64'>>, 'LAX_INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxInt64'>>, 'LAX_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxString'>>, 'LEAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lead'>>, 'LEAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Least'>>, 'LEFT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Left'>>, 'LENGTH': <function MySQL.Parser.<lambda>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHAR_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHARACTER_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.List'>>, 'LN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ln'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LowerHex'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'M_D5_NUMBER_LOWER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberLower64'>>, 'M_D5_NUMBER_UPPER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberUpper64'>>, 'M_L_FORECAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLForecast'>>, 'M_L_TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLTranslate'>>, 'MAKE_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MakeInterval'>>, 'MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Map'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MatchAgainst'>>, 'MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Max'>>, 'MEDIAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Median'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MONTH': <function MySQL.Parser.<lambda>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMALIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normalize'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ntile'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, 'OBJECT_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectInsert'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Or'>>, 'OVERLAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Overlay'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_BIGNUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseBignumeric'>>, 'PARSE_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseDatetime'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PARSE_NUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseNumeric'>>, 'PARSE_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseTime'>>, 'PERCENT_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentRank'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANGE_BUCKET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeBucket'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rank'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_EXTRACT_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtractAll'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpILike'>>, 'REGEXP_INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpInstr'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'REGEXP_REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpReplace'>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpSplit'>>, 'REPEAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Repeat'>>, 'REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Replace'>>, 'REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reverse'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'S_H_A1_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA1Digest'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'S_H_A2_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2Digest'>>, 'SAFE_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeAdd'>>, 'SAFE_CONVERT_BYTES_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeConvertBytesToString'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SAFE_MULTIPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeMultiply'>>, 'SAFE_NEGATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeNegate'>>, 'SAFE_SUBTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeSubtract'>>, 'SEC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sec'>>, 'SECH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sech'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sin'>>, 'SINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sinh'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SOUNDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Soundex'>>, 'SPACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Space'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SPLIT_PART': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SplitPart'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'ST_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StDistance'>>, 'ST_POINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'ST_MAKEPOINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <function _str_to_date>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.String'>>, 'STRING_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'SPLIT_BY_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRTOK_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StructExtract'>>, 'STUFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUBSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUBSTRING_INDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SubstringIndex'>>, 'SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sum'>>, 'TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Time'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeAdd'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeDiff'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToDate'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToTime'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToUnix'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSub'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToStr'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToUnix'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeTrunc'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Timestamp'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampAdd'>>, 'TIMESTAMPDIFF': <function build_date_delta.<locals>._builder>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampSub'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTrunc'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToArray'>>, 'TO_BASE32': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase32'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase64'>>, 'TO_CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToChar'>>, 'TO_CODE_POINTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToCodePoints'>>, 'TO_DAYS': <function MySQL.Parser.<lambda>>, 'TO_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, 'TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToMap'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToNumber'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Transform'>>, 'TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Translate'>>, 'TRIM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Trim'>>, 'TRY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Try'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDiToDi'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsAdd'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsDiff'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDatetime'>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTime'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTimestamp'>>, 'TYPEOF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Typeof'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNICODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unicode'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_MICROS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMicros'>>, 'UNIX_MILLIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMillis'>>, 'UNIX_SECONDS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixSeconds'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToStr'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTime'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTimeStr'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UTC_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcDate'>>, 'UTC_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTime'>>, 'UTC_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTimestamp'>>, 'UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'UUID_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VECTOR_SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VectorSearch'>>, 'WEEK': <function MySQL.Parser.<lambda>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <function MySQL.Parser.<lambda>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Xor'>>, 'YEAR': <function MySQL.Parser.<lambda>>, 'ARRAYAGG': <function Parser.<lambda>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'STRPOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'CHARINDEX': <function Parser.<lambda>>, 'INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'LOCATE': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'BIT_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BIT_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseOrAgg'>>, 'BIT_XOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseXorAgg'>>, 'BIT_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCountAgg'>>, 'CONVERT_TZ': <function MySQL.Parser.<lambda>>, 'CURDATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'DATE_FORMAT': <function build_formatted_time.<locals>._builder>, 'FROM_UNIXTIME': <function build_formatted_time.<locals>._builder>, 'ISNULL': <function isnull_to_is_null>, 'MAKETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'MONTHNAME': <function MySQL.Parser.<lambda>>, 'SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'COLLECT_SET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'L2_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EuclideanDistance'>>, 'MONTHS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AddMonths'>>, 'REGEXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>}
FUNCTION_PARSERS =
{'ARG_MAX': <function Parser.<dictcomp>.<lambda>>, 'ARGMAX': <function Parser.<dictcomp>.<lambda>>, 'MAX_BY': <function Parser.<dictcomp>.<lambda>>, 'ARG_MIN': <function Parser.<dictcomp>.<lambda>>, 'ARGMIN': <function Parser.<dictcomp>.<lambda>>, 'MIN_BY': <function Parser.<dictcomp>.<lambda>>, 'CAST': <function Parser.<lambda>>, 'CEIL': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'MATCH': <function Parser.<lambda>>, 'NORMALIZE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'OVERLAY': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'XMLELEMENT': <function Parser.<lambda>>, 'XMLTABLE': <function Parser.<lambda>>, 'CHAR': <function MySQL.Parser.<lambda>>, 'VALUES': <function MySQL.Parser.<lambda>>, 'JSON_VALUE': <function MySQL.Parser.<lambda>>, 'SUBSTR': <function MySQL.Parser.<lambda>>}
NO_PAREN_FUNCTIONS =
{<TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>: <class 'sqlglot.expressions.CurrentTime'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>: <class 'sqlglot.expressions.CurrentTimestamp'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>: <class 'sqlglot.expressions.CurrentUser'>}
PROPERTY_PARSERS =
{'ALLOWED_VALUES': <function Parser.<lambda>>, 'ALGORITHM': <function Parser.<lambda>>, 'AUTO': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'BACKUP': <function Parser.<lambda>>, 'BLOCKCOMPRESSION': <function Parser.<lambda>>, 'CHARSET': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECKSUM': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Parser.<lambda>>, 'CONTAINS': <function Parser.<lambda>>, 'COPY': <function Parser.<lambda>>, 'DATABLOCKSIZE': <function Parser.<lambda>>, 'DATA_DELETION': <function Parser.<lambda>>, 'DEFINER': <function Parser.<lambda>>, 'DETERMINISTIC': <function Parser.<lambda>>, 'DISTRIBUTED': <function Parser.<lambda>>, 'DUPLICATE': <function Parser.<lambda>>, 'DYNAMIC': <function Parser.<lambda>>, 'DISTKEY': <function Parser.<lambda>>, 'DISTSTYLE': <function Parser.<lambda>>, 'EMPTY': <function Parser.<lambda>>, 'ENGINE': <function Parser.<lambda>>, 'ENVIRONMENT': <function Parser.<lambda>>, 'EXECUTE': <function Parser.<lambda>>, 'EXTERNAL': <function Parser.<lambda>>, 'FALLBACK': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'FREESPACE': <function Parser.<lambda>>, 'GLOBAL': <function Parser.<lambda>>, 'HEAP': <function Parser.<lambda>>, 'ICEBERG': <function Parser.<lambda>>, 'IMMUTABLE': <function Parser.<lambda>>, 'INHERITS': <function Parser.<lambda>>, 'INPUT': <function Parser.<lambda>>, 'JOURNAL': <function Parser.<lambda>>, 'LANGUAGE': <function Parser.<lambda>>, 'LAYOUT': <function Parser.<lambda>>, 'LIFETIME': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'LOCATION': <function Parser.<lambda>>, 'LOCK': <function MySQL.Parser.<lambda>>, 'LOCKING': <function Parser.<lambda>>, 'LOG': <function Parser.<lambda>>, 'MATERIALIZED': <function Parser.<lambda>>, 'MERGEBLOCKRATIO': <function Parser.<lambda>>, 'MODIFIES': <function Parser.<lambda>>, 'MULTISET': <function Parser.<lambda>>, 'NO': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'ORDER BY': <function Parser.<lambda>>, 'OUTPUT': <function Parser.<lambda>>, 'PARTITION': <function Parser.<lambda>>, 'PARTITION BY': <function Doris.Parser.<lambda>>, 'PARTITIONED BY': <function Parser.<lambda>>, 'PARTITIONED_BY': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'RANGE': <function Parser.<lambda>>, 'READS': <function Parser.<lambda>>, 'REMOTE': <function Parser.<lambda>>, 'RETURNS': <function Parser.<lambda>>, 'STRICT': <function Parser.<lambda>>, 'STREAMING': <function Parser.<lambda>>, 'ROW': <function Parser.<lambda>>, 'ROW_FORMAT': <function Parser.<lambda>>, 'SAMPLE': <function Parser.<lambda>>, 'SECURE': <function Parser.<lambda>>, 'SECURITY': <function Parser.<lambda>>, 'SET': <function Parser.<lambda>>, 'SETTINGS': <function Parser.<lambda>>, 'SHARING': <function Parser.<lambda>>, 'SORTKEY': <function Parser.<lambda>>, 'SOURCE': <function Parser.<lambda>>, 'STABLE': <function Parser.<lambda>>, 'STORED': <function Parser.<lambda>>, 'SYSTEM_VERSIONING': <function Parser.<lambda>>, 'TBLPROPERTIES': <function Parser.<lambda>>, 'TEMP': <function Parser.<lambda>>, 'TEMPORARY': <function Parser.<lambda>>, 'TO': <function Parser.<lambda>>, 'TRANSIENT': <function Parser.<lambda>>, 'TRANSFORM': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'USING': <function Parser.<lambda>>, 'UNLOGGED': <function Parser.<lambda>>, 'VOLATILE': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>, 'PROPERTIES': <function Doris.Parser.<lambda>>, 'UNIQUE': <function Doris.Parser.<lambda>>, 'KEY': <function Doris.Parser.<lambda>>, 'BUILD': <function Doris.Parser.<lambda>>, 'REFRESH': <function Doris.Parser.<lambda>>}
TABLE_ALIAS_TOKENS =
{<TokenType.INDEX: 'INDEX'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.JSONB: 'JSONB'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.XML: 'XML'>, <TokenType.SINK: 'SINK'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.IPV4: 'IPV4'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.TIME: 'TIME'>, <TokenType.ASC: 'ASC'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.NULL: 'NULL'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.BLOB: 'BLOB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.TAG: 'TAG'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FILTER: 'FILTER'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.BIT: 'BIT'>, <TokenType.PUT: 'PUT'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.SHOW: 'SHOW'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DIV: 'DIV'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.KILL: 'KILL'>, <TokenType.DATE32: 'DATE32'>, <TokenType.CHAR: 'CHAR'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.ALL: 'ALL'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.TABLE: 'TABLE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.ROWS: 'ROWS'>, <TokenType.SET: 'SET'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.MAP: 'MAP'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.FINAL: 'FINAL'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.CUBE: 'CUBE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.ROW: 'ROW'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.END: 'END'>, <TokenType.INT256: 'INT256'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.INET: 'INET'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.GET: 'GET'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.STAGE: 'STAGE'>, <TokenType.IS: 'IS'>, <TokenType.VAR: 'VAR'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.BINARY: 'BINARY'>, <TokenType.POINT: 'POINT'>, <TokenType.CASE: 'CASE'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.NESTED: 'NESTED'>, <TokenType.TRUE: 'TRUE'>, <TokenType.UUID: 'UUID'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.MONEY: 'MONEY'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.UINT128: 'UINT128'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.SESSION: 'SESSION'>, <TokenType.ANY: 'ANY'>, <TokenType.MERGE: 'MERGE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.RANGE: 'RANGE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.VOID: 'VOID'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.DESC: 'DESC'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.MODEL: 'MODEL'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.INT128: 'INT128'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.ENUM: 'ENUM'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.IPV6: 'IPV6'>, <TokenType.SUPER: 'SUPER'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.YEAR: 'YEAR'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.UINT: 'UINT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.FALSE: 'FALSE'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.LIST: 'LIST'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.VIEW: 'VIEW'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.FIRST: 'FIRST'>, <TokenType.UINT256: 'UINT256'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.RING: 'RING'>, <TokenType.TOP: 'TOP'>, <TokenType.KEEP: 'KEEP'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.NEXT: 'NEXT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.INT: 'INT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.RENAME: 'RENAME'>, <TokenType.DATE: 'DATE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.JSON: 'JSON'>, <TokenType.NAME: 'NAME'>, <TokenType.LOAD: 'LOAD'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.CACHE: 'CACHE'>, <TokenType.COPY: 'COPY'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.DELETE: 'DELETE'>, <TokenType.ANTI: 'ANTI'>, <TokenType.SOME: 'SOME'>}
SHOW_TRIE: Dict =
{'BINARY': {'LOGS': {0: True}}, 'MASTER': {'LOGS': {0: True}, 'STATUS': {0: True}}, 'BINLOG': {'EVENTS': {0: True}}, 'CHARACTER': {'SET': {0: True}}, 'CHARSET': {0: True}, 'COLLATION': {0: True}, 'FULL': {'COLUMNS': {0: True}, 'PROCESSLIST': {0: True}, 'TABLES': {0: True}}, 'COLUMNS': {0: True}, 'CREATE': {'DATABASE': {0: True}, 'EVENT': {0: True}, 'FUNCTION': {0: True}, 'PROCEDURE': {0: True}, 'TABLE': {0: True}, 'TRIGGER': {0: True}, 'VIEW': {0: True}}, 'DATABASES': {0: True}, 'SCHEMAS': {0: True}, 'ENGINE': {0: True}, 'STORAGE': {'ENGINES': {0: True}}, 'ENGINES': {0: True}, 'ERRORS': {0: True}, 'EVENTS': {0: True}, 'FUNCTION': {'CODE': {0: True}, 'STATUS': {0: True}}, 'GRANTS': {0: True}, 'INDEX': {0: True}, 'OPEN': {'TABLES': {0: True}}, 'PLUGINS': {0: True}, 'PROCEDURE': {'CODE': {0: True}, 'STATUS': {0: True}}, 'PRIVILEGES': {0: True}, 'PROCESSLIST': {0: True}, 'PROFILE': {0: True}, 'PROFILES': {0: True}, 'RELAYLOG': {'EVENTS': {0: True}}, 'REPLICAS': {0: True}, 'SLAVE': {'HOSTS': {0: True}, 'STATUS': {0: True}}, 'REPLICA': {'STATUS': {0: True}}, 'GLOBAL': {'STATUS': {0: True}, 'VARIABLES': {0: True}}, 'SESSION': {'STATUS': {0: True}, 'VARIABLES': {0: True}}, 'STATUS': {0: True}, 'TABLE': {'STATUS': {0: True}}, 'TABLES': {0: True}, 'TRIGGERS': {0: True}, 'VARIABLES': {0: True}, 'WARNINGS': {0: True}}
SET_TRIE: Dict =
{'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}, 'PERSIST': {0: True}, 'PERSIST_ONLY': {0: True}, 'CHARACTER': {'SET': {0: True}}, 'CHARSET': {0: True}, 'NAMES': {0: True}}
Inherited Members
- sqlglot.parser.Parser
- Parser
- STRUCT_TYPE_TOKENS
- NESTED_TYPE_TOKENS
- AGGREGATE_TYPE_TOKENS
- SIGNED_TO_UNSIGNED_TYPE_TOKEN
- SUBQUERY_PREDICATES
- RESERVED_TOKENS
- DB_CREATABLES
- CREATABLES
- ALTERABLES
- ID_VAR_TOKENS
- ALIAS_TOKENS
- COLON_PLACEHOLDER_TOKENS
- ARRAY_CONSTRUCTORS
- COMMENT_TABLE_ALIAS_TOKENS
- UPDATE_ALIAS_TOKENS
- TRIM_TYPES
- ASSIGNMENT
- EQUALITY
- COMPARISON
- BITWISE
- TERM
- FACTOR
- EXPONENT
- TIMES
- TIMESTAMPS
- SET_OPERATIONS
- JOIN_METHODS
- JOIN_SIDES
- JOIN_KINDS
- JOIN_HINTS
- LAMBDAS
- COLUMN_OPERATORS
- CAST_COLUMN_OPERATORS
- EXPRESSION_PARSERS
- UNARY_PARSERS
- STRING_PARSERS
- NUMERIC_PARSERS
- PRIMARY_PARSERS
- PLACEHOLDER_PARSERS
- PIPE_SYNTAX_TRANSFORM_PARSERS
- NO_PAREN_FUNCTION_PARSERS
- INVALID_FUNC_NAME_TOKENS
- FUNCTIONS_WITH_ALIASED_ARGS
- KEY_VALUE_DEFINITIONS
- QUERY_MODIFIER_PARSERS
- QUERY_MODIFIER_TOKENS
- TYPE_LITERAL_PARSERS
- TYPE_CONVERTERS
- DDL_SELECT_TOKENS
- PRE_VOLATILE_TOKENS
- TRANSACTION_KIND
- TRANSACTION_CHARACTERISTICS
- CONFLICT_ACTIONS
- CREATE_SEQUENCE
- ISOLATED_LOADING_OPTIONS
- USABLES
- CAST_ACTIONS
- SCHEMA_BINDING_OPTIONS
- PROCEDURE_OPTIONS
- EXECUTE_AS_OPTIONS
- KEY_CONSTRAINT_OPTIONS
- WINDOW_EXCLUDE_OPTIONS
- INSERT_ALTERNATIVES
- CLONE_KEYWORDS
- HISTORICAL_DATA_PREFIX
- HISTORICAL_DATA_KIND
- OPCLASS_FOLLOW_KEYWORDS
- OPTYPE_FOLLOW_TOKENS
- TABLE_INDEX_HINT_TOKENS
- VIEW_ATTRIBUTES
- WINDOW_ALIAS_TOKENS
- WINDOW_BEFORE_PAREN_TOKENS
- WINDOW_SIDES
- JSON_KEY_VALUE_SEPARATOR_TOKENS
- FETCH_TOKENS
- ADD_CONSTRAINT_TOKENS
- DISTINCT_TOKENS
- UNNEST_OFFSET_ALIAS_TOKENS
- SELECT_START_TOKENS
- COPY_INTO_VARLEN_OPTIONS
- IS_JSON_PREDICATE_KIND
- ODBC_DATETIME_LITERALS
- ON_CONDITION_TOKENS
- PRIVILEGE_FOLLOW_TOKENS
- DESCRIBE_STYLES
- ANALYZE_STYLES
- ANALYZE_EXPRESSION_PARSERS
- PARTITION_KEYWORDS
- AMBIGUOUS_ALIAS_TOKENS
- RECURSIVE_CTE_SEARCH_KIND
- MODIFIABLES
- STRICT_CAST
- PREFIXED_PIVOT_COLUMNS
- IDENTIFY_PIVOT_STRINGS
- TABLESAMPLE_CSV
- DEFAULT_SAMPLING_METHOD
- SET_REQUIRES_ASSIGNMENT_DELIMITER
- TRIM_PATTERN_FIRST
- MODIFIERS_ATTACHED_TO_SET_OP
- SET_OP_MODIFIERS
- NO_PAREN_IF_COMMANDS
- JSON_ARROWS_REQUIRE_JSON_TYPE
- COLON_IS_VARIANT_EXTRACT
- SUPPORTS_IMPLICIT_UNNEST
- INTERVAL_SPANS
- WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
- OPTIONAL_ALIAS_TOKEN_CTE
- ALTER_RENAME_REQUIRES_COLUMN
- JOINS_HAVE_EQUAL_PRECEDENCE
- ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
- MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS
- JSON_EXTRACT_REQUIRES_JSON_EXPRESSION
- ADD_JOIN_ON_TRUE
- error_level
- error_message_context
- max_errors
- dialect
- reset
- parse
- parse_into
- check_errors
- raise_error
- expression
- validate_expression
- parse_set_operation
- build_cast
- errors
- sql
- sqlglot.dialects.mysql.MySQL.Parser
- FUNC_TOKENS
- CONJUNCTION
- DISJUNCTION
- RANGE_PARSERS
- STATEMENT_PARSERS
- SHOW_PARSERS
- SET_PARSERS
- CONSTRAINT_PARSERS
- ALTER_PARSERS
- ALTER_ALTER_PARSERS
- SCHEMA_UNNAMED_CONSTRAINTS
- PROFILE_TYPES
- TYPE_TOKENS
- ENUM_TYPE_TOKENS
- OPERATION_MODIFIERS
- LOG_DEFAULTS_TO_LN
- STRING_ALIASES
- VALUES_FOLLOWED_BY_PAREN
- SUPPORTS_PARTITION_SELECTION
177 class Generator(MySQL.Generator): 178 LAST_DAY_SUPPORTS_DATE_PART = False 179 VARCHAR_REQUIRES_SIZE = False 180 WITH_PROPERTIES_PREFIX = "PROPERTIES" 181 RENAME_TABLE_WITH_DB = False 182 183 TYPE_MAPPING = { 184 **MySQL.Generator.TYPE_MAPPING, 185 exp.DataType.Type.TEXT: "STRING", 186 exp.DataType.Type.TIMESTAMP: "DATETIME", 187 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 188 } 189 190 PROPERTIES_LOCATION = { 191 **MySQL.Generator.PROPERTIES_LOCATION, 192 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 193 exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA, 194 exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, 195 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 196 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 197 exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, 198 } 199 200 CAST_MAPPING = {} 201 TIMESTAMP_FUNC_TYPES = set() 202 203 TRANSFORMS = { 204 **MySQL.Generator.TRANSFORMS, 205 exp.AddMonths: rename_func("MONTHS_ADD"), 206 exp.ApproxDistinct: approx_count_distinct_sql, 207 exp.ArgMax: rename_func("MAX_BY"), 208 exp.ArgMin: rename_func("MIN_BY"), 209 exp.ArrayAgg: rename_func("COLLECT_LIST"), 210 exp.ArrayToString: rename_func("ARRAY_JOIN"), 211 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 212 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 213 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 214 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 215 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 216 exp.GroupConcat: lambda self, e: self.func( 217 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 218 ), 219 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 220 exp.Lag: _lag_lead_sql, 221 exp.Lead: _lag_lead_sql, 222 exp.Map: rename_func("ARRAY_MAP"), 223 exp.Property: property_sql, 224 exp.RegexpLike: rename_func("REGEXP"), 225 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 226 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 227 exp.Split: rename_func("SPLIT_BY_STRING"), 228 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 229 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 230 exp.TimeStrToDate: rename_func("TO_DATE"), 231 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 232 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 233 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 234 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 235 exp.UnixToStr: lambda self, e: self.func( 236 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 237 ), 238 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 239 } 240 241 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 242 RESERVED_KEYWORDS = { 243 "account_lock", 244 "account_unlock", 245 "add", 246 "adddate", 247 "admin", 248 "after", 249 "agg_state", 250 "aggregate", 251 "alias", 252 "all", 253 "alter", 254 "analyze", 255 "analyzed", 256 "and", 257 "anti", 258 "append", 259 "array", 260 "array_range", 261 "as", 262 "asc", 263 "at", 264 "authors", 265 "auto", 266 "auto_increment", 267 "backend", 268 "backends", 269 "backup", 270 "begin", 271 "belong", 272 "between", 273 "bigint", 274 "bin", 275 "binary", 276 "binlog", 277 "bitand", 278 "bitmap", 279 "bitmap_union", 280 "bitor", 281 "bitxor", 282 "blob", 283 "boolean", 284 "brief", 285 "broker", 286 "buckets", 287 "build", 288 "builtin", 289 "bulk", 290 "by", 291 "cached", 292 "call", 293 "cancel", 294 "case", 295 "cast", 296 "catalog", 297 "catalogs", 298 "chain", 299 "char", 300 "character", 301 "charset", 302 "check", 303 "clean", 304 "cluster", 305 "clusters", 306 "collate", 307 "collation", 308 "collect", 309 "column", 310 "columns", 311 "comment", 312 "commit", 313 "committed", 314 "compact", 315 "complete", 316 "config", 317 "connection", 318 "connection_id", 319 "consistent", 320 "constraint", 321 "constraints", 322 "convert", 323 "copy", 324 "count", 325 "create", 326 "creation", 327 "cron", 328 "cross", 329 "cube", 330 "current", 331 "current_catalog", 332 "current_date", 333 "current_time", 334 "current_timestamp", 335 "current_user", 336 "data", 337 "database", 338 "databases", 339 "date", 340 "date_add", 341 "date_ceil", 342 "date_diff", 343 "date_floor", 344 "date_sub", 345 "dateadd", 346 "datediff", 347 "datetime", 348 "datetimev2", 349 "datev2", 350 "datetimev1", 351 "datev1", 352 "day", 353 "days_add", 354 "days_sub", 355 "decimal", 356 "decimalv2", 357 "decimalv3", 358 "decommission", 359 "default", 360 "deferred", 361 "delete", 362 "demand", 363 "desc", 364 "describe", 365 "diagnose", 366 "disk", 367 "distinct", 368 "distinctpc", 369 "distinctpcsa", 370 "distributed", 371 "distribution", 372 "div", 373 "do", 374 "doris_internal_table_id", 375 "double", 376 "drop", 377 "dropp", 378 "dual", 379 "duplicate", 380 "dynamic", 381 "else", 382 "enable", 383 "encryptkey", 384 "encryptkeys", 385 "end", 386 "ends", 387 "engine", 388 "engines", 389 "enter", 390 "errors", 391 "events", 392 "every", 393 "except", 394 "exclude", 395 "execute", 396 "exists", 397 "expired", 398 "explain", 399 "export", 400 "extended", 401 "external", 402 "extract", 403 "failed_login_attempts", 404 "false", 405 "fast", 406 "feature", 407 "fields", 408 "file", 409 "filter", 410 "first", 411 "float", 412 "follower", 413 "following", 414 "for", 415 "foreign", 416 "force", 417 "format", 418 "free", 419 "from", 420 "frontend", 421 "frontends", 422 "full", 423 "function", 424 "functions", 425 "generic", 426 "global", 427 "grant", 428 "grants", 429 "graph", 430 "group", 431 "grouping", 432 "groups", 433 "hash", 434 "having", 435 "hdfs", 436 "help", 437 "histogram", 438 "hll", 439 "hll_union", 440 "hostname", 441 "hour", 442 "hub", 443 "identified", 444 "if", 445 "ignore", 446 "immediate", 447 "in", 448 "incremental", 449 "index", 450 "indexes", 451 "infile", 452 "inner", 453 "insert", 454 "install", 455 "int", 456 "integer", 457 "intermediate", 458 "intersect", 459 "interval", 460 "into", 461 "inverted", 462 "ipv4", 463 "ipv6", 464 "is", 465 "is_not_null_pred", 466 "is_null_pred", 467 "isnull", 468 "isolation", 469 "job", 470 "jobs", 471 "join", 472 "json", 473 "jsonb", 474 "key", 475 "keys", 476 "kill", 477 "label", 478 "largeint", 479 "last", 480 "lateral", 481 "ldap", 482 "ldap_admin_password", 483 "left", 484 "less", 485 "level", 486 "like", 487 "limit", 488 "lines", 489 "link", 490 "list", 491 "load", 492 "local", 493 "localtime", 494 "localtimestamp", 495 "location", 496 "lock", 497 "logical", 498 "low_priority", 499 "manual", 500 "map", 501 "match", 502 "match_all", 503 "match_any", 504 "match_phrase", 505 "match_phrase_edge", 506 "match_phrase_prefix", 507 "match_regexp", 508 "materialized", 509 "max", 510 "maxvalue", 511 "memo", 512 "merge", 513 "migrate", 514 "migrations", 515 "min", 516 "minus", 517 "minute", 518 "modify", 519 "month", 520 "mtmv", 521 "name", 522 "names", 523 "natural", 524 "negative", 525 "never", 526 "next", 527 "ngram_bf", 528 "no", 529 "non_nullable", 530 "not", 531 "null", 532 "nulls", 533 "observer", 534 "of", 535 "offset", 536 "on", 537 "only", 538 "open", 539 "optimized", 540 "or", 541 "order", 542 "outer", 543 "outfile", 544 "over", 545 "overwrite", 546 "parameter", 547 "parsed", 548 "partition", 549 "partitions", 550 "password", 551 "password_expire", 552 "password_history", 553 "password_lock_time", 554 "password_reuse", 555 "path", 556 "pause", 557 "percent", 558 "period", 559 "permissive", 560 "physical", 561 "plan", 562 "process", 563 "plugin", 564 "plugins", 565 "policy", 566 "preceding", 567 "prepare", 568 "primary", 569 "proc", 570 "procedure", 571 "processlist", 572 "profile", 573 "properties", 574 "property", 575 "quantile_state", 576 "quantile_union", 577 "query", 578 "quota", 579 "random", 580 "range", 581 "read", 582 "real", 583 "rebalance", 584 "recover", 585 "recycle", 586 "refresh", 587 "references", 588 "regexp", 589 "release", 590 "rename", 591 "repair", 592 "repeatable", 593 "replace", 594 "replace_if_not_null", 595 "replica", 596 "repositories", 597 "repository", 598 "resource", 599 "resources", 600 "restore", 601 "restrictive", 602 "resume", 603 "returns", 604 "revoke", 605 "rewritten", 606 "right", 607 "rlike", 608 "role", 609 "roles", 610 "rollback", 611 "rollup", 612 "routine", 613 "row", 614 "rows", 615 "s3", 616 "sample", 617 "schedule", 618 "scheduler", 619 "schema", 620 "schemas", 621 "second", 622 "select", 623 "semi", 624 "sequence", 625 "serializable", 626 "session", 627 "set", 628 "sets", 629 "shape", 630 "show", 631 "signed", 632 "skew", 633 "smallint", 634 "snapshot", 635 "soname", 636 "split", 637 "sql_block_rule", 638 "start", 639 "starts", 640 "stats", 641 "status", 642 "stop", 643 "storage", 644 "stream", 645 "streaming", 646 "string", 647 "struct", 648 "subdate", 649 "sum", 650 "superuser", 651 "switch", 652 "sync", 653 "system", 654 "table", 655 "tables", 656 "tablesample", 657 "tablet", 658 "tablets", 659 "task", 660 "tasks", 661 "temporary", 662 "terminated", 663 "text", 664 "than", 665 "then", 666 "time", 667 "timestamp", 668 "timestampadd", 669 "timestampdiff", 670 "tinyint", 671 "to", 672 "transaction", 673 "trash", 674 "tree", 675 "triggers", 676 "trim", 677 "true", 678 "truncate", 679 "type", 680 "type_cast", 681 "types", 682 "unbounded", 683 "uncommitted", 684 "uninstall", 685 "union", 686 "unique", 687 "unlock", 688 "unsigned", 689 "update", 690 "use", 691 "user", 692 "using", 693 "value", 694 "values", 695 "varchar", 696 "variables", 697 "variant", 698 "vault", 699 "verbose", 700 "version", 701 "view", 702 "warnings", 703 "week", 704 "when", 705 "where", 706 "whitelist", 707 "with", 708 "work", 709 "workload", 710 "write", 711 "xor", 712 "year", 713 } 714 715 def uniquekeyproperty_sql( 716 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 717 ) -> str: 718 create_stmt = expression.find_ancestor(exp.Create) 719 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 720 return super().uniquekeyproperty_sql(expression, prefix="KEY") 721 722 return super().uniquekeyproperty_sql(expression) 723 724 def partition_sql(self, expression: exp.Partition) -> str: 725 parent = expression.parent 726 if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)): 727 return ", ".join(self.sql(e) for e in expression.expressions) 728 return super().partition_sql(expression) 729 730 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 731 name = self.sql(expression, "this") 732 values = expression.expressions 733 734 if len(values) != 1: 735 # Multiple values: use VALUES [ ... ) 736 if values and isinstance(values[0], list): 737 values_sql = ", ".join( 738 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 739 ) 740 else: 741 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 742 743 return f"PARTITION {name} VALUES [{values_sql})" 744 745 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 746 747 def partitionbyrangepropertydynamic_sql( 748 self, expression: exp.PartitionByRangePropertyDynamic 749 ) -> str: 750 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 751 start = self.sql(expression, "start") 752 end = self.sql(expression, "end") 753 every = expression.args.get("every") 754 755 if every: 756 number = self.sql(every, "this") 757 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 758 else: 759 interval = "" 760 761 return f"FROM ({start}) TO ({end}) {interval}" 762 763 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 764 partition_expressions = self.expressions( 765 expression, key="partition_expressions", indent=False 766 ) 767 create_sql = self.expressions(expression, key="create_expressions", indent=False) 768 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})" 769 770 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 771 partition_expressions = self.expressions( 772 expression, key="partition_expressions", indent=False 773 ) 774 create_sql = self.expressions(expression, key="create_expressions", indent=False) 775 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})" 776 777 def partitionlist_sql(self, expression: exp.PartitionList) -> str: 778 name = self.sql(expression, "this") 779 values = self.expressions(expression, indent=False) 780 return f"PARTITION {name} VALUES IN ({values})" 781 782 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 783 node = expression.this 784 if isinstance(node, exp.Schema): 785 parts = ", ".join(self.sql(e) for e in node.expressions) 786 return f"PARTITION BY ({parts})" 787 return f"PARTITION BY ({self.sql(node)})" 788 789 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 790 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 791 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 792 if not isinstance(ancestor, exp.Select): 793 sep = " " 794 return super().table_sql(expression, sep=sep) 795 796 def alterrename_sql(self, expression: exp.AlterRename, include_to: bool = True) -> str: 797 return super().alterrename_sql(expression, include_to=False)
Generator converts a given syntax tree to the corresponding SQL string.
Arguments:
- pretty: Whether to format the produced SQL string. Default: False.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
- normalize: Whether to normalize identifiers to lowercase. Default: False.
- pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
- indent: The indentation size in a formatted string. For example, this affects the
indentation of subqueries and filters under a
WHERE
clause. Default: 2. - normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
- unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
- max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
- leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
- max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
- comments: Whether to preserve comments in the output SQL code. Default: True
TYPE_MAPPING =
{<Type.DATETIME2: 'DATETIME2'>: 'DATETIME', <Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.SMALLDATETIME: 'SMALLDATETIME'>: 'DATETIME', <Type.UBIGINT: 'UBIGINT'>: 'BIGINT', <Type.UINT: 'UINT'>: 'INT', <Type.UMEDIUMINT: 'UMEDIUMINT'>: 'MEDIUMINT', <Type.USMALLINT: 'USMALLINT'>: 'SMALLINT', <Type.UTINYINT: 'UTINYINT'>: 'TINYINT', <Type.UDECIMAL: 'UDECIMAL'>: 'DECIMAL', <Type.UDOUBLE: 'UDOUBLE'>: 'DOUBLE', <Type.TIMESTAMP: 'TIMESTAMP'>: 'DATETIME', <Type.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>: 'DATETIME', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'DATETIME', <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>: 'TIMESTAMP', <Type.TEXT: 'TEXT'>: 'STRING'}
PROPERTIES_LOCATION =
{<class 'sqlglot.expressions.AllowedValuesProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AlgorithmProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.AutoIncrementProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BackupProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BlockCompressionProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CharacterSetProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ChecksumProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.CollateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Cluster'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ClusteredByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistributedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DuplicateKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DataBlocksizeProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.DataDeletionProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DefinerProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DictRange'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DynamicProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.DistKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.DistStyleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EmptyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EncodeProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.EngineProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.EnviromentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ExternalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.FallbackProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.FileFormatProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.FreespaceProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.GlobalProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.HeapProperty'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.InheritsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IcebergProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.IncludeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.InputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.IsolatedLoadingProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.JournalProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.LanguageProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LikeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LocationProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.LockingProperty'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class 'sqlglot.expressions.LogProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.MaterializedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.MergeBlockRatioProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.OnProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OnCommitProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.Order'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.OutputModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedByProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionedOfProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PrimaryKey'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Property'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatDelimitedProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RowFormatSerdeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SampleProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SecureProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SecurityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SerdeProperties'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Set'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SettingsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SetProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.SetConfigProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SharingProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SequenceProperties'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.SortKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StabilityProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StorageHandlerProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.StreamingTableProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.StrictProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.Tags'>: <Location.POST_WITH: 'POST_WITH'>, <class 'sqlglot.expressions.TemporaryProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.ToTableProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.TransientProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.TransformModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.MergeTreeTTL'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UnloggedProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.UsingTemplateProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.VolatileProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class 'sqlglot.expressions.WithDataProperty'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <Location.POST_NAME: 'POST_NAME'>, <class 'sqlglot.expressions.WithProcedureOptions'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.WithSystemVersioningProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ForceProperty'>: <Location.POST_CREATE: 'POST_CREATE'>, <class 'sqlglot.expressions.UniqueKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionByRangeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionByListProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BuildProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RefreshTriggerProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>}
TRANSFORMS =
{<class 'sqlglot.expressions.JSONPathFilter'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathKey'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathRecursive'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathRoot'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathScript'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSelector'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSlice'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathUnion'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathWildcard'>: <function <lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeColumns'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeWith'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayContainsAll'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayOverlaps'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Ceil'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConvertToCharset'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CredentialsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EnviromentProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Except'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Floor'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Get'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Intersect'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Int64'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContainsAnyTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBDeleteAtPath'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionedByBucket'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionByTruncate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PositionalColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Put'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TableColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Union'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingTemplateProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingData'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Uuid'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UtcDate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UtcTime'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.UtcTimestamp'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WeekStart'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseAndAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseOrAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseXorAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseCountAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.DateDiff'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DateAdd'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DateStrToDate'>: <function datestrtodate_sql>, <class 'sqlglot.expressions.DateSub'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DateTrunc'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Day'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DayOfMonth'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DayOfWeek'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DayOfYear'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.GroupConcat'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.ILike'>: <function no_ilike_sql>, <class 'sqlglot.expressions.JSONExtractScalar'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Length'>: <function length_or_char_length_sql>, <class 'sqlglot.expressions.LogicalOr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.LogicalAnd'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Max'>: <function max_or_greatest>, <class 'sqlglot.expressions.Min'>: <function min_or_least>, <class 'sqlglot.expressions.Month'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.NullSafeEQ'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.NullSafeNEQ'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.NumberToStr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Pivot'>: <function no_pivot_sql>, <class 'sqlglot.expressions.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.StrPosition'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.StrToDate'>: <function _str_to_date_sql>, <class 'sqlglot.expressions.StrToTime'>: <function _str_to_date_sql>, <class 'sqlglot.expressions.Stuff'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TableSample'>: <function no_tablesample_sql>, <class 'sqlglot.expressions.TimeFromParts'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimestampAdd'>: <function date_add_interval_sql.<locals>.func>, <class 'sqlglot.expressions.TimestampDiff'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.TimestampSub'>: <function date_add_interval_sql.<locals>.func>, <class 'sqlglot.expressions.TimeStrToUnix'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimeStrToTime'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.TimeToStr'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.Trim'>: <function trim_sql>, <class 'sqlglot.expressions.TryCast'>: <function no_trycast_sql>, <class 'sqlglot.expressions.TsOrDsAdd'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDsDiff'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDsToDate'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Unicode'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.UnixToTime'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Week'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.WeekOfYear'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.Year'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.AddMonths'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function approx_count_distinct_sql>, <class 'sqlglot.expressions.ArgMax'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArgMin'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayToString'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ArrayUniqueAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CurrentTimestamp'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.EuclideanDistance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Lag'>: <function _lag_lead_sql>, <class 'sqlglot.expressions.Lead'>: <function _lag_lead_sql>, <class 'sqlglot.expressions.Map'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Property'>: <function property_sql>, <class 'sqlglot.expressions.RegexpLike'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.RegexpSplit'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SchemaCommentProperty'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.Split'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StringToArray'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.StrToUnix'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.TimeStrToDate'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimeToUnix'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimestampTrunc'>: <function Doris.Generator.<lambda>>, <class 'sqlglot.expressions.UnixToStr'>: <function Doris.Generator.<lambda>>}
RESERVED_KEYWORDS =
{'insert', 'properties', 'binlog', 'free', 'values', 'after', 'date_diff', 'decimalv3', 'open', 'date_sub', 'minute', 'alter', 'temporary', 'match_regexp', 'default', 'struct', 'isnull', 'ldap', 'transaction', 'outer', 'for', 'order', 'range', 'grant', 'offset', 'match_phrase_prefix', 'parameter', 'references', 'character', 'check', 'fast', 'merge', 'replica', 'tablesample', 'file', 'describe', 'resume', 'path', 'charset', 'count', 'optimized', 'snapshot', 'repair', 'password_lock_time', 'migrations', 'level', 'schemas', 'switch', 'location', 'in', 'link', 'week', 'recycle', 'groups', 'graph', 'tasks', 'routine', 'begin', 'tablet', 'timestampdiff', 'inverted', 'by', 'timestamp', 'second', 'frontends', 'ignore', 'ipv4', 'dynamic', 'semi', 'terminated', 'hash', 'date_add', 'profile', 'to', 'account_lock', 'local', 'quota', 'policy', 'less', 'storage', 'call', 'value', 'inner', 'min', 'identified', 'day', 'buckets', 'preceding', 'use', 'consistent', 'signed', 'function', 'random', 'plugins', 'pause', 'backends', 'from', 'collation', 'else', 'session', 'grouping', 'rollup', 'workload', 'ldap_admin_password', 'column', 'plugin', 'user', 'than', 'hostname', 'minus', 'alias', 'query', 'when', 'not', 'date_floor', 'cron', 'verbose', 'if', 'cluster', 'using', 'password_expire', 'is', 'comment', 'timestampadd', 'type', 'time', 'maxvalue', 'truncate', 'constraint', 'job', 'key', 'functions', 'filter', 'incremental', 'expired', 'ipv6', 'largeint', 'array_range', 'match', 'auto_increment', 'mtmv', 'modify', 'null', 'constraints', 'committed', 'frontend', 'aggregate', 'trim', 'row', 'select', 'backup', 'list', 'on', 'integer', 'except', 'match_phrase', 'account_unlock', 'exists', 'intersect', 'load', 'read', 'left', 'skew', 'lines', 'triggers', 'rows', 'having', 'no', 'backend', 'between', 'boolean', 'distribution', 'build', 'first', 'bitand', 'full', 'period', 'schema', 'isolation', 'rebalance', 'next', 'natural', 'as', 'match_any', 'shape', 'keys', 'following', 'last', 'where', 'diagnose', 'text', 'trash', 'rewritten', 'process', 'adddate', 'blob', 'deferred', 'system', 'observer', 'bigint', 'errors', 'real', 'datev2', 'right', 'feature', 'asc', 'copy', 'datetime', 'set', 'encryptkey', 'over', 'password', 'view', 'work', 'broker', 'revoke', 'whitelist', 'table', 'distinctpcsa', 'property', 'dual', 'hll_union', 'json', 'tablets', 'resources', 'subdate', 'compact', 'stream', 'string', 'outfile', 'hll', 'binary', 'at', 'distributed', 'do', 'unbounded', 'current', 'logical', 'bitor', 'infile', 'global', 'enable', 'hour', 'sum', 'starts', 'current_date', 'auto', 'false', 'jobs', 'data', 'match_all', 'engines', 'write', 'kill', 'ends', 'anti', 'restrictive', 'superuser', 'index', 'explain', 'streaming', 'desc', 'append', 'distinct', 'help', 'follower', 'primary', 'delete', 'bitmap_union', 'analyze', 'days_sub', 'dropp', 'decimal', 'failed_login_attempts', 'extended', 'decommission', 'quantile_union', 'like', 'engine', 'date_ceil', 'restore', 'task', 'uninstall', 'varchar', 'resource', 'export', 'cancel', 'unsigned', 'float', 'end', 'chain', 'extract', 'sql_block_rule', 'ngram_bf', 'prepare', 'true', 'limit', 'exclude', 'memo', 'warnings', 'format', 'indexes', 'names', 'localtimestamp', 'immediate', 'catalog', 'bitmap', 'types', 'variant', 'low_priority', 'sequence', 'cached', 'match_phrase_edge', 'cross', 'fields', 'cast', 'or', 'quantile_state', 'status', 'create', 'join', 'proc', 'only', 'returns', 'show', 'union', 'into', 'date', 'procedure', 'install', 'password_history', 'convert', 'repository', 'migrate', 'current_catalog', 'histogram', 'datetimev2', 'distinctpc', 'interval', 'bulk', 'tree', 'lateral', 'dateadd', 'intermediate', 'agg_state', 'complete', 'with', 'is_not_null_pred', 'overwrite', 'sets', 'stats', 'password_reuse', 'and', 'authors', 'datediff', 'current_user', 'all', 'recover', 'belong', 'year', 'sync', 'generic', 'hdfs', 'current_timestamp', 'disk', 'xor', 's3', 'decimalv2', 'materialized', 'tables', 'then', 'replace', 'manual', 'brief', 'clean', 'case', 'percent', 'month', 'external', 'clusters', 'connection', 'permissive', 'collate', 'cube', 'database', 'sample', 'analyzed', 'repeatable', 'update', 'non_nullable', 'encryptkeys', 'is_null_pred', 'doris_internal_table_id', 'current_time', 'datetimev1', 'events', 'repositories', 'schedule', 'int', 'partition', 'vault', 'localtime', 'scheduler', 'unlock', 'soname', 'add', 'negative', 'role', 'processlist', 'rlike', 'name', 'group', 'collect', 'refresh', 'rollback', 'version', 'columns', 'smallint', 'plan', 'unique', 'bin', 'execute', 'array', 'nulls', 'double', 'uncommitted', 'roles', 'jsonb', 'regexp', 'hub', 'admin', 'every', 'enter', 'config', 'foreign', 'lock', 'datev1', 'partitions', 'days_add', 'tinyint', 'split', 'div', 'never', 'char', 'demand', 'bitxor', 'catalogs', 'duplicate', 'connection_id', 'map', 'databases', 'creation', 'variables', 'start', 'builtin', 'physical', 'drop', 'force', 'release', 'parsed', 'of', 'grants', 'commit', 'serializable', 'type_cast', 'rename', 'replace_if_not_null', 'stop', 'label', 'max'}
def
uniquekeyproperty_sql( self, expression: sqlglot.expressions.UniqueKeyProperty, prefix: str = 'UNIQUE KEY') -> str:
715 def uniquekeyproperty_sql( 716 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 717 ) -> str: 718 create_stmt = expression.find_ancestor(exp.Create) 719 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 720 return super().uniquekeyproperty_sql(expression, prefix="KEY") 721 722 return super().uniquekeyproperty_sql(expression)
730 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 731 name = self.sql(expression, "this") 732 values = expression.expressions 733 734 if len(values) != 1: 735 # Multiple values: use VALUES [ ... ) 736 if values and isinstance(values[0], list): 737 values_sql = ", ".join( 738 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 739 ) 740 else: 741 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 742 743 return f"PARTITION {name} VALUES [{values_sql})" 744 745 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})"
def
partitionbyrangepropertydynamic_sql( self, expression: sqlglot.expressions.PartitionByRangePropertyDynamic) -> str:
747 def partitionbyrangepropertydynamic_sql( 748 self, expression: exp.PartitionByRangePropertyDynamic 749 ) -> str: 750 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 751 start = self.sql(expression, "start") 752 end = self.sql(expression, "end") 753 every = expression.args.get("every") 754 755 if every: 756 number = self.sql(every, "this") 757 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 758 else: 759 interval = "" 760 761 return f"FROM ({start}) TO ({end}) {interval}"
def
partitionbyrangeproperty_sql(self, expression: sqlglot.expressions.PartitionByRangeProperty) -> str:
763 def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str: 764 partition_expressions = self.expressions( 765 expression, key="partition_expressions", indent=False 766 ) 767 create_sql = self.expressions(expression, key="create_expressions", indent=False) 768 return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
def
partitionbylistproperty_sql(self, expression: sqlglot.expressions.PartitionByListProperty) -> str:
770 def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str: 771 partition_expressions = self.expressions( 772 expression, key="partition_expressions", indent=False 773 ) 774 create_sql = self.expressions(expression, key="create_expressions", indent=False) 775 return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})"
789 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 790 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 791 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 792 if not isinstance(ancestor, exp.Select): 793 sep = " " 794 return super().table_sql(expression, sep=sep)
Override table_sql to avoid AS keyword in UPDATE and DELETE statements.
def
alterrename_sql( self, expression: sqlglot.expressions.AlterRename, include_to: bool = True) -> str:
AFTER_HAVING_MODIFIER_TRANSFORMS =
{'windows': <function Generator.<lambda>>, 'qualify': <function Generator.<lambda>>}
Inherited Members
- sqlglot.generator.Generator
- Generator
- IGNORE_NULLS_IN_FUNC
- EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE
- CREATE_FUNCTION_RETURN_AS
- MATCHED_BY_SOURCE
- SINGLE_STRING_INTERVAL
- GROUPINGS_SEP
- INDEX_ON
- QUERY_HINTS
- IS_BOOL_ALLOWED
- LIMIT_IS_TOP
- RETURNING_END
- EXTRACT_ALLOWS_QUOTES
- TZ_TO_WITH_TIME_ZONE
- ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
- UNNEST_WITH_ORDINALITY
- AGGREGATE_FILTER_SUPPORTED
- SEMI_ANTI_JOIN_WITH_SIDE
- COMPUTED_COLUMN_WITH_TYPE
- SUPPORTS_TABLE_COPY
- TABLESAMPLE_REQUIRES_PARENS
- TABLESAMPLE_SIZE_IS_ROWS
- TABLESAMPLE_KEYWORDS
- TABLESAMPLE_WITH_METHOD
- TABLESAMPLE_SEED_KEYWORD
- COLLATE_IS_FUNC
- DATA_TYPE_SPECIFIERS_ALLOWED
- ENSURE_BOOLS
- CTE_RECURSIVE_KEYWORD_REQUIRED
- SUPPORTS_SINGLE_ARG_CONCAT
- SUPPORTS_TABLE_ALIAS_COLUMNS
- UNPIVOT_ALIASES_ARE_IDENTIFIERS
- INSERT_OVERWRITE
- SUPPORTS_SELECT_INTO
- SUPPORTS_UNLOGGED_TABLES
- SUPPORTS_CREATE_TABLE_LIKE
- LIKE_PROPERTY_INSIDE_SCHEMA
- MULTI_ARG_DISTINCT
- JSON_PATH_SINGLE_QUOTE_ESCAPE
- SUPPORTED_JSON_PATH_PARTS
- CAN_IMPLEMENT_ARRAY_ANY
- SUPPORTS_WINDOW_EXCLUDE
- SET_OP_MODIFIERS
- COPY_PARAMS_ARE_WRAPPED
- COPY_PARAMS_EQ_REQUIRED
- COPY_HAS_INTO_KEYWORD
- UNICODE_SUBSTITUTE
- STAR_EXCEPT
- HEX_FUNC
- QUOTE_JSON_PATH
- SUPPORTS_EXPLODING_PROJECTIONS
- ARRAY_CONCAT_IS_VAR_LEN
- SUPPORTS_CONVERT_TIMEZONE
- SUPPORTS_UNIX_SECONDS
- ALTER_SET_WRAPPED
- NORMALIZE_EXTRACT_DATE_PARTS
- ARRAY_SIZE_NAME
- ALTER_SET_TYPE
- ARRAY_SIZE_DIM_REQUIRED
- SUPPORTS_BETWEEN_FLAGS
- SUPPORTS_LIKE_QUANTIFIERS
- MATCH_AGAINST_TABLE_PREFIX
- UNSUPPORTED_TYPES
- TIME_PART_SINGULARS
- TOKEN_MAPPING
- STRUCT_DELIMITER
- PARAMETER_TOKEN
- NAMED_PLACEHOLDER_TOKEN
- EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
- WITH_SEPARATED_COMMENTS
- EXCLUDE_COMMENTS
- UNWRAPPED_INTERVAL_VALUES
- PARAMETERIZABLE_TEXT_TYPES
- EXPRESSIONS_WITHOUT_NESTED_CTES
- RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS
- SAFE_JSON_PATH_KEY_RE
- SENTINEL_LINE_BREAK
- pretty
- identify
- normalize
- pad
- unsupported_level
- max_unsupported
- leading_comma
- max_text_width
- comments
- dialect
- normalize_functions
- unsupported_messages
- generate
- preprocess
- unsupported
- sep
- seg
- sanitize_comment
- maybe_comment
- wrap
- no_identify
- normalize_func
- indent
- sql
- uncache_sql
- cache_sql
- characterset_sql
- column_parts
- column_sql
- columnposition_sql
- columndef_sql
- columnconstraint_sql
- autoincrementcolumnconstraint_sql
- compresscolumnconstraint_sql
- generatedasidentitycolumnconstraint_sql
- generatedasrowcolumnconstraint_sql
- periodforsystemtimeconstraint_sql
- notnullcolumnconstraint_sql
- primarykeycolumnconstraint_sql
- uniquecolumnconstraint_sql
- createable_sql
- create_sql
- sequenceproperties_sql
- clone_sql
- describe_sql
- heredoc_sql
- prepend_ctes
- with_sql
- cte_sql
- tablealias_sql
- bitstring_sql
- hexstring_sql
- bytestring_sql
- unicodestring_sql
- rawstring_sql
- datatypeparam_sql
- directory_sql
- delete_sql
- drop_sql
- set_operation
- set_operations
- fetch_sql
- limitoptions_sql
- filter_sql
- hint_sql
- indexparameters_sql
- index_sql
- identifier_sql
- hex_sql
- lowerhex_sql
- inputoutputformat_sql
- national_sql
- properties_sql
- root_properties
- properties
- with_properties
- locate_properties
- property_name
- property_sql
- likeproperty_sql
- fallbackproperty_sql
- journalproperty_sql
- freespaceproperty_sql
- checksumproperty_sql
- mergeblockratioproperty_sql
- datablocksizeproperty_sql
- blockcompressionproperty_sql
- isolatedloadingproperty_sql
- partitionboundspec_sql
- partitionedofproperty_sql
- lockingproperty_sql
- withdataproperty_sql
- withsystemversioningproperty_sql
- insert_sql
- introducer_sql
- kill_sql
- pseudotype_sql
- objectidentifier_sql
- onconflict_sql
- returning_sql
- rowformatdelimitedproperty_sql
- withtablehint_sql
- indextablehint_sql
- historicaldata_sql
- table_parts
- tablefromrows_sql
- tablesample_sql
- pivot_sql
- version_sql
- tuple_sql
- update_sql
- values_sql
- var_sql
- into_sql
- from_sql
- groupingsets_sql
- rollup_sql
- cube_sql
- group_sql
- having_sql
- connect_sql
- prior_sql
- join_sql
- lambda_sql
- lateral_op
- lateral_sql
- limit_sql
- offset_sql
- setitem_sql
- set_sql
- queryband_sql
- pragma_sql
- lock_sql
- literal_sql
- escape_str
- loaddata_sql
- null_sql
- boolean_sql
- order_sql
- withfill_sql
- cluster_sql
- distribute_sql
- sort_sql
- ordered_sql
- matchrecognizemeasure_sql
- matchrecognize_sql
- query_modifiers
- options_modifier
- for_modifiers
- queryoption_sql
- offset_limit_modifiers
- after_limit_modifiers
- select_sql
- schema_sql
- schema_columns_sql
- star_sql
- parameter_sql
- sessionparameter_sql
- placeholder_sql
- subquery_sql
- qualify_sql
- unnest_sql
- prewhere_sql
- where_sql
- window_sql
- partition_by_sql
- windowspec_sql
- withingroup_sql
- between_sql
- bracket_offset_expressions
- bracket_sql
- all_sql
- any_sql
- exists_sql
- case_sql
- constraint_sql
- nextvaluefor_sql
- trim_sql
- convert_concat_args
- concat_sql
- concatws_sql
- check_sql
- foreignkey_sql
- primarykey_sql
- if_sql
- matchagainst_sql
- jsonkeyvalue_sql
- jsonpath_sql
- json_path_part
- formatjson_sql
- formatphrase_sql
- jsonobject_sql
- jsonobjectagg_sql
- jsonarray_sql
- jsonarrayagg_sql
- jsoncolumndef_sql
- jsonschema_sql
- jsontable_sql
- openjsoncolumndef_sql
- openjson_sql
- in_sql
- in_unnest_op
- interval_sql
- return_sql
- reference_sql
- anonymous_sql
- paren_sql
- neg_sql
- not_sql
- alias_sql
- pivotalias_sql
- aliases_sql
- atindex_sql
- fromtimezone_sql
- add_sql
- and_sql
- or_sql
- xor_sql
- connector_sql
- bitwiseand_sql
- bitwiseleftshift_sql
- bitwisenot_sql
- bitwiseor_sql
- bitwiserightshift_sql
- bitwisexor_sql
- currentdate_sql
- collate_sql
- command_sql
- comment_sql
- mergetreettlaction_sql
- mergetreettl_sql
- transaction_sql
- commit_sql
- rollback_sql
- alterindex_sql
- alterdiststyle_sql
- altersortkey_sql
- renamecolumn_sql
- alterset_sql
- alter_sql
- altersession_sql
- add_column_sql
- droppartition_sql
- addconstraint_sql
- addpartition_sql
- distinct_sql
- ignorenulls_sql
- respectnulls_sql
- havingmax_sql
- intdiv_sql
- div_sql
- safedivide_sql
- overlaps_sql
- distance_sql
- dot_sql
- eq_sql
- propertyeq_sql
- escape_sql
- glob_sql
- gt_sql
- gte_sql
- is_sql
- like_sql
- ilike_sql
- similarto_sql
- lt_sql
- lte_sql
- mod_sql
- mul_sql
- neq_sql
- nullsafeeq_sql
- nullsafeneq_sql
- slice_sql
- sub_sql
- trycast_sql
- jsoncast_sql
- try_sql
- log_sql
- use_sql
- binary
- ceil_floor
- function_fallback_sql
- func
- format_args
- too_wide
- format_time
- expressions
- op_expressions
- naked_property
- tag_sql
- token_sql
- userdefinedfunction_sql
- joinhint_sql
- kwarg_sql
- when_sql
- whens_sql
- merge_sql
- tochar_sql
- tonumber_sql
- dictproperty_sql
- dictrange_sql
- dictsubproperty_sql
- duplicatekeyproperty_sql
- distributedbyproperty_sql
- oncluster_sql
- clusteredbyproperty_sql
- anyvalue_sql
- querytransform_sql
- indexconstraintoption_sql
- checkcolumnconstraint_sql
- indexcolumnconstraint_sql
- nvl2_sql
- comprehension_sql
- columnprefix_sql
- opclass_sql
- predict_sql
- generateembedding_sql
- mltranslate_sql
- mlforecast_sql
- featuresattime_sql
- vectorsearch_sql
- forin_sql
- refresh_sql
- toarray_sql
- tsordstotime_sql
- tsordstotimestamp_sql
- tsordstodatetime_sql
- tsordstodate_sql
- unixdate_sql
- lastday_sql
- dateadd_sql
- arrayany_sql
- struct_sql
- truncatetable_sql
- convert_sql
- copyparameter_sql
- credentials_sql
- copy_sql
- semicolon_sql
- datadeletionproperty_sql
- maskingpolicycolumnconstraint_sql
- gapfill_sql
- scope_resolution
- scoperesolution_sql
- parsejson_sql
- rand_sql
- changes_sql
- pad_sql
- summarize_sql
- explodinggenerateseries_sql
- arrayconcat_sql
- json_sql
- jsonvalue_sql
- conditionalinsert_sql
- multitableinserts_sql
- oncondition_sql
- jsonextractquote_sql
- jsonexists_sql
- arrayagg_sql
- apply_sql
- grant_sql
- revoke_sql
- grantprivilege_sql
- grantprincipal_sql
- columns_sql
- overlay_sql
- todouble_sql
- string_sql
- median_sql
- overflowtruncatebehavior_sql
- unixseconds_sql
- arraysize_sql
- attach_sql
- detach_sql
- attachoption_sql
- watermarkcolumnconstraint_sql
- encodeproperty_sql
- includeproperty_sql
- xmlelement_sql
- xmlkeyvalueoption_sql
- unpivotcolumns_sql
- analyzesample_sql
- analyzestatistics_sql
- analyzehistogram_sql
- analyzedelete_sql
- analyzelistchainedrows_sql
- analyzevalidate_sql
- analyze_sql
- xmltable_sql
- xmlnamespace_sql
- export_sql
- declare_sql
- declareitem_sql
- recursivewithsearch_sql
- parameterizedagg_sql
- anonymousaggfunc_sql
- combinedaggfunc_sql
- combinedparameterizedagg_sql
- install_sql
- get_put_sql
- translatecharacters_sql
- decodecase_sql
- semanticview_sql
- getextract_sql
- datefromunixdate_sql
- space_sql
- buildproperty_sql
- refreshtriggerproperty_sql
- modelattribute_sql
- sqlglot.dialects.mysql.MySQL.Generator
- INTERVAL_ALLOWS_PLURAL_FORM
- LOCKING_READS_SUPPORTED
- NULL_ORDERING_SUPPORTED
- JOIN_HINTS
- TABLE_HINTS
- DUPLICATE_KEY_UPDATE_WITH_SET
- QUERY_HINT_SEP
- VALUES_AS_TABLE
- NVL2_SUPPORTED
- JSON_TYPE_REQUIRED_FOR_EXTRACTION
- JSON_PATH_BRACKETED_KEY_SUPPORTED
- JSON_KEY_VALUE_PAIR_SEP
- SUPPORTS_TO_NUMBER
- PARSE_JSON_NAME
- PAD_FILL_PATTERN_IS_REQUIRED
- WRAP_DERIVED_VALUES
- SUPPORTS_MEDIAN
- UNSIGNED_TYPE_MAPPING
- TIMESTAMP_TYPE_MAPPING
- LIMIT_FETCH
- LIMIT_ONLY_LITERALS
- CHAR_CAST_MAPPING
- SIGNED_CAST_MAPPING
- computedcolumnconstraint_sql
- array_sql
- arraycontainsall_sql
- dpipe_sql
- extract_sql
- datatype_sql
- jsonarraycontains_sql
- cast_sql
- show_sql
- altercolumn_sql
- chr_sql
- timestamptrunc_sql
- converttimezone_sql
- attimezone_sql
- isascii_sql
- currentschema_sql