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 "BUILD": lambda self: self._parse_build_property(), 72 "REFRESH": lambda self: self._parse_refresh_property(), 73 } 74 75 def _parse_partition_property( 76 self, 77 ) -> t.Optional[exp.Expression] | t.List[exp.Expression]: 78 expr = super()._parse_partition_property() 79 80 if not expr: 81 return self._parse_partitioned_by() 82 83 if isinstance(expr, exp.Property): 84 return expr 85 86 self._match_l_paren() 87 88 if self._match_text_seq("FROM", advance=False): 89 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 90 else: 91 create_expressions = None 92 93 self._match_r_paren() 94 95 return self.expression( 96 exp.PartitionByRangeProperty, 97 partition_expressions=expr, 98 create_expressions=create_expressions, 99 ) 100 101 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 102 self._match_text_seq("FROM") 103 start = self._parse_wrapped(self._parse_string) 104 self._match_text_seq("TO") 105 end = self._parse_wrapped(self._parse_string) 106 self._match_text_seq("INTERVAL") 107 number = self._parse_number() 108 unit = self._parse_var(any_token=True) 109 every = self.expression(exp.Interval, this=number, unit=unit) 110 return self.expression( 111 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 112 ) 113 114 def _parse_partition_range_value(self) -> exp.Partition: 115 expr = super()._parse_partition_range_value() 116 117 if isinstance(expr, exp.Partition): 118 return expr 119 120 self._match_text_seq("VALUES") 121 name = expr 122 123 # Doris-specific bracket syntax: VALUES [(...), (...)) 124 self._match(TokenType.L_BRACKET) 125 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 126 127 self._match(TokenType.R_BRACKET) 128 self._match(TokenType.R_PAREN) 129 130 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 131 return self.expression(exp.Partition, expressions=[part_range]) 132 133 def _parse_build_property(self) -> exp.BuildProperty: 134 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 135 136 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 137 method = self._parse_var(upper=True) 138 139 self._match(TokenType.ON) 140 141 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 142 every = self._match_text_seq("EVERY") and self._parse_number() 143 unit = self._parse_var(any_token=True) if every else None 144 starts = self._match_text_seq("STARTS") and self._parse_string() 145 146 return self.expression( 147 exp.RefreshTriggerProperty, 148 method=method, 149 kind=kind, 150 every=every, 151 unit=unit, 152 starts=starts, 153 ) 154 155 class Generator(MySQL.Generator): 156 LAST_DAY_SUPPORTS_DATE_PART = False 157 VARCHAR_REQUIRES_SIZE = False 158 WITH_PROPERTIES_PREFIX = "PROPERTIES" 159 RENAME_TABLE_WITH_DB = False 160 UPDATE_STATEMENT_SUPPORTS_FROM = True 161 162 TYPE_MAPPING = { 163 **MySQL.Generator.TYPE_MAPPING, 164 exp.DataType.Type.TEXT: "STRING", 165 exp.DataType.Type.TIMESTAMP: "DATETIME", 166 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 167 } 168 169 PROPERTIES_LOCATION = { 170 **MySQL.Generator.PROPERTIES_LOCATION, 171 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 172 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 173 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 174 } 175 176 CAST_MAPPING = {} 177 TIMESTAMP_FUNC_TYPES = set() 178 179 TRANSFORMS = { 180 **MySQL.Generator.TRANSFORMS, 181 exp.AddMonths: rename_func("MONTHS_ADD"), 182 exp.ApproxDistinct: approx_count_distinct_sql, 183 exp.ArgMax: rename_func("MAX_BY"), 184 exp.ArgMin: rename_func("MIN_BY"), 185 exp.ArrayAgg: rename_func("COLLECT_LIST"), 186 exp.ArrayToString: rename_func("ARRAY_JOIN"), 187 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 188 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 189 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 190 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 191 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 192 exp.GroupConcat: lambda self, e: self.func( 193 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 194 ), 195 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 196 exp.Lag: _lag_lead_sql, 197 exp.Lead: _lag_lead_sql, 198 exp.Map: rename_func("ARRAY_MAP"), 199 exp.Property: property_sql, 200 exp.RegexpLike: rename_func("REGEXP"), 201 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 202 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 203 exp.Split: rename_func("SPLIT_BY_STRING"), 204 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 205 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 206 exp.TimeStrToDate: rename_func("TO_DATE"), 207 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 208 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 209 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 210 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 211 exp.UnixToStr: lambda self, e: self.func( 212 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 213 ), 214 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 215 } 216 217 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 218 RESERVED_KEYWORDS = { 219 "account_lock", 220 "account_unlock", 221 "add", 222 "adddate", 223 "admin", 224 "after", 225 "agg_state", 226 "aggregate", 227 "alias", 228 "all", 229 "alter", 230 "analyze", 231 "analyzed", 232 "and", 233 "anti", 234 "append", 235 "array", 236 "array_range", 237 "as", 238 "asc", 239 "at", 240 "authors", 241 "auto", 242 "auto_increment", 243 "backend", 244 "backends", 245 "backup", 246 "begin", 247 "belong", 248 "between", 249 "bigint", 250 "bin", 251 "binary", 252 "binlog", 253 "bitand", 254 "bitmap", 255 "bitmap_union", 256 "bitor", 257 "bitxor", 258 "blob", 259 "boolean", 260 "brief", 261 "broker", 262 "buckets", 263 "build", 264 "builtin", 265 "bulk", 266 "by", 267 "cached", 268 "call", 269 "cancel", 270 "case", 271 "cast", 272 "catalog", 273 "catalogs", 274 "chain", 275 "char", 276 "character", 277 "charset", 278 "check", 279 "clean", 280 "cluster", 281 "clusters", 282 "collate", 283 "collation", 284 "collect", 285 "column", 286 "columns", 287 "comment", 288 "commit", 289 "committed", 290 "compact", 291 "complete", 292 "config", 293 "connection", 294 "connection_id", 295 "consistent", 296 "constraint", 297 "constraints", 298 "convert", 299 "copy", 300 "count", 301 "create", 302 "creation", 303 "cron", 304 "cross", 305 "cube", 306 "current", 307 "current_catalog", 308 "current_date", 309 "current_time", 310 "current_timestamp", 311 "current_user", 312 "data", 313 "database", 314 "databases", 315 "date", 316 "date_add", 317 "date_ceil", 318 "date_diff", 319 "date_floor", 320 "date_sub", 321 "dateadd", 322 "datediff", 323 "datetime", 324 "datetimev2", 325 "datev2", 326 "datetimev1", 327 "datev1", 328 "day", 329 "days_add", 330 "days_sub", 331 "decimal", 332 "decimalv2", 333 "decimalv3", 334 "decommission", 335 "default", 336 "deferred", 337 "delete", 338 "demand", 339 "desc", 340 "describe", 341 "diagnose", 342 "disk", 343 "distinct", 344 "distinctpc", 345 "distinctpcsa", 346 "distributed", 347 "distribution", 348 "div", 349 "do", 350 "doris_internal_table_id", 351 "double", 352 "drop", 353 "dropp", 354 "dual", 355 "duplicate", 356 "dynamic", 357 "else", 358 "enable", 359 "encryptkey", 360 "encryptkeys", 361 "end", 362 "ends", 363 "engine", 364 "engines", 365 "enter", 366 "errors", 367 "events", 368 "every", 369 "except", 370 "exclude", 371 "execute", 372 "exists", 373 "expired", 374 "explain", 375 "export", 376 "extended", 377 "external", 378 "extract", 379 "failed_login_attempts", 380 "false", 381 "fast", 382 "feature", 383 "fields", 384 "file", 385 "filter", 386 "first", 387 "float", 388 "follower", 389 "following", 390 "for", 391 "foreign", 392 "force", 393 "format", 394 "free", 395 "from", 396 "frontend", 397 "frontends", 398 "full", 399 "function", 400 "functions", 401 "generic", 402 "global", 403 "grant", 404 "grants", 405 "graph", 406 "group", 407 "grouping", 408 "groups", 409 "hash", 410 "having", 411 "hdfs", 412 "help", 413 "histogram", 414 "hll", 415 "hll_union", 416 "hostname", 417 "hour", 418 "hub", 419 "identified", 420 "if", 421 "ignore", 422 "immediate", 423 "in", 424 "incremental", 425 "index", 426 "indexes", 427 "infile", 428 "inner", 429 "insert", 430 "install", 431 "int", 432 "integer", 433 "intermediate", 434 "intersect", 435 "interval", 436 "into", 437 "inverted", 438 "ipv4", 439 "ipv6", 440 "is", 441 "is_not_null_pred", 442 "is_null_pred", 443 "isnull", 444 "isolation", 445 "job", 446 "jobs", 447 "join", 448 "json", 449 "jsonb", 450 "key", 451 "keys", 452 "kill", 453 "label", 454 "largeint", 455 "last", 456 "lateral", 457 "ldap", 458 "ldap_admin_password", 459 "left", 460 "less", 461 "level", 462 "like", 463 "limit", 464 "lines", 465 "link", 466 "list", 467 "load", 468 "local", 469 "localtime", 470 "localtimestamp", 471 "location", 472 "lock", 473 "logical", 474 "low_priority", 475 "manual", 476 "map", 477 "match", 478 "match_all", 479 "match_any", 480 "match_phrase", 481 "match_phrase_edge", 482 "match_phrase_prefix", 483 "match_regexp", 484 "materialized", 485 "max", 486 "maxvalue", 487 "memo", 488 "merge", 489 "migrate", 490 "migrations", 491 "min", 492 "minus", 493 "minute", 494 "modify", 495 "month", 496 "mtmv", 497 "name", 498 "names", 499 "natural", 500 "negative", 501 "never", 502 "next", 503 "ngram_bf", 504 "no", 505 "non_nullable", 506 "not", 507 "null", 508 "nulls", 509 "observer", 510 "of", 511 "offset", 512 "on", 513 "only", 514 "open", 515 "optimized", 516 "or", 517 "order", 518 "outer", 519 "outfile", 520 "over", 521 "overwrite", 522 "parameter", 523 "parsed", 524 "partition", 525 "partitions", 526 "password", 527 "password_expire", 528 "password_history", 529 "password_lock_time", 530 "password_reuse", 531 "path", 532 "pause", 533 "percent", 534 "period", 535 "permissive", 536 "physical", 537 "plan", 538 "process", 539 "plugin", 540 "plugins", 541 "policy", 542 "preceding", 543 "prepare", 544 "primary", 545 "proc", 546 "procedure", 547 "processlist", 548 "profile", 549 "properties", 550 "property", 551 "quantile_state", 552 "quantile_union", 553 "query", 554 "quota", 555 "random", 556 "range", 557 "read", 558 "real", 559 "rebalance", 560 "recover", 561 "recycle", 562 "refresh", 563 "references", 564 "regexp", 565 "release", 566 "rename", 567 "repair", 568 "repeatable", 569 "replace", 570 "replace_if_not_null", 571 "replica", 572 "repositories", 573 "repository", 574 "resource", 575 "resources", 576 "restore", 577 "restrictive", 578 "resume", 579 "returns", 580 "revoke", 581 "rewritten", 582 "right", 583 "rlike", 584 "role", 585 "roles", 586 "rollback", 587 "rollup", 588 "routine", 589 "row", 590 "rows", 591 "s3", 592 "sample", 593 "schedule", 594 "scheduler", 595 "schema", 596 "schemas", 597 "second", 598 "select", 599 "semi", 600 "sequence", 601 "serializable", 602 "session", 603 "set", 604 "sets", 605 "shape", 606 "show", 607 "signed", 608 "skew", 609 "smallint", 610 "snapshot", 611 "soname", 612 "split", 613 "sql_block_rule", 614 "start", 615 "starts", 616 "stats", 617 "status", 618 "stop", 619 "storage", 620 "stream", 621 "streaming", 622 "string", 623 "struct", 624 "subdate", 625 "sum", 626 "superuser", 627 "switch", 628 "sync", 629 "system", 630 "table", 631 "tables", 632 "tablesample", 633 "tablet", 634 "tablets", 635 "task", 636 "tasks", 637 "temporary", 638 "terminated", 639 "text", 640 "than", 641 "then", 642 "time", 643 "timestamp", 644 "timestampadd", 645 "timestampdiff", 646 "tinyint", 647 "to", 648 "transaction", 649 "trash", 650 "tree", 651 "triggers", 652 "trim", 653 "true", 654 "truncate", 655 "type", 656 "type_cast", 657 "types", 658 "unbounded", 659 "uncommitted", 660 "uninstall", 661 "union", 662 "unique", 663 "unlock", 664 "unsigned", 665 "update", 666 "use", 667 "user", 668 "using", 669 "value", 670 "values", 671 "varchar", 672 "variables", 673 "variant", 674 "vault", 675 "verbose", 676 "version", 677 "view", 678 "warnings", 679 "week", 680 "when", 681 "where", 682 "whitelist", 683 "with", 684 "work", 685 "workload", 686 "write", 687 "xor", 688 "year", 689 } 690 691 def uniquekeyproperty_sql( 692 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 693 ) -> str: 694 create_stmt = expression.find_ancestor(exp.Create) 695 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 696 return super().uniquekeyproperty_sql(expression, prefix="KEY") 697 698 return super().uniquekeyproperty_sql(expression) 699 700 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 701 name = self.sql(expression, "this") 702 values = expression.expressions 703 704 if len(values) != 1: 705 # Multiple values: use VALUES [ ... ) 706 if values and isinstance(values[0], list): 707 values_sql = ", ".join( 708 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 709 ) 710 else: 711 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 712 713 return f"PARTITION {name} VALUES [{values_sql})" 714 715 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 716 717 def partitionbyrangepropertydynamic_sql( 718 self, expression: exp.PartitionByRangePropertyDynamic 719 ) -> str: 720 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 721 start = self.sql(expression, "start") 722 end = self.sql(expression, "end") 723 every = expression.args.get("every") 724 725 if every: 726 number = self.sql(every, "this") 727 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 728 else: 729 interval = "" 730 731 return f"FROM ({start}) TO ({end}) {interval}" 732 733 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 734 this = expression.this 735 if isinstance(this, exp.Schema): 736 return f"PARTITION BY ({self.expressions(this, flat=True)})" 737 return f"PARTITION BY ({self.sql(this)})" 738 739 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 740 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 741 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 742 if not isinstance(ancestor, exp.Select): 743 sep = " " 744 return super().table_sql(expression, sep=sep)
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 "BUILD": lambda self: self._parse_build_property(), 73 "REFRESH": lambda self: self._parse_refresh_property(), 74 } 75 76 def _parse_partition_property( 77 self, 78 ) -> t.Optional[exp.Expression] | t.List[exp.Expression]: 79 expr = super()._parse_partition_property() 80 81 if not expr: 82 return self._parse_partitioned_by() 83 84 if isinstance(expr, exp.Property): 85 return expr 86 87 self._match_l_paren() 88 89 if self._match_text_seq("FROM", advance=False): 90 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 91 else: 92 create_expressions = None 93 94 self._match_r_paren() 95 96 return self.expression( 97 exp.PartitionByRangeProperty, 98 partition_expressions=expr, 99 create_expressions=create_expressions, 100 ) 101 102 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 103 self._match_text_seq("FROM") 104 start = self._parse_wrapped(self._parse_string) 105 self._match_text_seq("TO") 106 end = self._parse_wrapped(self._parse_string) 107 self._match_text_seq("INTERVAL") 108 number = self._parse_number() 109 unit = self._parse_var(any_token=True) 110 every = self.expression(exp.Interval, this=number, unit=unit) 111 return self.expression( 112 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 113 ) 114 115 def _parse_partition_range_value(self) -> exp.Partition: 116 expr = super()._parse_partition_range_value() 117 118 if isinstance(expr, exp.Partition): 119 return expr 120 121 self._match_text_seq("VALUES") 122 name = expr 123 124 # Doris-specific bracket syntax: VALUES [(...), (...)) 125 self._match(TokenType.L_BRACKET) 126 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 127 128 self._match(TokenType.R_BRACKET) 129 self._match(TokenType.R_PAREN) 130 131 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 132 return self.expression(exp.Partition, expressions=[part_range]) 133 134 def _parse_build_property(self) -> exp.BuildProperty: 135 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 136 137 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 138 method = self._parse_var(upper=True) 139 140 self._match(TokenType.ON) 141 142 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 143 every = self._match_text_seq("EVERY") and self._parse_number() 144 unit = self._parse_var(any_token=True) if every else None 145 starts = self._match_text_seq("STARTS") and self._parse_string() 146 147 return self.expression( 148 exp.RefreshTriggerProperty, 149 method=method, 150 kind=kind, 151 every=every, 152 unit=unit, 153 starts=starts, 154 ) 155 156 class Generator(MySQL.Generator): 157 LAST_DAY_SUPPORTS_DATE_PART = False 158 VARCHAR_REQUIRES_SIZE = False 159 WITH_PROPERTIES_PREFIX = "PROPERTIES" 160 RENAME_TABLE_WITH_DB = False 161 UPDATE_STATEMENT_SUPPORTS_FROM = True 162 163 TYPE_MAPPING = { 164 **MySQL.Generator.TYPE_MAPPING, 165 exp.DataType.Type.TEXT: "STRING", 166 exp.DataType.Type.TIMESTAMP: "DATETIME", 167 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 168 } 169 170 PROPERTIES_LOCATION = { 171 **MySQL.Generator.PROPERTIES_LOCATION, 172 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 173 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 174 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 175 } 176 177 CAST_MAPPING = {} 178 TIMESTAMP_FUNC_TYPES = set() 179 180 TRANSFORMS = { 181 **MySQL.Generator.TRANSFORMS, 182 exp.AddMonths: rename_func("MONTHS_ADD"), 183 exp.ApproxDistinct: approx_count_distinct_sql, 184 exp.ArgMax: rename_func("MAX_BY"), 185 exp.ArgMin: rename_func("MIN_BY"), 186 exp.ArrayAgg: rename_func("COLLECT_LIST"), 187 exp.ArrayToString: rename_func("ARRAY_JOIN"), 188 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 189 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 190 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 191 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 192 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 193 exp.GroupConcat: lambda self, e: self.func( 194 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 195 ), 196 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 197 exp.Lag: _lag_lead_sql, 198 exp.Lead: _lag_lead_sql, 199 exp.Map: rename_func("ARRAY_MAP"), 200 exp.Property: property_sql, 201 exp.RegexpLike: rename_func("REGEXP"), 202 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 203 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 204 exp.Split: rename_func("SPLIT_BY_STRING"), 205 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 206 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 207 exp.TimeStrToDate: rename_func("TO_DATE"), 208 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 209 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 210 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 211 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 212 exp.UnixToStr: lambda self, e: self.func( 213 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 214 ), 215 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 216 } 217 218 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 219 RESERVED_KEYWORDS = { 220 "account_lock", 221 "account_unlock", 222 "add", 223 "adddate", 224 "admin", 225 "after", 226 "agg_state", 227 "aggregate", 228 "alias", 229 "all", 230 "alter", 231 "analyze", 232 "analyzed", 233 "and", 234 "anti", 235 "append", 236 "array", 237 "array_range", 238 "as", 239 "asc", 240 "at", 241 "authors", 242 "auto", 243 "auto_increment", 244 "backend", 245 "backends", 246 "backup", 247 "begin", 248 "belong", 249 "between", 250 "bigint", 251 "bin", 252 "binary", 253 "binlog", 254 "bitand", 255 "bitmap", 256 "bitmap_union", 257 "bitor", 258 "bitxor", 259 "blob", 260 "boolean", 261 "brief", 262 "broker", 263 "buckets", 264 "build", 265 "builtin", 266 "bulk", 267 "by", 268 "cached", 269 "call", 270 "cancel", 271 "case", 272 "cast", 273 "catalog", 274 "catalogs", 275 "chain", 276 "char", 277 "character", 278 "charset", 279 "check", 280 "clean", 281 "cluster", 282 "clusters", 283 "collate", 284 "collation", 285 "collect", 286 "column", 287 "columns", 288 "comment", 289 "commit", 290 "committed", 291 "compact", 292 "complete", 293 "config", 294 "connection", 295 "connection_id", 296 "consistent", 297 "constraint", 298 "constraints", 299 "convert", 300 "copy", 301 "count", 302 "create", 303 "creation", 304 "cron", 305 "cross", 306 "cube", 307 "current", 308 "current_catalog", 309 "current_date", 310 "current_time", 311 "current_timestamp", 312 "current_user", 313 "data", 314 "database", 315 "databases", 316 "date", 317 "date_add", 318 "date_ceil", 319 "date_diff", 320 "date_floor", 321 "date_sub", 322 "dateadd", 323 "datediff", 324 "datetime", 325 "datetimev2", 326 "datev2", 327 "datetimev1", 328 "datev1", 329 "day", 330 "days_add", 331 "days_sub", 332 "decimal", 333 "decimalv2", 334 "decimalv3", 335 "decommission", 336 "default", 337 "deferred", 338 "delete", 339 "demand", 340 "desc", 341 "describe", 342 "diagnose", 343 "disk", 344 "distinct", 345 "distinctpc", 346 "distinctpcsa", 347 "distributed", 348 "distribution", 349 "div", 350 "do", 351 "doris_internal_table_id", 352 "double", 353 "drop", 354 "dropp", 355 "dual", 356 "duplicate", 357 "dynamic", 358 "else", 359 "enable", 360 "encryptkey", 361 "encryptkeys", 362 "end", 363 "ends", 364 "engine", 365 "engines", 366 "enter", 367 "errors", 368 "events", 369 "every", 370 "except", 371 "exclude", 372 "execute", 373 "exists", 374 "expired", 375 "explain", 376 "export", 377 "extended", 378 "external", 379 "extract", 380 "failed_login_attempts", 381 "false", 382 "fast", 383 "feature", 384 "fields", 385 "file", 386 "filter", 387 "first", 388 "float", 389 "follower", 390 "following", 391 "for", 392 "foreign", 393 "force", 394 "format", 395 "free", 396 "from", 397 "frontend", 398 "frontends", 399 "full", 400 "function", 401 "functions", 402 "generic", 403 "global", 404 "grant", 405 "grants", 406 "graph", 407 "group", 408 "grouping", 409 "groups", 410 "hash", 411 "having", 412 "hdfs", 413 "help", 414 "histogram", 415 "hll", 416 "hll_union", 417 "hostname", 418 "hour", 419 "hub", 420 "identified", 421 "if", 422 "ignore", 423 "immediate", 424 "in", 425 "incremental", 426 "index", 427 "indexes", 428 "infile", 429 "inner", 430 "insert", 431 "install", 432 "int", 433 "integer", 434 "intermediate", 435 "intersect", 436 "interval", 437 "into", 438 "inverted", 439 "ipv4", 440 "ipv6", 441 "is", 442 "is_not_null_pred", 443 "is_null_pred", 444 "isnull", 445 "isolation", 446 "job", 447 "jobs", 448 "join", 449 "json", 450 "jsonb", 451 "key", 452 "keys", 453 "kill", 454 "label", 455 "largeint", 456 "last", 457 "lateral", 458 "ldap", 459 "ldap_admin_password", 460 "left", 461 "less", 462 "level", 463 "like", 464 "limit", 465 "lines", 466 "link", 467 "list", 468 "load", 469 "local", 470 "localtime", 471 "localtimestamp", 472 "location", 473 "lock", 474 "logical", 475 "low_priority", 476 "manual", 477 "map", 478 "match", 479 "match_all", 480 "match_any", 481 "match_phrase", 482 "match_phrase_edge", 483 "match_phrase_prefix", 484 "match_regexp", 485 "materialized", 486 "max", 487 "maxvalue", 488 "memo", 489 "merge", 490 "migrate", 491 "migrations", 492 "min", 493 "minus", 494 "minute", 495 "modify", 496 "month", 497 "mtmv", 498 "name", 499 "names", 500 "natural", 501 "negative", 502 "never", 503 "next", 504 "ngram_bf", 505 "no", 506 "non_nullable", 507 "not", 508 "null", 509 "nulls", 510 "observer", 511 "of", 512 "offset", 513 "on", 514 "only", 515 "open", 516 "optimized", 517 "or", 518 "order", 519 "outer", 520 "outfile", 521 "over", 522 "overwrite", 523 "parameter", 524 "parsed", 525 "partition", 526 "partitions", 527 "password", 528 "password_expire", 529 "password_history", 530 "password_lock_time", 531 "password_reuse", 532 "path", 533 "pause", 534 "percent", 535 "period", 536 "permissive", 537 "physical", 538 "plan", 539 "process", 540 "plugin", 541 "plugins", 542 "policy", 543 "preceding", 544 "prepare", 545 "primary", 546 "proc", 547 "procedure", 548 "processlist", 549 "profile", 550 "properties", 551 "property", 552 "quantile_state", 553 "quantile_union", 554 "query", 555 "quota", 556 "random", 557 "range", 558 "read", 559 "real", 560 "rebalance", 561 "recover", 562 "recycle", 563 "refresh", 564 "references", 565 "regexp", 566 "release", 567 "rename", 568 "repair", 569 "repeatable", 570 "replace", 571 "replace_if_not_null", 572 "replica", 573 "repositories", 574 "repository", 575 "resource", 576 "resources", 577 "restore", 578 "restrictive", 579 "resume", 580 "returns", 581 "revoke", 582 "rewritten", 583 "right", 584 "rlike", 585 "role", 586 "roles", 587 "rollback", 588 "rollup", 589 "routine", 590 "row", 591 "rows", 592 "s3", 593 "sample", 594 "schedule", 595 "scheduler", 596 "schema", 597 "schemas", 598 "second", 599 "select", 600 "semi", 601 "sequence", 602 "serializable", 603 "session", 604 "set", 605 "sets", 606 "shape", 607 "show", 608 "signed", 609 "skew", 610 "smallint", 611 "snapshot", 612 "soname", 613 "split", 614 "sql_block_rule", 615 "start", 616 "starts", 617 "stats", 618 "status", 619 "stop", 620 "storage", 621 "stream", 622 "streaming", 623 "string", 624 "struct", 625 "subdate", 626 "sum", 627 "superuser", 628 "switch", 629 "sync", 630 "system", 631 "table", 632 "tables", 633 "tablesample", 634 "tablet", 635 "tablets", 636 "task", 637 "tasks", 638 "temporary", 639 "terminated", 640 "text", 641 "than", 642 "then", 643 "time", 644 "timestamp", 645 "timestampadd", 646 "timestampdiff", 647 "tinyint", 648 "to", 649 "transaction", 650 "trash", 651 "tree", 652 "triggers", 653 "trim", 654 "true", 655 "truncate", 656 "type", 657 "type_cast", 658 "types", 659 "unbounded", 660 "uncommitted", 661 "uninstall", 662 "union", 663 "unique", 664 "unlock", 665 "unsigned", 666 "update", 667 "use", 668 "user", 669 "using", 670 "value", 671 "values", 672 "varchar", 673 "variables", 674 "variant", 675 "vault", 676 "verbose", 677 "version", 678 "view", 679 "warnings", 680 "week", 681 "when", 682 "where", 683 "whitelist", 684 "with", 685 "work", 686 "workload", 687 "write", 688 "xor", 689 "year", 690 } 691 692 def uniquekeyproperty_sql( 693 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 694 ) -> str: 695 create_stmt = expression.find_ancestor(exp.Create) 696 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 697 return super().uniquekeyproperty_sql(expression, prefix="KEY") 698 699 return super().uniquekeyproperty_sql(expression) 700 701 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 702 name = self.sql(expression, "this") 703 values = expression.expressions 704 705 if len(values) != 1: 706 # Multiple values: use VALUES [ ... ) 707 if values and isinstance(values[0], list): 708 values_sql = ", ".join( 709 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 710 ) 711 else: 712 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 713 714 return f"PARTITION {name} VALUES [{values_sql})" 715 716 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 717 718 def partitionbyrangepropertydynamic_sql( 719 self, expression: exp.PartitionByRangePropertyDynamic 720 ) -> str: 721 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 722 start = self.sql(expression, "start") 723 end = self.sql(expression, "end") 724 every = expression.args.get("every") 725 726 if every: 727 number = self.sql(every, "this") 728 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 729 else: 730 interval = "" 731 732 return f"FROM ({start}) TO ({end}) {interval}" 733 734 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 735 this = expression.this 736 if isinstance(this, exp.Schema): 737 return f"PARTITION BY ({self.expressions(this, flat=True)})" 738 return f"PARTITION BY ({self.sql(this)})" 739 740 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 741 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 742 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 743 if not isinstance(ancestor, exp.Select): 744 sep = " " 745 return super().table_sql(expression, sep=sep)
VALID_INTERVAL_UNITS: Set[str] =
{'MON', 'DAY OF YEAR', 'YEARS', 'EPOCH_NANOSECONDS', 'WEEKOFYEAR', 'DAY_MINUTE', 'M', 'MIL', 'DY', 'MINUTE', 'Y', 'MILS', 'MONS', 'NSEC', 'DOW', 'EPOCH_MICROSECONDS', 'YYYY', 'YEAR_MONTH', 'Q', 'DAY OF WEEK', 'HR', 'MILLISECONDS', 'DW_ISO', 'QTRS', 'SECOND_MICROSECOND', 'HOUR_MICROSECOND', 'W', 'NSECONDS', 'US', 'MINUTES', 'NANOSECS', 'NANOSECOND', 'MILLISECS', 'DECADES', 'EPOCH_SECONDS', 'MILLISECOND', 'C', 'DAY_SECOND', 'DECS', 'DAYOFWEEK', 'DECADE', 'DAYS', 'CENTURY', 'YY', 'YR', 'SEC', 'QTR', 'DAY_MICROSECOND', 'MIN', 'WK', 'MM', 'DD', 'DW', 'YYY', 'TIMEZONE_HOUR', 'DOY', 'EPOCH_MILLISECONDS', 'TZH', 'DAYOFWEEK_ISO', 'MSEC', 'NANOSEC', 'CENTURIES', 'MICROSECS', 'MILLISECON', 'S', 'MI', 'WEEKDAY', 'EPOCH_NANOSECOND', 'WEEKOFYEARISO', 'MSECOND', 'HOURS', 'USECOND', 'EPOCH_SECOND', 'DAY', 'HH', 'SECS', 'MINUTE_MICROSECOND', 'NSECOND', 'EPOCH_MICROSECOND', 'MONTH', 'TZM', 'DOW_ISO', 'YEAR', 'D', 'MSECS', 'DAYOFMONTH', 'EPOCH_MILLISECOND', 'HOUR', 'DAY_HOUR', 'YRS', 'WY', 'MICROSECONDS', 'HOUR_MINUTE', 'HOUR_SECOND', 'DAYOFWEEKISO', 'WOY', 'WEEKDAY_ISO', 'H', 'MINS', 'MSECONDS', 'HRS', 'WEEK_ISO', 'TIMEZONE_MINUTE', 'MILLENNIUM', 'USECS', 'MINUTE_SECOND', 'MILLISEC', 'MICROSECOND', 'WEEKOFYEAR_ISO', 'SECOND', 'USECONDS', 'WEEKISO', 'QUARTERS', 'MONTHS', 'MICROSEC', 'WEEK', 'DAYOFYEAR', 'QUARTER', 'CENTS', 'EPOCH', 'CENT', 'MILLENIA', 'DEC', 'NS', 'SECONDS', 'USEC', 'MS'}
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}}}
ESCAPED_SEQUENCES: Dict[str, str] =
{'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\'}
Inherited Members
- sqlglot.dialects.mysql.MySQL
- PROMOTE_TO_INFERRED_DATETIME_TYPE
- IDENTIFIERS_CAN_START_WITH_DIGIT
- NORMALIZATION_STRATEGY
- DPIPE_IS_STRING_CONCAT
- SUPPORTS_USER_DEFINED_TYPES
- SUPPORTS_SEMI_ANTI_JOIN
- SAFE_DIVISION
- SAFE_TO_ELIMINATE_DOUBLE_NEGATION
- LEAST_GREATEST_IGNORES_NULLS
- EXPRESSION_METADATA
- TIME_MAPPING
- Tokenizer
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 "BUILD": lambda self: self._parse_build_property(), 73 "REFRESH": lambda self: self._parse_refresh_property(), 74 } 75 76 def _parse_partition_property( 77 self, 78 ) -> t.Optional[exp.Expression] | t.List[exp.Expression]: 79 expr = super()._parse_partition_property() 80 81 if not expr: 82 return self._parse_partitioned_by() 83 84 if isinstance(expr, exp.Property): 85 return expr 86 87 self._match_l_paren() 88 89 if self._match_text_seq("FROM", advance=False): 90 create_expressions = self._parse_csv(self._parse_partitioning_granularity_dynamic) 91 else: 92 create_expressions = None 93 94 self._match_r_paren() 95 96 return self.expression( 97 exp.PartitionByRangeProperty, 98 partition_expressions=expr, 99 create_expressions=create_expressions, 100 ) 101 102 def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic: 103 self._match_text_seq("FROM") 104 start = self._parse_wrapped(self._parse_string) 105 self._match_text_seq("TO") 106 end = self._parse_wrapped(self._parse_string) 107 self._match_text_seq("INTERVAL") 108 number = self._parse_number() 109 unit = self._parse_var(any_token=True) 110 every = self.expression(exp.Interval, this=number, unit=unit) 111 return self.expression( 112 exp.PartitionByRangePropertyDynamic, start=start, end=end, every=every 113 ) 114 115 def _parse_partition_range_value(self) -> exp.Partition: 116 expr = super()._parse_partition_range_value() 117 118 if isinstance(expr, exp.Partition): 119 return expr 120 121 self._match_text_seq("VALUES") 122 name = expr 123 124 # Doris-specific bracket syntax: VALUES [(...), (...)) 125 self._match(TokenType.L_BRACKET) 126 values = self._parse_csv(lambda: self._parse_wrapped_csv(self._parse_expression)) 127 128 self._match(TokenType.R_BRACKET) 129 self._match(TokenType.R_PAREN) 130 131 part_range = self.expression(exp.PartitionRange, this=name, expressions=values) 132 return self.expression(exp.Partition, expressions=[part_range]) 133 134 def _parse_build_property(self) -> exp.BuildProperty: 135 return self.expression(exp.BuildProperty, this=self._parse_var(upper=True)) 136 137 def _parse_refresh_property(self) -> exp.RefreshTriggerProperty: 138 method = self._parse_var(upper=True) 139 140 self._match(TokenType.ON) 141 142 kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper() 143 every = self._match_text_seq("EVERY") and self._parse_number() 144 unit = self._parse_var(any_token=True) if every else None 145 starts = self._match_text_seq("STARTS") and self._parse_string() 146 147 return self.expression( 148 exp.RefreshTriggerProperty, 149 method=method, 150 kind=kind, 151 every=every, 152 unit=unit, 153 starts=starts, 154 )
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_PERCENTILE_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileAccumulate'>>, 'APPROX_PERCENTILE_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileCombine'>>, 'APPROX_PERCENTILE_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileEstimate'>>, '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_K_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKAccumulate'>>, 'APPROX_TOP_K_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKCombine'>>, 'APPROX_TOP_K_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKEstimate'>>, 'APPROX_TOP_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopSum'>>, 'APPROXIMATE_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, 'APPROXIMATE_JACCARD_INDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, '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_APPEND': <function build_array_append>, 'ARRAY_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayCompact'>>, 'ARRAY_CONCAT': <function build_array_concat>, 'ARRAY_CAT': <function build_array_concat>, '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_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayInsert'>>, '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_PREPEND': <function build_array_prepend>, 'ARRAY_REMOVE': <function build_array_remove>, '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'>>, 'ARRAYS_ZIP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraysZip'>>, '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'>>, 'BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeBinary'>>, 'BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeString'>>, 'BASE64_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64Encode'>>, 'BIT_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitLength'>>, 'BITMAP_BIT_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBitPosition'>>, 'BITMAP_BUCKET_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBucketNumber'>>, 'BITMAP_CONSTRUCT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapConstructAgg'>>, 'BITMAP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapCount'>>, 'BITMAP_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapOrAgg'>>, 'BITWISE_AND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BITWISE_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCount'>>, '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'>>, 'BOOLAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Booland'>>, 'BOOLNOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolnot'>>, 'BOOLOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolor'>>, 'BOOLXOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BoolxorAgg'>>, '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'>>, 'CHECK_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckJson'>>, 'CHECK_XML': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckXml'>>, 'CHR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, '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'>>, 'COLLATION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collation'>>, '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'>>, 'COMPRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Compress'>>, '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'>>, 'COS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cos'>>, 'COSH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cosh'>>, '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_ACCOUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccount'>>, 'CURRENT_ACCOUNT_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccountName'>>, 'CURRENT_AVAILABLE_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAvailableRoles'>>, 'CURRENT_CATALOG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentCatalog'>>, 'CURRENT_CLIENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentClient'>>, 'CURRENT_DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatabase'>>, '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_IP_ADDRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentIpAddress'>>, 'CURRENT_ORGANIZATION_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationName'>>, 'CURRENT_ORGANIZATION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationUser'>>, 'CURRENT_REGION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRegion'>>, 'CURRENT_ROLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRole'>>, 'CURRENT_ROLE_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRoleType'>>, 'CURRENT_SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'CURRENT_SCHEMAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchemas'>>, 'CURRENT_SECONDARY_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSecondaryRoles'>>, 'CURRENT_SESSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSession'>>, 'CURRENT_STATEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentStatement'>>, '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_TIMEZONE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimezone'>>, 'CURRENT_TRANSACTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTransaction'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'CURRENT_VERSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentVersion'>>, 'CURRENT_WAREHOUSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentWarehouse'>>, '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>>, 'DAYNAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Dayname'>>, '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'>>, 'DECOMPRESS_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressBinary'>>, 'DECOMPRESS_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressString'>>, 'DECRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decrypt'>>, 'DECRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecryptRaw'>>, 'DEGREES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Degrees'>>, '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'>>, 'DOT_PRODUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DotProduct'>>, 'ELT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Elt'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'ENCRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encrypt'>>, 'ENCRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EncryptRaw'>>, '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'>>, 'EQUAL_NULL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EqualNull'>>, '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'>>, 'FACTORIAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Factorial'>>, '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'>>, 'GENERATOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Generator'>>, 'GET_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GetExtract'>>, 'GETBIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GET_BIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GREATEST': <function Parser.<lambda>>, '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'>>, 'GROUPING_ID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupingId'>>, 'HASH_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HashAgg'>>, 'HEX': <function build_hex>, 'HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexDecodeString'>>, 'HEX_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexEncode'>>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'HOST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Host'>>, 'HOUR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hour'>>, '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_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsArray'>>, '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'>>, 'IS_NULL_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNullValue'>>, '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'>>, 'JSON_KEYS': <function Parser.<lambda>>, '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'>>, 'JAROWINKLER_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JarowinklerSimilarity'>>, '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'>>, 'KURTOSIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Kurtosis'>>, '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': <function Parser.<lambda>>, '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'>>, 'LOCALTIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtime'>>, 'LOCALTIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtimestamp'>>, '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'>>, 'MANHATTAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ManhattanDistance'>>, 'MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Map'>>, 'MAP_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapCat'>>, 'MAP_CONTAINS_KEY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapContainsKey'>>, 'MAP_DELETE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapDelete'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MAP_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapInsert'>>, 'MAP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapKeys'>>, 'MAP_PICK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapPick'>>, 'MAP_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapSize'>>, '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'>>, 'MINHASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Minhash'>>, 'MINHASH_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MinhashCombine'>>, 'MINUTE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Minute'>>, 'MODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Mode'>>, 'MONTH': <function MySQL.Parser.<lambda>>, 'MONTHNAME': <function MySQL.Parser.<lambda>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NET_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NetFunc'>>, 'NEXT_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextDay'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normal'>>, '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_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectAgg'>>, '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_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseIp'>>, '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'>>, 'PARSE_URL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseUrl'>>, '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'>>, 'PI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pi'>>, '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'>>, 'PREVIOUS_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PreviousDay'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RADIANS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Radians'>>, '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'>>, 'RANDSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randstr'>>, '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'>>, 'READ_PARQUET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadParquet'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REG_DOMAIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegDomain'>>, 'REGEXP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpCount'>>, '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_FULL_MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpFullMatch'>>, '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'>>, 'REGR_AVGX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgx'>>, 'REGR_AVGY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgy'>>, 'REGR_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrCount'>>, 'REGR_INTERCEPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrIntercept'>>, 'REGR_R2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrR2'>>, 'REGR_SLOPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSlope'>>, 'REGR_SXX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxx'>>, 'REGR_SXY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxy'>>, 'REGR_SYY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSyy'>>, 'REGR_VALX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValx'>>, 'REGR_VALY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValy'>>, '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'>>, 'RTRIMMED_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RtrimmedLength'>>, '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_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeFunc'>>, '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'>>, 'SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Search'>>, 'SEARCH_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SearchIp'>>, 'SEC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sec'>>, 'SECH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sech'>>, 'SECOND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Second'>>, 'SEQ1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq1'>>, 'SEQ2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq2'>>, 'SEQ4': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq4'>>, 'SEQ8': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq8'>>, 'SESSION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SessionUser'>>, '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'>>, 'SKEWNESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Skewness'>>, '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'>>, 'SOUNDEX_P123': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SoundexP123'>>, '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'>>, 'SYSTIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Systimestamp'>>, 'TAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Tan'>>, 'TANH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Tanh'>>, '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_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSlice'>>, '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_LTZ_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampLtzFromParts'>>, 'TIMESTAMPLTZFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampLtzFromParts'>>, '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'>>, 'TIMESTAMP_TZ_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTzFromParts'>>, 'TIMESTAMPTZFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTzFromParts'>>, '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_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBinary'>>, 'TO_BOOLEAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBoolean'>>, '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_DECFLOAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDecfloat'>>, 'TO_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, 'TO_FILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToFile'>>, '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_BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeBinary'>>, 'TRY_BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeString'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TRY_HEX_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeBinary'>>, 'TRY_HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeString'>>, 'TRY_TO_DECFLOAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryToDecfloat'>>, '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'>>, 'UNIFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uniform'>>, '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': <function Parser.<lambda>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <function Parser.<lambda>>, '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>>, 'WIDTH_BUCKET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WidthBucket'>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'XMLGET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLGet'>>, '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>>, 'YEAR_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAROFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAR_OF_WEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'YEAROFWEEKISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'ZIPF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Zipf'>>, '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.BitwiseCount'>>, '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'>>, '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>>, 'CHAR': <function Parser.<lambda>>, 'CHR': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'INITCAP': <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>>, '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'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>: <class 'sqlglot.expressions.CurrentRole'>}
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 MySQL.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.INT8RANGE: 'INT8RANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.JSON: 'JSON'>, <TokenType.DATE32: 'DATE32'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.UINT256: 'UINT256'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.NAME: 'NAME'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.DESC: 'DESC'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.END: 'END'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.VAR: 'VAR'>, <TokenType.RENAME: 'RENAME'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.LIST: 'LIST'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TIME_NS: 'TIME_NS'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.UINT: 'UINT'>, <TokenType.UUID: 'UUID'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.INT256: 'INT256'>, <TokenType.TOP: 'TOP'>, <TokenType.LOCALTIME: 'LOCALTIME'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.SEMI: 'SEMI'>, <TokenType.TEXT: 'TEXT'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.IS: 'IS'>, <TokenType.VIEW: 'VIEW'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.DETACH: 'DETACH'>, <TokenType.BIGNUM: 'BIGNUM'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.LOCALTIMESTAMP: 'LOCALTIMESTAMP'>, <TokenType.TAG: 'TAG'>, <TokenType.TRUE: 'TRUE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.KILL: 'KILL'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPV4: 'IPV4'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.ANY: 'ANY'>, <TokenType.MONEY: 'MONEY'>, <TokenType.INOUT: 'INOUT'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.SET: 'SET'>, <TokenType.BLOB: 'BLOB'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.COPY: 'COPY'>, <TokenType.CUBE: 'CUBE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.SINK: 'SINK'>, <TokenType.CHAR: 'CHAR'>, <TokenType.SOME: 'SOME'>, <TokenType.ANALYZE: 'ANALYZE'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.INT128: 'INT128'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.STAGE: 'STAGE'>, <TokenType.POINT: 'POINT'>, <TokenType.MATCH: 'MATCH'>, <TokenType.DATE: 'DATE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.INET: 'INET'>, <TokenType.FALSE: 'FALSE'>, <TokenType.CASE: 'CASE'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.LOAD: 'LOAD'>, <TokenType.UINT128: 'UINT128'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.ROWS: 'ROWS'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.ENUM: 'ENUM'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.GET: 'GET'>, <TokenType.IPV6: 'IPV6'>, <TokenType.ROW: 'ROW'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.NEXT: 'NEXT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.KEEP: 'KEEP'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.RANGE: 'RANGE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.INT: 'INT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.VOID: 'VOID'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.SUPER: 'SUPER'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.NULL: 'NULL'>, <TokenType.FILE: 'FILE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SESSION: 'SESSION'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.OVER: 'OVER'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.YEAR: 'YEAR'>, <TokenType.ANTI: 'ANTI'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.DECFLOAT: 'DECFLOAT'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.MODEL: 'MODEL'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.RING: 'RING'>, <TokenType.ASC: 'ASC'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CACHE: 'CACHE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.ALL: 'ALL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.MAP: 'MAP'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.TIME: 'TIME'>, <TokenType.BIT: 'BIT'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.MERGE: 'MERGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PUT: 'PUT'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>}
ID_VAR_TOKENS =
{<TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.LOCK: 'LOCK'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.JSON: 'JSON'>, <TokenType.DATE32: 'DATE32'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.DIV: 'DIV'>, <TokenType.UINT256: 'UINT256'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.NAME: 'NAME'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.DESC: 'DESC'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.END: 'END'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.VAR: 'VAR'>, <TokenType.RENAME: 'RENAME'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.LIST: 'LIST'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.TIME_NS: 'TIME_NS'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.UINT: 'UINT'>, <TokenType.UUID: 'UUID'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.INT256: 'INT256'>, <TokenType.TOP: 'TOP'>, <TokenType.LOCALTIME: 'LOCALTIME'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.SEMI: 'SEMI'>, <TokenType.TEXT: 'TEXT'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.IS: 'IS'>, <TokenType.VIEW: 'VIEW'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.DETACH: 'DETACH'>, <TokenType.BIGNUM: 'BIGNUM'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.LOCALTIMESTAMP: 'LOCALTIMESTAMP'>, <TokenType.TAG: 'TAG'>, <TokenType.TRUE: 'TRUE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.KILL: 'KILL'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPV4: 'IPV4'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.ANY: 'ANY'>, <TokenType.MONEY: 'MONEY'>, <TokenType.INOUT: 'INOUT'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.SET: 'SET'>, <TokenType.BLOB: 'BLOB'>, <TokenType.FULL: 'FULL'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.COPY: 'COPY'>, <TokenType.CUBE: 'CUBE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.SINK: 'SINK'>, <TokenType.CHAR: 'CHAR'>, <TokenType.SOME: 'SOME'>, <TokenType.ANALYZE: 'ANALYZE'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.LEFT: 'LEFT'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.FILTER: 'FILTER'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TABLE: 'TABLE'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.INT128: 'INT128'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.STAGE: 'STAGE'>, <TokenType.POINT: 'POINT'>, <TokenType.MATCH: 'MATCH'>, <TokenType.DATE: 'DATE'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.INET: 'INET'>, <TokenType.FALSE: 'FALSE'>, <TokenType.CASE: 'CASE'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.CURRENT_CATALOG: 'CURRENT_CATALOG'>, <TokenType.LOAD: 'LOAD'>, <TokenType.UINT128: 'UINT128'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.ROWS: 'ROWS'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.ENUM: 'ENUM'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.SESSION_USER: 'SESSION_USER'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.GET: 'GET'>, <TokenType.IPV6: 'IPV6'>, <TokenType.ROW: 'ROW'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.NEXT: 'NEXT'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.KEEP: 'KEEP'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.RANGE: 'RANGE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.INT: 'INT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.VOID: 'VOID'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.SUPER: 'SUPER'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.NULL: 'NULL'>, <TokenType.FILE: 'FILE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>, <TokenType.ASOF: 'ASOF'>, <TokenType.FIRST: 'FIRST'>, <TokenType.SESSION: 'SESSION'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.OVER: 'OVER'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.USE: 'USE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.YEAR: 'YEAR'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.DECFLOAT: 'DECFLOAT'>, <TokenType.PUT: 'PUT'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.MODEL: 'MODEL'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.RING: 'RING'>, <TokenType.ASC: 'ASC'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.CACHE: 'CACHE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.ALL: 'ALL'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.XML: 'XML'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.MAP: 'MAP'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.TIME: 'TIME'>, <TokenType.BIT: 'BIT'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.MERGE: 'MERGE'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.BINARY: 'BINARY'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.ANTI: 'ANTI'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>}
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
- 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
- SET_ASSIGNMENT_DELIMITERS
- 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
- ALTER_TABLE_PARTITIONS
- JOINS_HAVE_EQUAL_PRECEDENCE
- ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
- MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS
- JSON_EXTRACT_REQUIRES_JSON_EXPRESSION
- ADD_JOIN_ON_TRUE
- SUPPORTS_OMITTED_INTERVAL_SPAN_UNIT
- 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
156 class Generator(MySQL.Generator): 157 LAST_DAY_SUPPORTS_DATE_PART = False 158 VARCHAR_REQUIRES_SIZE = False 159 WITH_PROPERTIES_PREFIX = "PROPERTIES" 160 RENAME_TABLE_WITH_DB = False 161 UPDATE_STATEMENT_SUPPORTS_FROM = True 162 163 TYPE_MAPPING = { 164 **MySQL.Generator.TYPE_MAPPING, 165 exp.DataType.Type.TEXT: "STRING", 166 exp.DataType.Type.TIMESTAMP: "DATETIME", 167 exp.DataType.Type.TIMESTAMPTZ: "DATETIME", 168 } 169 170 PROPERTIES_LOCATION = { 171 **MySQL.Generator.PROPERTIES_LOCATION, 172 exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA, 173 exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, 174 exp.BuildProperty: exp.Properties.Location.POST_SCHEMA, 175 } 176 177 CAST_MAPPING = {} 178 TIMESTAMP_FUNC_TYPES = set() 179 180 TRANSFORMS = { 181 **MySQL.Generator.TRANSFORMS, 182 exp.AddMonths: rename_func("MONTHS_ADD"), 183 exp.ApproxDistinct: approx_count_distinct_sql, 184 exp.ArgMax: rename_func("MAX_BY"), 185 exp.ArgMin: rename_func("MIN_BY"), 186 exp.ArrayAgg: rename_func("COLLECT_LIST"), 187 exp.ArrayToString: rename_func("ARRAY_JOIN"), 188 exp.ArrayUniqueAgg: rename_func("COLLECT_SET"), 189 exp.CurrentDate: lambda self, _: self.func("CURRENT_DATE"), 190 exp.CurrentTimestamp: lambda self, _: self.func("NOW"), 191 exp.DateTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 192 exp.EuclideanDistance: rename_func("L2_DISTANCE"), 193 exp.GroupConcat: lambda self, e: self.func( 194 "GROUP_CONCAT", e.this, e.args.get("separator") or exp.Literal.string(",") 195 ), 196 exp.JSONExtractScalar: lambda self, e: self.func("JSON_EXTRACT", e.this, e.expression), 197 exp.Lag: _lag_lead_sql, 198 exp.Lead: _lag_lead_sql, 199 exp.Map: rename_func("ARRAY_MAP"), 200 exp.Property: property_sql, 201 exp.RegexpLike: rename_func("REGEXP"), 202 exp.RegexpSplit: rename_func("SPLIT_BY_STRING"), 203 exp.SchemaCommentProperty: lambda self, e: self.naked_property(e), 204 exp.Split: rename_func("SPLIT_BY_STRING"), 205 exp.StringToArray: rename_func("SPLIT_BY_STRING"), 206 exp.StrToUnix: lambda self, e: self.func("UNIX_TIMESTAMP", e.this, self.format_time(e)), 207 exp.TimeStrToDate: rename_func("TO_DATE"), 208 exp.TsOrDsAdd: lambda self, e: self.func("DATE_ADD", e.this, e.expression), 209 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this), 210 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 211 exp.TimestampTrunc: lambda self, e: self.func("DATE_TRUNC", e.this, unit_to_str(e)), 212 exp.UnixToStr: lambda self, e: self.func( 213 "FROM_UNIXTIME", e.this, time_format("doris")(self, e) 214 ), 215 exp.UnixToTime: rename_func("FROM_UNIXTIME"), 216 } 217 218 # https://github.com/apache/doris/blob/e4f41dbf1ec03f5937fdeba2ee1454a20254015b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4#L93 219 RESERVED_KEYWORDS = { 220 "account_lock", 221 "account_unlock", 222 "add", 223 "adddate", 224 "admin", 225 "after", 226 "agg_state", 227 "aggregate", 228 "alias", 229 "all", 230 "alter", 231 "analyze", 232 "analyzed", 233 "and", 234 "anti", 235 "append", 236 "array", 237 "array_range", 238 "as", 239 "asc", 240 "at", 241 "authors", 242 "auto", 243 "auto_increment", 244 "backend", 245 "backends", 246 "backup", 247 "begin", 248 "belong", 249 "between", 250 "bigint", 251 "bin", 252 "binary", 253 "binlog", 254 "bitand", 255 "bitmap", 256 "bitmap_union", 257 "bitor", 258 "bitxor", 259 "blob", 260 "boolean", 261 "brief", 262 "broker", 263 "buckets", 264 "build", 265 "builtin", 266 "bulk", 267 "by", 268 "cached", 269 "call", 270 "cancel", 271 "case", 272 "cast", 273 "catalog", 274 "catalogs", 275 "chain", 276 "char", 277 "character", 278 "charset", 279 "check", 280 "clean", 281 "cluster", 282 "clusters", 283 "collate", 284 "collation", 285 "collect", 286 "column", 287 "columns", 288 "comment", 289 "commit", 290 "committed", 291 "compact", 292 "complete", 293 "config", 294 "connection", 295 "connection_id", 296 "consistent", 297 "constraint", 298 "constraints", 299 "convert", 300 "copy", 301 "count", 302 "create", 303 "creation", 304 "cron", 305 "cross", 306 "cube", 307 "current", 308 "current_catalog", 309 "current_date", 310 "current_time", 311 "current_timestamp", 312 "current_user", 313 "data", 314 "database", 315 "databases", 316 "date", 317 "date_add", 318 "date_ceil", 319 "date_diff", 320 "date_floor", 321 "date_sub", 322 "dateadd", 323 "datediff", 324 "datetime", 325 "datetimev2", 326 "datev2", 327 "datetimev1", 328 "datev1", 329 "day", 330 "days_add", 331 "days_sub", 332 "decimal", 333 "decimalv2", 334 "decimalv3", 335 "decommission", 336 "default", 337 "deferred", 338 "delete", 339 "demand", 340 "desc", 341 "describe", 342 "diagnose", 343 "disk", 344 "distinct", 345 "distinctpc", 346 "distinctpcsa", 347 "distributed", 348 "distribution", 349 "div", 350 "do", 351 "doris_internal_table_id", 352 "double", 353 "drop", 354 "dropp", 355 "dual", 356 "duplicate", 357 "dynamic", 358 "else", 359 "enable", 360 "encryptkey", 361 "encryptkeys", 362 "end", 363 "ends", 364 "engine", 365 "engines", 366 "enter", 367 "errors", 368 "events", 369 "every", 370 "except", 371 "exclude", 372 "execute", 373 "exists", 374 "expired", 375 "explain", 376 "export", 377 "extended", 378 "external", 379 "extract", 380 "failed_login_attempts", 381 "false", 382 "fast", 383 "feature", 384 "fields", 385 "file", 386 "filter", 387 "first", 388 "float", 389 "follower", 390 "following", 391 "for", 392 "foreign", 393 "force", 394 "format", 395 "free", 396 "from", 397 "frontend", 398 "frontends", 399 "full", 400 "function", 401 "functions", 402 "generic", 403 "global", 404 "grant", 405 "grants", 406 "graph", 407 "group", 408 "grouping", 409 "groups", 410 "hash", 411 "having", 412 "hdfs", 413 "help", 414 "histogram", 415 "hll", 416 "hll_union", 417 "hostname", 418 "hour", 419 "hub", 420 "identified", 421 "if", 422 "ignore", 423 "immediate", 424 "in", 425 "incremental", 426 "index", 427 "indexes", 428 "infile", 429 "inner", 430 "insert", 431 "install", 432 "int", 433 "integer", 434 "intermediate", 435 "intersect", 436 "interval", 437 "into", 438 "inverted", 439 "ipv4", 440 "ipv6", 441 "is", 442 "is_not_null_pred", 443 "is_null_pred", 444 "isnull", 445 "isolation", 446 "job", 447 "jobs", 448 "join", 449 "json", 450 "jsonb", 451 "key", 452 "keys", 453 "kill", 454 "label", 455 "largeint", 456 "last", 457 "lateral", 458 "ldap", 459 "ldap_admin_password", 460 "left", 461 "less", 462 "level", 463 "like", 464 "limit", 465 "lines", 466 "link", 467 "list", 468 "load", 469 "local", 470 "localtime", 471 "localtimestamp", 472 "location", 473 "lock", 474 "logical", 475 "low_priority", 476 "manual", 477 "map", 478 "match", 479 "match_all", 480 "match_any", 481 "match_phrase", 482 "match_phrase_edge", 483 "match_phrase_prefix", 484 "match_regexp", 485 "materialized", 486 "max", 487 "maxvalue", 488 "memo", 489 "merge", 490 "migrate", 491 "migrations", 492 "min", 493 "minus", 494 "minute", 495 "modify", 496 "month", 497 "mtmv", 498 "name", 499 "names", 500 "natural", 501 "negative", 502 "never", 503 "next", 504 "ngram_bf", 505 "no", 506 "non_nullable", 507 "not", 508 "null", 509 "nulls", 510 "observer", 511 "of", 512 "offset", 513 "on", 514 "only", 515 "open", 516 "optimized", 517 "or", 518 "order", 519 "outer", 520 "outfile", 521 "over", 522 "overwrite", 523 "parameter", 524 "parsed", 525 "partition", 526 "partitions", 527 "password", 528 "password_expire", 529 "password_history", 530 "password_lock_time", 531 "password_reuse", 532 "path", 533 "pause", 534 "percent", 535 "period", 536 "permissive", 537 "physical", 538 "plan", 539 "process", 540 "plugin", 541 "plugins", 542 "policy", 543 "preceding", 544 "prepare", 545 "primary", 546 "proc", 547 "procedure", 548 "processlist", 549 "profile", 550 "properties", 551 "property", 552 "quantile_state", 553 "quantile_union", 554 "query", 555 "quota", 556 "random", 557 "range", 558 "read", 559 "real", 560 "rebalance", 561 "recover", 562 "recycle", 563 "refresh", 564 "references", 565 "regexp", 566 "release", 567 "rename", 568 "repair", 569 "repeatable", 570 "replace", 571 "replace_if_not_null", 572 "replica", 573 "repositories", 574 "repository", 575 "resource", 576 "resources", 577 "restore", 578 "restrictive", 579 "resume", 580 "returns", 581 "revoke", 582 "rewritten", 583 "right", 584 "rlike", 585 "role", 586 "roles", 587 "rollback", 588 "rollup", 589 "routine", 590 "row", 591 "rows", 592 "s3", 593 "sample", 594 "schedule", 595 "scheduler", 596 "schema", 597 "schemas", 598 "second", 599 "select", 600 "semi", 601 "sequence", 602 "serializable", 603 "session", 604 "set", 605 "sets", 606 "shape", 607 "show", 608 "signed", 609 "skew", 610 "smallint", 611 "snapshot", 612 "soname", 613 "split", 614 "sql_block_rule", 615 "start", 616 "starts", 617 "stats", 618 "status", 619 "stop", 620 "storage", 621 "stream", 622 "streaming", 623 "string", 624 "struct", 625 "subdate", 626 "sum", 627 "superuser", 628 "switch", 629 "sync", 630 "system", 631 "table", 632 "tables", 633 "tablesample", 634 "tablet", 635 "tablets", 636 "task", 637 "tasks", 638 "temporary", 639 "terminated", 640 "text", 641 "than", 642 "then", 643 "time", 644 "timestamp", 645 "timestampadd", 646 "timestampdiff", 647 "tinyint", 648 "to", 649 "transaction", 650 "trash", 651 "tree", 652 "triggers", 653 "trim", 654 "true", 655 "truncate", 656 "type", 657 "type_cast", 658 "types", 659 "unbounded", 660 "uncommitted", 661 "uninstall", 662 "union", 663 "unique", 664 "unlock", 665 "unsigned", 666 "update", 667 "use", 668 "user", 669 "using", 670 "value", 671 "values", 672 "varchar", 673 "variables", 674 "variant", 675 "vault", 676 "verbose", 677 "version", 678 "view", 679 "warnings", 680 "week", 681 "when", 682 "where", 683 "whitelist", 684 "with", 685 "work", 686 "workload", 687 "write", 688 "xor", 689 "year", 690 } 691 692 def uniquekeyproperty_sql( 693 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 694 ) -> str: 695 create_stmt = expression.find_ancestor(exp.Create) 696 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 697 return super().uniquekeyproperty_sql(expression, prefix="KEY") 698 699 return super().uniquekeyproperty_sql(expression) 700 701 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 702 name = self.sql(expression, "this") 703 values = expression.expressions 704 705 if len(values) != 1: 706 # Multiple values: use VALUES [ ... ) 707 if values and isinstance(values[0], list): 708 values_sql = ", ".join( 709 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 710 ) 711 else: 712 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 713 714 return f"PARTITION {name} VALUES [{values_sql})" 715 716 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})" 717 718 def partitionbyrangepropertydynamic_sql( 719 self, expression: exp.PartitionByRangePropertyDynamic 720 ) -> str: 721 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 722 start = self.sql(expression, "start") 723 end = self.sql(expression, "end") 724 every = expression.args.get("every") 725 726 if every: 727 number = self.sql(every, "this") 728 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 729 else: 730 interval = "" 731 732 return f"FROM ({start}) TO ({end}) {interval}" 733 734 def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str: 735 this = expression.this 736 if isinstance(this, exp.Schema): 737 return f"PARTITION BY ({self.expressions(this, flat=True)})" 738 return f"PARTITION BY ({self.sql(this)})" 739 740 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 741 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 742 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 743 if not isinstance(ancestor, exp.Select): 744 sep = " " 745 return super().table_sql(expression, sep=sep)
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: Always quote except for specials cases. '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
WHEREclause. 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.RefreshTriggerProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.ReturnsProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.RollupProperty'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <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.PartitionByRangeProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.PartitionByListProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.UniqueKeyProperty'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class 'sqlglot.expressions.BuildProperty'>: <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.Adjacent'>: <function Generator.<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.CurrentCatalog'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SessionUser'>: <function MySQL.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.NetFunc'>: <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.ExtendsLeft'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExtendsRight'>: <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.ZeroFillColumnConstraint'>: <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.SafeFunc'>: <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.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.Variadic'>: <function Generator.<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.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.BitwiseCount'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Chr'>: <function MySQL.Generator.<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 =
{'double', 'group', 'schemas', 'localtime', 'sync', 'tablets', 'xor', 'repair', 'char', 'ldap_admin_password', 'tables', 'function', 'external', 'stats', 'plugin', 'load', 'last', 'rollup', 'permissive', 'variant', 'cube', 'database', 'procedure', 'local', 'workload', 'backends', 'replica', 'auto', 'temporary', 'grouping', 'false', 'boolean', 'inner', 'keys', 'regexp', 'quota', 'file', 'current_time', 'isolation', 'having', 'complete', 'roles', 'split', 'encryptkeys', 'force', 'isnull', 'max', 'in', 'at', 'analyze', 'trash', 'current', 'tree', 'global', 'rename', 'collation', 'help', 'as', 'match_phrase_edge', 'skew', 'belong', 'incremental', 'truncate', 'next', 'case', 'buckets', 'except', 'select', 'clusters', 'values', 'grant', 'update', 'backend', 'builtin', 'hll_union', 'float', 'of', 'frontends', 'distinct', 'type_cast', 'uncommitted', 'varchar', 'physical', 'to', 'negative', 'bitor', 'broker', 'bin', 'authors', 'manual', 'soname', 'open', 'starts', 'triggers', 'user', 'current_date', 'sample', 'read', 'expired', 'hub', 'account_unlock', 'charset', 'semi', 'than', 'copy', 'location', 'disk', 'column', 'free', 'partitions', 'binlog', 'alias', 'cross', 'week', 'binary', 'resource', 'committed', 'array_range', 'match', 'storage', 'overwrite', 'filter', 'intermediate', 'match_regexp', 'range', 'days_sub', 'logical', 'count', 'start', 'quantile_union', 'policy', 'catalogs', 'snapshot', 'modify', 'sum', 'distinctpcsa', 'failed_login_attempts', 'outer', 'consistent', 'hll', 'minute', 'non_nullable', 'frontend', 'if', 'dynamic', 'blob', 'join', 'date_add', 'groups', 'else', 'hash', 'schema', 'localtimestamp', 'graph', 'distribution', 'creation', 'create', 'compact', 'analyzed', 'observer', 'less', 'migrate', 'profile', 'key', 'resume', 'when', 'foreign', 'low_priority', 'uninstall', 'memo', 'rlike', 'plan', 'rewritten', 'replace_if_not_null', 'sets', 'every', 'ngram_bf', 'call', 'names', 'release', 'rollback', 'insert', 'append', 'time', 'percent', 'comment', 'engines', 'restore', 'primary', 'tablesample', 'cluster', 'drop', 'days_add', 'demand', 'engine', 'format', 'unique', 'after', 'datev1', 'job', 'refresh', 'cast', 'password_lock_time', 'kill', 'sequence', 'status', 'adddate', 'shape', 'columns', 'restrictive', 'collate', 'or', 'process', 'bitmap', 'vault', 'describe', 'decimal', 'distinctpc', 'decimalv3', 'text', 'repositories', 'between', 'decimalv2', 'cron', 'row', 'revoke', 'fast', 'unlock', 'stop', 'commit', 'with', 'system', 'indexes', 'subdate', 'stream', 'enable', 'like', 'unbounded', 'maxvalue', 'functions', 'write', 'month', 'then', 'query', 'transaction', 'first', 'merge', 'resources', 'minus', 'repository', 'asc', 'plugins', 'nulls', 'property', 'generic', 'superuser', 'second', 'int', 'follower', 'json', 'quantile_state', 'no', 'chain', 'timestamp', 'databases', 'character', 'dropp', 'list', 'over', 'table', 'warnings', 'repeatable', 'min', 'by', 'whitelist', 'mtmv', 'exists', 'begin', 'level', 'right', 'anti', 'ipv6', 'role', 'label', 'backup', 'date_floor', 'datetime', 'current_timestamp', 'map', 'collect', 'work', 'natural', 'references', 'signed', 'agg_state', 'install', 'rows', 'export', 'end', 'name', 'replace', 'version', 'limit', 'unsigned', 'doris_internal_table_id', 'use', 'streaming', 'serializable', 'schedule', 'show', 'div', 'cancel', 'exclude', 'connection_id', 'sql_block_rule', 'tinyint', 'date', 'order', 'true', 'password_reuse', 'clean', 'date_sub', 'execute', 'current_user', 'datetimev1', 'type', 'variables', 'jsonb', 'path', 'never', 'catalog', 'constraints', 'types', 'parameter', 'struct', 'day', 'verbose', 'bulk', 'dual', 'from', 'only', 'timestampdiff', 'datev2', 'is', 'proc', 'account_lock', 'is_null_pred', 'processlist', 'interval', 'constraint', 'hour', 'ends', 'bigint', 'optimized', 'connection', 'ipv4', 'session', 'prepare', 'task', 'password_expire', 'lateral', 'hostname', 'value', 'smallint', 'outfile', 'auto_increment', 'terminated', 'timestampadd', 'largeint', 'not', 'admin', 'enter', 'tablet', 'is_not_null_pred', 'match_phrase_prefix', 'jobs', 'identified', 'rebalance', 'alter', 'events', 'offset', 'duplicate', 'immediate', 'array', 'bitmap_union', 'aggregate', 'histogram', 'match_all', 'infile', 'datetimev2', 'match_phrase', 'period', 'add', 'string', 'password_history', 'inverted', 'check', 'returns', 'using', 'tasks', 'set', 'datediff', 'view', 'scheduler', 'encryptkey', 'parsed', 'where', 'grants', 'build', 'null', 'ignore', 'distributed', 'materialized', 'index', 'partition', 'lock', 'into', 'left', 'year', 'pause', 'recycle', 'hdfs', 'link', 'extended', 'bitxor', 'convert', 'extract', 'fields', 'following', 'routine', 'password', 'explain', 'date_ceil', 'dateadd', 'current_catalog', 'decommission', 'default', 'and', 'real', 'brief', 'delete', 'intersect', 'random', 'errors', 'feature', 'trim', 'date_diff', 'lines', 'integer', 'switch', 'all', 'for', 'match_any', 'config', 'recover', 'do', 'data', 'bitand', 'migrations', 'full', 'desc', 's3', 'properties', 'diagnose', 'ldap', 'deferred', 'union', 'preceding', 'cached', 'on'}
def
uniquekeyproperty_sql( self, expression: sqlglot.expressions.UniqueKeyProperty, prefix: str = 'UNIQUE KEY') -> str:
692 def uniquekeyproperty_sql( 693 self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY" 694 ) -> str: 695 create_stmt = expression.find_ancestor(exp.Create) 696 if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty): 697 return super().uniquekeyproperty_sql(expression, prefix="KEY") 698 699 return super().uniquekeyproperty_sql(expression)
701 def partitionrange_sql(self, expression: exp.PartitionRange) -> str: 702 name = self.sql(expression, "this") 703 values = expression.expressions 704 705 if len(values) != 1: 706 # Multiple values: use VALUES [ ... ) 707 if values and isinstance(values[0], list): 708 values_sql = ", ".join( 709 f"({', '.join(self.sql(v) for v in inner)})" for inner in values 710 ) 711 else: 712 values_sql = ", ".join(f"({self.sql(v)})" for v in values) 713 714 return f"PARTITION {name} VALUES [{values_sql})" 715 716 return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})"
def
partitionbyrangepropertydynamic_sql( self, expression: sqlglot.expressions.PartitionByRangePropertyDynamic) -> str:
718 def partitionbyrangepropertydynamic_sql( 719 self, expression: exp.PartitionByRangePropertyDynamic 720 ) -> str: 721 # Generates: FROM ("start") TO ("end") INTERVAL N UNIT 722 start = self.sql(expression, "start") 723 end = self.sql(expression, "end") 724 every = expression.args.get("every") 725 726 if every: 727 number = self.sql(every, "this") 728 interval = f"INTERVAL {number} {self.sql(every, 'unit')}" 729 else: 730 interval = "" 731 732 return f"FROM ({start}) TO ({end}) {interval}"
740 def table_sql(self, expression: exp.Table, sep: str = " AS ") -> str: 741 """Override table_sql to avoid AS keyword in UPDATE and DELETE statements.""" 742 ancestor = expression.find_ancestor(exp.Update, exp.Delete, exp.Select) 743 if not isinstance(ancestor, exp.Select): 744 sep = " " 745 return super().table_sql(expression, sep=sep)
Override table_sql to avoid AS keyword in UPDATE and DELETE statements.
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
- INOUT_SEPARATOR
- DIRECTED_JOINS
- 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
- SET_ASSIGNMENT_REQUIRES_VARIABLE_KEYWORD
- 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
- pseudocolumn_sql
- columnposition_sql
- columndef_sql
- columnconstraint_sql
- autoincrementcolumnconstraint_sql
- compresscolumnconstraint_sql
- generatedasidentitycolumnconstraint_sql
- generatedasrowcolumnconstraint_sql
- periodforsystemtimeconstraint_sql
- notnullcolumnconstraint_sql
- primarykeycolumnconstraint_sql
- uniquecolumnconstraint_sql
- inoutcolumnconstraint_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
- rollupindex_sql
- rollupproperty_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
- booland_sql
- boolor_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
- strtotime_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
- 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
- match_sql
- similarto_sql
- lt_sql
- lte_sql
- mod_sql
- mul_sql
- neq_sql
- nullsafeeq_sql
- nullsafeneq_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
- json_sql
- jsonvalue_sql
- conditionalinsert_sql
- multitableinserts_sql
- oncondition_sql
- jsonextractquote_sql
- jsonexists_sql
- arrayagg_sql
- slice_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
- directorystage_sql
- uuid_sql
- initcap_sql
- localtime_sql
- localtimestamp_sql
- weekstart_sql
- chr_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
- alterrename_sql
- altercolumn_sql
- timestamptrunc_sql
- converttimezone_sql
- attimezone_sql
- isascii_sql
- ignorenulls_sql
- currentschema_sql
- partition_sql
- partitionbyrangeproperty_sql
- partitionbylistproperty_sql
- partitionlist_sql