sqlglot.dialects.singlestore
1from sqlglot import TokenType 2import typing as t 3 4from sqlglot import exp 5from sqlglot.dialects.dialect import ( 6 build_formatted_time, 7 build_json_extract_path, 8 json_extract_segments, 9 json_path_key_only_name, 10 rename_func, 11) 12from sqlglot.dialects.mysql import MySQL 13from sqlglot.generator import unsupported_args 14from sqlglot.helper import seq_get 15 16 17class SingleStore(MySQL): 18 SUPPORTS_ORDER_BY_ALL = True 19 20 TIME_MAPPING: t.Dict[str, str] = { 21 "D": "%u", # Day of week (1-7) 22 "DD": "%d", # day of month (01-31) 23 "DY": "%a", # abbreviated name of day 24 "HH": "%I", # Hour of day (01-12) 25 "HH12": "%I", # alias for HH 26 "HH24": "%H", # Hour of day (00-23) 27 "MI": "%M", # Minute (00-59) 28 "MM": "%m", # Month (01-12; January = 01) 29 "MON": "%b", # Abbreviated name of month 30 "MONTH": "%B", # Name of month 31 "SS": "%S", # Second (00-59) 32 "RR": "%y", # 15 33 "YY": "%y", # 15 34 "YYYY": "%Y", # 2015 35 "FF6": "%f", # only 6 digits are supported in python formats 36 } 37 38 class Tokenizer(MySQL.Tokenizer): 39 BYTE_STRINGS = [("e'", "'"), ("E'", "'")] 40 41 KEYWORDS = { 42 **MySQL.Tokenizer.KEYWORDS, 43 "BSON": TokenType.JSONB, 44 "GEOGRAPHYPOINT": TokenType.GEOGRAPHYPOINT, 45 ":>": TokenType.COLON_GT, 46 "!:>": TokenType.NCOLON_GT, 47 "::$": TokenType.DCOLONDOLLAR, 48 "::%": TokenType.DCOLONPERCENT, 49 } 50 51 class Parser(MySQL.Parser): 52 FUNCTIONS = { 53 **MySQL.Parser.FUNCTIONS, 54 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "singlestore"), 55 "TO_TIMESTAMP": build_formatted_time(exp.StrToTime, "singlestore"), 56 "TO_CHAR": build_formatted_time(exp.ToChar, "singlestore"), 57 "STR_TO_DATE": build_formatted_time(exp.StrToDate, "mysql"), 58 "DATE_FORMAT": build_formatted_time(exp.TimeToStr, "mysql"), 59 "TIME_FORMAT": lambda args: exp.TimeToStr( 60 # The first argument is converted to TIME(6) 61 # This is needed because exp.TimeToStr is converted to DATE_FORMAT 62 # which interprets the first argument as DATETIME and fails to parse 63 # string literals like '12:05:47' without a date part. 64 this=exp.Cast( 65 this=seq_get(args, 0), 66 to=exp.DataType.build( 67 exp.DataType.Type.TIME, 68 expressions=[exp.DataTypeParam(this=exp.Literal.number(6))], 69 ), 70 ), 71 format=MySQL.format_time(seq_get(args, 1)), 72 ), 73 "UNIX_TIMESTAMP": exp.StrToUnix.from_arg_list, 74 "FROM_UNIXTIME": build_formatted_time(exp.UnixToTime, "mysql"), 75 "BSON_EXTRACT_BSON": build_json_extract_path(exp.JSONBExtract), 76 "BSON_EXTRACT_STRING": build_json_extract_path( 77 exp.JSONBExtractScalar, json_type="STRING" 78 ), 79 "BSON_EXTRACT_DOUBLE": build_json_extract_path( 80 exp.JSONBExtractScalar, json_type="DOUBLE" 81 ), 82 "BSON_EXTRACT_BIGINT": build_json_extract_path( 83 exp.JSONBExtractScalar, json_type="BIGINT" 84 ), 85 "JSON_EXTRACT_JSON": build_json_extract_path(exp.JSONExtract), 86 "JSON_EXTRACT_STRING": build_json_extract_path( 87 exp.JSONExtractScalar, json_type="STRING" 88 ), 89 "JSON_EXTRACT_DOUBLE": build_json_extract_path( 90 exp.JSONExtractScalar, json_type="DOUBLE" 91 ), 92 "JSON_EXTRACT_BIGINT": build_json_extract_path( 93 exp.JSONExtractScalar, json_type="BIGINT" 94 ), 95 "DATE": exp.Date.from_arg_list, 96 } 97 98 CAST_COLUMN_OPERATORS = {TokenType.COLON_GT, TokenType.NCOLON_GT} 99 100 COLUMN_OPERATORS = { 101 TokenType.COLON_GT: lambda self, this, to: self.expression( 102 exp.Cast, 103 this=this, 104 to=to, 105 ), 106 TokenType.NCOLON_GT: lambda self, this, to: self.expression( 107 exp.TryCast, 108 this=this, 109 to=to, 110 ), 111 TokenType.DCOLON: lambda self, this, path: build_json_extract_path(exp.JSONExtract)( 112 [this, exp.Literal.string(path.name)] 113 ), 114 TokenType.DCOLONDOLLAR: lambda self, this, path: build_json_extract_path( 115 exp.JSONExtractScalar, json_type="STRING" 116 )([this, exp.Literal.string(path.name)]), 117 TokenType.DCOLONPERCENT: lambda self, this, path: build_json_extract_path( 118 exp.JSONExtractScalar, json_type="DOUBLE" 119 )([this, exp.Literal.string(path.name)]), 120 } 121 122 class Generator(MySQL.Generator): 123 SUPPORTED_JSON_PATH_PARTS = { 124 exp.JSONPathKey, 125 exp.JSONPathRoot, 126 exp.JSONPathSubscript, 127 } 128 129 TRANSFORMS = { 130 **MySQL.Generator.TRANSFORMS, 131 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 132 exp.StrToTime: lambda self, e: self.func("TO_TIMESTAMP", e.this, self.format_time(e)), 133 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 134 exp.StrToDate: lambda self, e: self.func( 135 "STR_TO_DATE", 136 e.this, 137 self.format_time( 138 e, 139 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 140 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 141 ), 142 ), 143 exp.TimeToStr: lambda self, e: self.func( 144 "DATE_FORMAT", 145 e.this, 146 self.format_time( 147 e, 148 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 149 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 150 ), 151 ), 152 exp.Date: unsupported_args("zone", "expressions")(rename_func("DATE")), 153 exp.Cast: unsupported_args("format", "action", "default")( 154 lambda self, e: f"{self.sql(e, 'this')} :> {self.sql(e, 'to')}" 155 ), 156 exp.TryCast: unsupported_args("format", "action", "default")( 157 lambda self, e: f"{self.sql(e, 'this')} !:> {self.sql(e, 'to')}" 158 ), 159 exp.StrToUnix: unsupported_args("format")(rename_func("UNIX_TIMESTAMP")), 160 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 161 exp.TimeStrToUnix: rename_func("UNIX_TIMESTAMP"), 162 exp.UnixSeconds: rename_func("UNIX_TIMESTAMP"), 163 exp.UnixToStr: lambda self, e: self.func( 164 "FROM_UNIXTIME", 165 e.this, 166 self.format_time( 167 e, 168 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 169 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 170 ), 171 ), 172 exp.UnixToTime: unsupported_args("scale", "zone", "hours", "minutes")( 173 lambda self, e: self.func( 174 "FROM_UNIXTIME", 175 e.this, 176 self.format_time( 177 e, 178 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 179 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 180 ), 181 ), 182 ), 183 exp.UnixToTimeStr: lambda self, e: f"FROM_UNIXTIME({self.sql(e, 'this')}) :> TEXT", 184 exp.JSONExtract: unsupported_args( 185 "only_json_types", 186 "expressions", 187 "variant_extract", 188 "json_query", 189 "option", 190 "quote", 191 "on_condition", 192 "requires_json", 193 )(json_extract_segments("JSON_EXTRACT_JSON")), 194 exp.JSONBExtract: json_extract_segments("BSON_EXTRACT_BSON"), 195 exp.JSONPathKey: json_path_key_only_name, 196 exp.JSONPathSubscript: lambda self, e: self.json_path_part(e.this), 197 exp.JSONPathRoot: lambda *_: "", 198 } 199 TRANSFORMS.pop(exp.JSONExtractScalar) 200 TRANSFORMS.pop(exp.JSONPathFilter) 201 TRANSFORMS.pop(exp.JSONPathRecursive) 202 TRANSFORMS.pop(exp.JSONPathScript) 203 TRANSFORMS.pop(exp.JSONPathSelector) 204 TRANSFORMS.pop(exp.JSONPathSlice) 205 TRANSFORMS.pop(exp.JSONPathUnion) 206 TRANSFORMS.pop(exp.JSONPathWildcard) 207 208 # https://docs.singlestore.com/cloud/reference/sql-reference/restricted-keywords/list-of-restricted-keywords/ 209 RESERVED_KEYWORDS = { 210 "abs", 211 "absolute", 212 "access", 213 "account", 214 "acos", 215 "action", 216 "add", 217 "adddate", 218 "addtime", 219 "admin", 220 "aes_decrypt", 221 "aes_encrypt", 222 "after", 223 "against", 224 "aggregate", 225 "aggregates", 226 "aggregator", 227 "aggregator_id", 228 "aggregator_plan_hash", 229 "aggregators", 230 "algorithm", 231 "all", 232 "also", 233 "alter", 234 "always", 235 "analyse", 236 "analyze", 237 "and", 238 "anti_join", 239 "any", 240 "any_value", 241 "approx_count_distinct", 242 "approx_count_distinct_accumulate", 243 "approx_count_distinct_combine", 244 "approx_count_distinct_estimate", 245 "approx_geography_intersects", 246 "approx_percentile", 247 "arghistory", 248 "arrange", 249 "arrangement", 250 "array", 251 "as", 252 "asc", 253 "ascii", 254 "asensitive", 255 "asin", 256 "asm", 257 "assertion", 258 "assignment", 259 "ast", 260 "asymmetric", 261 "async", 262 "at", 263 "atan", 264 "atan2", 265 "attach", 266 "attribute", 267 "authorization", 268 "auto", 269 "auto_increment", 270 "auto_reprovision", 271 "autostats", 272 "autostats_cardinality_mode", 273 "autostats_enabled", 274 "autostats_histogram_mode", 275 "autostats_sampling", 276 "availability", 277 "avg", 278 "avg_row_length", 279 "avro", 280 "azure", 281 "background", 282 "_background_threads_for_cleanup", 283 "backup", 284 "backup_history", 285 "backup_id", 286 "backward", 287 "batch", 288 "batches", 289 "batch_interval", 290 "_batch_size_limit", 291 "before", 292 "begin", 293 "between", 294 "bigint", 295 "bin", 296 "binary", 297 "_binary", 298 "bit", 299 "bit_and", 300 "bit_count", 301 "bit_or", 302 "bit_xor", 303 "blob", 304 "bool", 305 "boolean", 306 "bootstrap", 307 "both", 308 "_bt", 309 "btree", 310 "bucket_count", 311 "by", 312 "byte", 313 "byte_length", 314 "cache", 315 "call", 316 "call_for_pipeline", 317 "called", 318 "capture", 319 "cascade", 320 "cascaded", 321 "case", 322 "cast", 323 "catalog", 324 "ceil", 325 "ceiling", 326 "chain", 327 "change", 328 "char", 329 "character", 330 "characteristics", 331 "character_length", 332 "char_length", 333 "charset", 334 "check", 335 "checkpoint", 336 "_check_can_connect", 337 "_check_consistency", 338 "checksum", 339 "_checksum", 340 "class", 341 "clear", 342 "client", 343 "client_found_rows", 344 "close", 345 "cluster", 346 "clustered", 347 "cnf", 348 "coalesce", 349 "coercibility", 350 "collate", 351 "collation", 352 "collect", 353 "column", 354 "columnar", 355 "columns", 356 "columnstore", 357 "columnstore_segment_rows", 358 "comment", 359 "comments", 360 "commit", 361 "committed", 362 "_commit_log_tail", 363 "committed", 364 "compact", 365 "compile", 366 "compressed", 367 "compression", 368 "concat", 369 "concat_ws", 370 "concurrent", 371 "concurrently", 372 "condition", 373 "configuration", 374 "connection", 375 "connection_id", 376 "connections", 377 "config", 378 "constraint", 379 "constraints", 380 "content", 381 "continue", 382 "_continue_replay", 383 "conv", 384 "conversion", 385 "convert", 386 "convert_tz", 387 "copy", 388 "_core", 389 "cos", 390 "cost", 391 "cot", 392 "count", 393 "create", 394 "credentials", 395 "cross", 396 "cube", 397 "csv", 398 "cume_dist", 399 "curdate", 400 "current", 401 "current_catalog", 402 "current_date", 403 "current_role", 404 "current_schema", 405 "current_security_groups", 406 "current_security_roles", 407 "current_time", 408 "current_timestamp", 409 "current_user", 410 "cursor", 411 "curtime", 412 "cycle", 413 "data", 414 "database", 415 "databases", 416 "date", 417 "date_add", 418 "datediff", 419 "date_format", 420 "date_sub", 421 "date_trunc", 422 "datetime", 423 "day", 424 "day_hour", 425 "day_microsecond", 426 "day_minute", 427 "dayname", 428 "dayofmonth", 429 "dayofweek", 430 "dayofyear", 431 "day_second", 432 "deallocate", 433 "dec", 434 "decimal", 435 "declare", 436 "decode", 437 "default", 438 "defaults", 439 "deferrable", 440 "deferred", 441 "defined", 442 "definer", 443 "degrees", 444 "delayed", 445 "delay_key_write", 446 "delete", 447 "delimiter", 448 "delimiters", 449 "dense_rank", 450 "desc", 451 "describe", 452 "detach", 453 "deterministic", 454 "dictionary", 455 "differential", 456 "directory", 457 "disable", 458 "discard", 459 "_disconnect", 460 "disk", 461 "distinct", 462 "distinctrow", 463 "distributed_joins", 464 "div", 465 "do", 466 "document", 467 "domain", 468 "dot_product", 469 "double", 470 "drop", 471 "_drop_profile", 472 "dual", 473 "dump", 474 "duplicate", 475 "dynamic", 476 "earliest", 477 "each", 478 "echo", 479 "election", 480 "else", 481 "elseif", 482 "elt", 483 "enable", 484 "enclosed", 485 "encoding", 486 "encrypted", 487 "end", 488 "engine", 489 "engines", 490 "enum", 491 "errors", 492 "escape", 493 "escaped", 494 "estimate", 495 "euclidean_distance", 496 "event", 497 "events", 498 "except", 499 "exclude", 500 "excluding", 501 "exclusive", 502 "execute", 503 "exists", 504 "exit", 505 "exp", 506 "explain", 507 "extended", 508 "extension", 509 "external", 510 "external_host", 511 "external_port", 512 "extract", 513 "extractor", 514 "extractors", 515 "extra_join", 516 "_failover", 517 "failed_login_attempts", 518 "failure", 519 "false", 520 "family", 521 "fault", 522 "fetch", 523 "field", 524 "fields", 525 "file", 526 "files", 527 "fill", 528 "first", 529 "first_value", 530 "fix_alter", 531 "fixed", 532 "float", 533 "float4", 534 "float8", 535 "floor", 536 "flush", 537 "following", 538 "for", 539 "force", 540 "force_compiled_mode", 541 "force_interpreter_mode", 542 "foreground", 543 "foreign", 544 "format", 545 "forward", 546 "found_rows", 547 "freeze", 548 "from", 549 "from_base64", 550 "from_days", 551 "from_unixtime", 552 "fs", 553 "_fsync", 554 "full", 555 "fulltext", 556 "function", 557 "functions", 558 "gc", 559 "gcs", 560 "get_format", 561 "_gc", 562 "_gcx", 563 "generate", 564 "geography", 565 "geography_area", 566 "geography_contains", 567 "geography_distance", 568 "geography_intersects", 569 "geography_latitude", 570 "geography_length", 571 "geography_longitude", 572 "geographypoint", 573 "geography_point", 574 "geography_within_distance", 575 "geometry", 576 "geometry_area", 577 "geometry_contains", 578 "geometry_distance", 579 "geometry_filter", 580 "geometry_intersects", 581 "geometry_length", 582 "geometrypoint", 583 "geometry_point", 584 "geometry_within_distance", 585 "geometry_x", 586 "geometry_y", 587 "global", 588 "_global_version_timestamp", 589 "grant", 590 "granted", 591 "grants", 592 "greatest", 593 "group", 594 "grouping", 595 "groups", 596 "group_concat", 597 "gzip", 598 "handle", 599 "handler", 600 "hard_cpu_limit_percentage", 601 "hash", 602 "has_temp_tables", 603 "having", 604 "hdfs", 605 "header", 606 "heartbeat_no_logging", 607 "hex", 608 "highlight", 609 "high_priority", 610 "hold", 611 "holding", 612 "host", 613 "hosts", 614 "hour", 615 "hour_microsecond", 616 "hour_minute", 617 "hour_second", 618 "identified", 619 "identity", 620 "if", 621 "ifnull", 622 "ignore", 623 "ilike", 624 "immediate", 625 "immutable", 626 "implicit", 627 "import", 628 "in", 629 "including", 630 "increment", 631 "incremental", 632 "index", 633 "indexes", 634 "inet_aton", 635 "inet_ntoa", 636 "inet6_aton", 637 "inet6_ntoa", 638 "infile", 639 "inherit", 640 "inherits", 641 "_init_profile", 642 "init", 643 "initcap", 644 "initialize", 645 "initially", 646 "inject", 647 "inline", 648 "inner", 649 "inout", 650 "input", 651 "insensitive", 652 "insert", 653 "insert_method", 654 "instance", 655 "instead", 656 "instr", 657 "int", 658 "int1", 659 "int2", 660 "int3", 661 "int4", 662 "int8", 663 "integer", 664 "_internal_dynamic_typecast", 665 "interpreter_mode", 666 "intersect", 667 "interval", 668 "into", 669 "invoker", 670 "is", 671 "isnull", 672 "isolation", 673 "iterate", 674 "join", 675 "json", 676 "json_agg", 677 "json_array_contains_double", 678 "json_array_contains_json", 679 "json_array_contains_string", 680 "json_array_push_double", 681 "json_array_push_json", 682 "json_array_push_string", 683 "json_delete_key", 684 "json_extract_double", 685 "json_extract_json", 686 "json_extract_string", 687 "json_extract_bigint", 688 "json_get_type", 689 "json_length", 690 "json_set_double", 691 "json_set_json", 692 "json_set_string", 693 "json_splice_double", 694 "json_splice_json", 695 "json_splice_string", 696 "kafka", 697 "key", 698 "key_block_size", 699 "keys", 700 "kill", 701 "killall", 702 "label", 703 "lag", 704 "language", 705 "large", 706 "last", 707 "last_day", 708 "last_insert_id", 709 "last_value", 710 "lateral", 711 "latest", 712 "lc_collate", 713 "lc_ctype", 714 "lcase", 715 "lead", 716 "leading", 717 "leaf", 718 "leakproof", 719 "least", 720 "leave", 721 "leaves", 722 "left", 723 "length", 724 "level", 725 "license", 726 "like", 727 "limit", 728 "lines", 729 "listen", 730 "llvm", 731 "ln", 732 "load", 733 "loaddata_where", 734 "_load", 735 "local", 736 "localtime", 737 "localtimestamp", 738 "locate", 739 "location", 740 "lock", 741 "log", 742 "log10", 743 "log2", 744 "long", 745 "longblob", 746 "longtext", 747 "loop", 748 "lower", 749 "low_priority", 750 "lpad", 751 "_ls", 752 "ltrim", 753 "lz4", 754 "management", 755 "_management_thread", 756 "mapping", 757 "master", 758 "match", 759 "materialized", 760 "max", 761 "maxvalue", 762 "max_concurrency", 763 "max_errors", 764 "max_partitions_per_batch", 765 "max_queue_depth", 766 "max_retries_per_batch_partition", 767 "max_rows", 768 "mbc", 769 "md5", 770 "mpl", 771 "median", 772 "mediumblob", 773 "mediumint", 774 "mediumtext", 775 "member", 776 "memory", 777 "memory_percentage", 778 "_memsql_table_id_lookup", 779 "memsql", 780 "memsql_deserialize", 781 "memsql_imitating_kafka", 782 "memsql_serialize", 783 "merge", 784 "metadata", 785 "microsecond", 786 "middleint", 787 "min", 788 "min_rows", 789 "minus", 790 "minute", 791 "minute_microsecond", 792 "minute_second", 793 "minvalue", 794 "mod", 795 "mode", 796 "model", 797 "modifies", 798 "modify", 799 "month", 800 "monthname", 801 "months_between", 802 "move", 803 "mpl", 804 "names", 805 "named", 806 "namespace", 807 "national", 808 "natural", 809 "nchar", 810 "next", 811 "no", 812 "node", 813 "none", 814 "no_query_rewrite", 815 "noparam", 816 "not", 817 "nothing", 818 "notify", 819 "now", 820 "nowait", 821 "no_write_to_binlog", 822 "no_query_rewrite", 823 "norely", 824 "nth_value", 825 "ntile", 826 "null", 827 "nullcols", 828 "nullif", 829 "nulls", 830 "numeric", 831 "nvarchar", 832 "object", 833 "octet_length", 834 "of", 835 "off", 836 "offline", 837 "offset", 838 "offsets", 839 "oids", 840 "on", 841 "online", 842 "only", 843 "open", 844 "operator", 845 "optimization", 846 "optimize", 847 "optimizer", 848 "optimizer_state", 849 "option", 850 "options", 851 "optionally", 852 "or", 853 "order", 854 "ordered_serialize", 855 "orphan", 856 "out", 857 "out_of_order", 858 "outer", 859 "outfile", 860 "over", 861 "overlaps", 862 "overlay", 863 "owned", 864 "owner", 865 "pack_keys", 866 "paired", 867 "parser", 868 "parquet", 869 "partial", 870 "partition", 871 "partition_id", 872 "partitioning", 873 "partitions", 874 "passing", 875 "password", 876 "password_lock_time", 877 "parser", 878 "pause", 879 "_pause_replay", 880 "percent_rank", 881 "percentile_cont", 882 "percentile_disc", 883 "periodic", 884 "persisted", 885 "pi", 886 "pipeline", 887 "pipelines", 888 "pivot", 889 "placing", 890 "plan", 891 "plans", 892 "plancache", 893 "plugins", 894 "pool", 895 "pools", 896 "port", 897 "position", 898 "pow", 899 "power", 900 "preceding", 901 "precision", 902 "prepare", 903 "prepared", 904 "preserve", 905 "primary", 906 "prior", 907 "privileges", 908 "procedural", 909 "procedure", 910 "procedures", 911 "process", 912 "processlist", 913 "profile", 914 "profiles", 915 "program", 916 "promote", 917 "proxy", 918 "purge", 919 "quarter", 920 "queries", 921 "query", 922 "query_timeout", 923 "queue", 924 "quote", 925 "radians", 926 "rand", 927 "range", 928 "rank", 929 "read", 930 "_read", 931 "reads", 932 "real", 933 "reassign", 934 "rebalance", 935 "recheck", 936 "record", 937 "recursive", 938 "redundancy", 939 "redundant", 940 "ref", 941 "reference", 942 "references", 943 "refresh", 944 "regexp", 945 "reindex", 946 "relative", 947 "release", 948 "reload", 949 "rely", 950 "remote", 951 "remove", 952 "rename", 953 "repair", 954 "_repair_table", 955 "repeat", 956 "repeatable", 957 "_repl", 958 "_reprovisioning", 959 "replace", 960 "replica", 961 "replicate", 962 "replicating", 963 "replication", 964 "durability", 965 "require", 966 "resource", 967 "resource_pool", 968 "reset", 969 "restart", 970 "restore", 971 "restrict", 972 "result", 973 "_resurrect", 974 "retry", 975 "return", 976 "returning", 977 "returns", 978 "reverse", 979 "revoke", 980 "rg_pool", 981 "right", 982 "right_anti_join", 983 "right_semi_join", 984 "right_straight_join", 985 "rlike", 986 "role", 987 "roles", 988 "rollback", 989 "rollup", 990 "round", 991 "routine", 992 "row", 993 "row_count", 994 "row_format", 995 "row_number", 996 "rows", 997 "rowstore", 998 "rule", 999 "rpad", 1000 "_rpc", 1001 "rtrim", 1002 "running", 1003 "s3", 1004 "safe", 1005 "save", 1006 "savepoint", 1007 "scalar", 1008 "schema", 1009 "schemas", 1010 "schema_binding", 1011 "scroll", 1012 "search", 1013 "second", 1014 "second_microsecond", 1015 "sec_to_time", 1016 "security", 1017 "select", 1018 "semi_join", 1019 "_send_threads", 1020 "sensitive", 1021 "separator", 1022 "sequence", 1023 "sequences", 1024 "serial", 1025 "serializable", 1026 "series", 1027 "service_user", 1028 "server", 1029 "session", 1030 "session_user", 1031 "set", 1032 "setof", 1033 "security_lists_intersect", 1034 "sha", 1035 "sha1", 1036 "sha2", 1037 "shard", 1038 "sharded", 1039 "sharded_id", 1040 "share", 1041 "show", 1042 "shutdown", 1043 "sigmoid", 1044 "sign", 1045 "signal", 1046 "similar", 1047 "simple", 1048 "site", 1049 "signed", 1050 "sin", 1051 "skip", 1052 "skipped_batches", 1053 "sleep", 1054 "_sleep", 1055 "smallint", 1056 "snapshot", 1057 "_snapshot", 1058 "_snapshots", 1059 "soft_cpu_limit_percentage", 1060 "some", 1061 "soname", 1062 "sparse", 1063 "spatial", 1064 "spatial_check_index", 1065 "specific", 1066 "split", 1067 "sql", 1068 "sql_big_result", 1069 "sql_buffer_result", 1070 "sql_cache", 1071 "sql_calc_found_rows", 1072 "sqlexception", 1073 "sql_mode", 1074 "sql_no_cache", 1075 "sql_no_logging", 1076 "sql_small_result", 1077 "sqlstate", 1078 "sqlwarning", 1079 "sqrt", 1080 "ssl", 1081 "stable", 1082 "standalone", 1083 "start", 1084 "starting", 1085 "state", 1086 "statement", 1087 "statistics", 1088 "stats", 1089 "status", 1090 "std", 1091 "stddev", 1092 "stddev_pop", 1093 "stddev_samp", 1094 "stdin", 1095 "stdout", 1096 "stop", 1097 "storage", 1098 "str_to_date", 1099 "straight_join", 1100 "strict", 1101 "string", 1102 "strip", 1103 "subdate", 1104 "substr", 1105 "substring", 1106 "substring_index", 1107 "success", 1108 "sum", 1109 "super", 1110 "symmetric", 1111 "sync_snapshot", 1112 "sync", 1113 "_sync", 1114 "_sync2", 1115 "_sync_partitions", 1116 "_sync_snapshot", 1117 "synchronize", 1118 "sysid", 1119 "system", 1120 "table", 1121 "table_checksum", 1122 "tables", 1123 "tablespace", 1124 "tags", 1125 "tan", 1126 "target_size", 1127 "task", 1128 "temp", 1129 "template", 1130 "temporary", 1131 "temptable", 1132 "_term_bump", 1133 "terminate", 1134 "terminated", 1135 "test", 1136 "text", 1137 "then", 1138 "time", 1139 "timediff", 1140 "time_bucket", 1141 "time_format", 1142 "timeout", 1143 "timestamp", 1144 "timestampadd", 1145 "timestampdiff", 1146 "timezone", 1147 "time_to_sec", 1148 "tinyblob", 1149 "tinyint", 1150 "tinytext", 1151 "to", 1152 "to_base64", 1153 "to_char", 1154 "to_date", 1155 "to_days", 1156 "to_json", 1157 "to_number", 1158 "to_seconds", 1159 "to_timestamp", 1160 "tracelogs", 1161 "traditional", 1162 "trailing", 1163 "transform", 1164 "transaction", 1165 "_transactions_experimental", 1166 "treat", 1167 "trigger", 1168 "triggers", 1169 "trim", 1170 "true", 1171 "trunc", 1172 "truncate", 1173 "trusted", 1174 "two_phase", 1175 "_twopcid", 1176 "type", 1177 "types", 1178 "ucase", 1179 "unbounded", 1180 "uncommitted", 1181 "undefined", 1182 "undo", 1183 "unencrypted", 1184 "unenforced", 1185 "unhex", 1186 "unhold", 1187 "unicode", 1188 "union", 1189 "unique", 1190 "_unittest", 1191 "unix_timestamp", 1192 "unknown", 1193 "unlisten", 1194 "_unload", 1195 "unlock", 1196 "unlogged", 1197 "unpivot", 1198 "unsigned", 1199 "until", 1200 "update", 1201 "upgrade", 1202 "upper", 1203 "usage", 1204 "use", 1205 "user", 1206 "users", 1207 "using", 1208 "utc_date", 1209 "utc_time", 1210 "utc_timestamp", 1211 "_utf8", 1212 "vacuum", 1213 "valid", 1214 "validate", 1215 "validator", 1216 "value", 1217 "values", 1218 "varbinary", 1219 "varchar", 1220 "varcharacter", 1221 "variables", 1222 "variadic", 1223 "variance", 1224 "var_pop", 1225 "var_samp", 1226 "varying", 1227 "vector_sub", 1228 "verbose", 1229 "version", 1230 "view", 1231 "void", 1232 "volatile", 1233 "voting", 1234 "wait", 1235 "_wake", 1236 "warnings", 1237 "week", 1238 "weekday", 1239 "weekofyear", 1240 "when", 1241 "where", 1242 "while", 1243 "whitespace", 1244 "window", 1245 "with", 1246 "without", 1247 "within", 1248 "_wm_heartbeat", 1249 "work", 1250 "workload", 1251 "wrapper", 1252 "write", 1253 "xact_id", 1254 "xor", 1255 "year", 1256 "year_month", 1257 "yes", 1258 "zerofill", 1259 "zone", 1260 } 1261 1262 def jsonextractscalar_sql(self, expression: exp.JSONExtractScalar) -> str: 1263 json_type = expression.args.get("json_type") 1264 func_name = "JSON_EXTRACT_JSON" if json_type is None else f"JSON_EXTRACT_{json_type}" 1265 return json_extract_segments(func_name)(self, expression) 1266 1267 def jsonbextractscalar_sql(self, expression: exp.JSONBExtractScalar) -> str: 1268 json_type = expression.args.get("json_type") 1269 func_name = "BSON_EXTRACT_BSON" if json_type is None else f"BSON_EXTRACT_{json_type}" 1270 return json_extract_segments(func_name)(self, expression) 1271 1272 def jsonextractarray_sql(self, expression: exp.JSONExtractArray) -> str: 1273 self.unsupported("Arrays are not supported in SingleStore") 1274 return self.function_fallback_sql(expression) 1275 1276 @unsupported_args("on_condition") 1277 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1278 res: exp.Expression = exp.JSONExtractScalar( 1279 this=expression.this, 1280 expression=expression.args.get("path"), 1281 json_type="STRING", 1282 ) 1283 1284 returning = expression.args.get("returning") 1285 if returning is not None: 1286 res = exp.Cast(this=res, to=returning) 1287 1288 return self.sql(res)
18class SingleStore(MySQL): 19 SUPPORTS_ORDER_BY_ALL = True 20 21 TIME_MAPPING: t.Dict[str, str] = { 22 "D": "%u", # Day of week (1-7) 23 "DD": "%d", # day of month (01-31) 24 "DY": "%a", # abbreviated name of day 25 "HH": "%I", # Hour of day (01-12) 26 "HH12": "%I", # alias for HH 27 "HH24": "%H", # Hour of day (00-23) 28 "MI": "%M", # Minute (00-59) 29 "MM": "%m", # Month (01-12; January = 01) 30 "MON": "%b", # Abbreviated name of month 31 "MONTH": "%B", # Name of month 32 "SS": "%S", # Second (00-59) 33 "RR": "%y", # 15 34 "YY": "%y", # 15 35 "YYYY": "%Y", # 2015 36 "FF6": "%f", # only 6 digits are supported in python formats 37 } 38 39 class Tokenizer(MySQL.Tokenizer): 40 BYTE_STRINGS = [("e'", "'"), ("E'", "'")] 41 42 KEYWORDS = { 43 **MySQL.Tokenizer.KEYWORDS, 44 "BSON": TokenType.JSONB, 45 "GEOGRAPHYPOINT": TokenType.GEOGRAPHYPOINT, 46 ":>": TokenType.COLON_GT, 47 "!:>": TokenType.NCOLON_GT, 48 "::$": TokenType.DCOLONDOLLAR, 49 "::%": TokenType.DCOLONPERCENT, 50 } 51 52 class Parser(MySQL.Parser): 53 FUNCTIONS = { 54 **MySQL.Parser.FUNCTIONS, 55 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "singlestore"), 56 "TO_TIMESTAMP": build_formatted_time(exp.StrToTime, "singlestore"), 57 "TO_CHAR": build_formatted_time(exp.ToChar, "singlestore"), 58 "STR_TO_DATE": build_formatted_time(exp.StrToDate, "mysql"), 59 "DATE_FORMAT": build_formatted_time(exp.TimeToStr, "mysql"), 60 "TIME_FORMAT": lambda args: exp.TimeToStr( 61 # The first argument is converted to TIME(6) 62 # This is needed because exp.TimeToStr is converted to DATE_FORMAT 63 # which interprets the first argument as DATETIME and fails to parse 64 # string literals like '12:05:47' without a date part. 65 this=exp.Cast( 66 this=seq_get(args, 0), 67 to=exp.DataType.build( 68 exp.DataType.Type.TIME, 69 expressions=[exp.DataTypeParam(this=exp.Literal.number(6))], 70 ), 71 ), 72 format=MySQL.format_time(seq_get(args, 1)), 73 ), 74 "UNIX_TIMESTAMP": exp.StrToUnix.from_arg_list, 75 "FROM_UNIXTIME": build_formatted_time(exp.UnixToTime, "mysql"), 76 "BSON_EXTRACT_BSON": build_json_extract_path(exp.JSONBExtract), 77 "BSON_EXTRACT_STRING": build_json_extract_path( 78 exp.JSONBExtractScalar, json_type="STRING" 79 ), 80 "BSON_EXTRACT_DOUBLE": build_json_extract_path( 81 exp.JSONBExtractScalar, json_type="DOUBLE" 82 ), 83 "BSON_EXTRACT_BIGINT": build_json_extract_path( 84 exp.JSONBExtractScalar, json_type="BIGINT" 85 ), 86 "JSON_EXTRACT_JSON": build_json_extract_path(exp.JSONExtract), 87 "JSON_EXTRACT_STRING": build_json_extract_path( 88 exp.JSONExtractScalar, json_type="STRING" 89 ), 90 "JSON_EXTRACT_DOUBLE": build_json_extract_path( 91 exp.JSONExtractScalar, json_type="DOUBLE" 92 ), 93 "JSON_EXTRACT_BIGINT": build_json_extract_path( 94 exp.JSONExtractScalar, json_type="BIGINT" 95 ), 96 "DATE": exp.Date.from_arg_list, 97 } 98 99 CAST_COLUMN_OPERATORS = {TokenType.COLON_GT, TokenType.NCOLON_GT} 100 101 COLUMN_OPERATORS = { 102 TokenType.COLON_GT: lambda self, this, to: self.expression( 103 exp.Cast, 104 this=this, 105 to=to, 106 ), 107 TokenType.NCOLON_GT: lambda self, this, to: self.expression( 108 exp.TryCast, 109 this=this, 110 to=to, 111 ), 112 TokenType.DCOLON: lambda self, this, path: build_json_extract_path(exp.JSONExtract)( 113 [this, exp.Literal.string(path.name)] 114 ), 115 TokenType.DCOLONDOLLAR: lambda self, this, path: build_json_extract_path( 116 exp.JSONExtractScalar, json_type="STRING" 117 )([this, exp.Literal.string(path.name)]), 118 TokenType.DCOLONPERCENT: lambda self, this, path: build_json_extract_path( 119 exp.JSONExtractScalar, json_type="DOUBLE" 120 )([this, exp.Literal.string(path.name)]), 121 } 122 123 class Generator(MySQL.Generator): 124 SUPPORTED_JSON_PATH_PARTS = { 125 exp.JSONPathKey, 126 exp.JSONPathRoot, 127 exp.JSONPathSubscript, 128 } 129 130 TRANSFORMS = { 131 **MySQL.Generator.TRANSFORMS, 132 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 133 exp.StrToTime: lambda self, e: self.func("TO_TIMESTAMP", e.this, self.format_time(e)), 134 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 135 exp.StrToDate: lambda self, e: self.func( 136 "STR_TO_DATE", 137 e.this, 138 self.format_time( 139 e, 140 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 141 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 142 ), 143 ), 144 exp.TimeToStr: lambda self, e: self.func( 145 "DATE_FORMAT", 146 e.this, 147 self.format_time( 148 e, 149 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 150 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 151 ), 152 ), 153 exp.Date: unsupported_args("zone", "expressions")(rename_func("DATE")), 154 exp.Cast: unsupported_args("format", "action", "default")( 155 lambda self, e: f"{self.sql(e, 'this')} :> {self.sql(e, 'to')}" 156 ), 157 exp.TryCast: unsupported_args("format", "action", "default")( 158 lambda self, e: f"{self.sql(e, 'this')} !:> {self.sql(e, 'to')}" 159 ), 160 exp.StrToUnix: unsupported_args("format")(rename_func("UNIX_TIMESTAMP")), 161 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 162 exp.TimeStrToUnix: rename_func("UNIX_TIMESTAMP"), 163 exp.UnixSeconds: rename_func("UNIX_TIMESTAMP"), 164 exp.UnixToStr: lambda self, e: self.func( 165 "FROM_UNIXTIME", 166 e.this, 167 self.format_time( 168 e, 169 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 170 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 171 ), 172 ), 173 exp.UnixToTime: unsupported_args("scale", "zone", "hours", "minutes")( 174 lambda self, e: self.func( 175 "FROM_UNIXTIME", 176 e.this, 177 self.format_time( 178 e, 179 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 180 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 181 ), 182 ), 183 ), 184 exp.UnixToTimeStr: lambda self, e: f"FROM_UNIXTIME({self.sql(e, 'this')}) :> TEXT", 185 exp.JSONExtract: unsupported_args( 186 "only_json_types", 187 "expressions", 188 "variant_extract", 189 "json_query", 190 "option", 191 "quote", 192 "on_condition", 193 "requires_json", 194 )(json_extract_segments("JSON_EXTRACT_JSON")), 195 exp.JSONBExtract: json_extract_segments("BSON_EXTRACT_BSON"), 196 exp.JSONPathKey: json_path_key_only_name, 197 exp.JSONPathSubscript: lambda self, e: self.json_path_part(e.this), 198 exp.JSONPathRoot: lambda *_: "", 199 } 200 TRANSFORMS.pop(exp.JSONExtractScalar) 201 TRANSFORMS.pop(exp.JSONPathFilter) 202 TRANSFORMS.pop(exp.JSONPathRecursive) 203 TRANSFORMS.pop(exp.JSONPathScript) 204 TRANSFORMS.pop(exp.JSONPathSelector) 205 TRANSFORMS.pop(exp.JSONPathSlice) 206 TRANSFORMS.pop(exp.JSONPathUnion) 207 TRANSFORMS.pop(exp.JSONPathWildcard) 208 209 # https://docs.singlestore.com/cloud/reference/sql-reference/restricted-keywords/list-of-restricted-keywords/ 210 RESERVED_KEYWORDS = { 211 "abs", 212 "absolute", 213 "access", 214 "account", 215 "acos", 216 "action", 217 "add", 218 "adddate", 219 "addtime", 220 "admin", 221 "aes_decrypt", 222 "aes_encrypt", 223 "after", 224 "against", 225 "aggregate", 226 "aggregates", 227 "aggregator", 228 "aggregator_id", 229 "aggregator_plan_hash", 230 "aggregators", 231 "algorithm", 232 "all", 233 "also", 234 "alter", 235 "always", 236 "analyse", 237 "analyze", 238 "and", 239 "anti_join", 240 "any", 241 "any_value", 242 "approx_count_distinct", 243 "approx_count_distinct_accumulate", 244 "approx_count_distinct_combine", 245 "approx_count_distinct_estimate", 246 "approx_geography_intersects", 247 "approx_percentile", 248 "arghistory", 249 "arrange", 250 "arrangement", 251 "array", 252 "as", 253 "asc", 254 "ascii", 255 "asensitive", 256 "asin", 257 "asm", 258 "assertion", 259 "assignment", 260 "ast", 261 "asymmetric", 262 "async", 263 "at", 264 "atan", 265 "atan2", 266 "attach", 267 "attribute", 268 "authorization", 269 "auto", 270 "auto_increment", 271 "auto_reprovision", 272 "autostats", 273 "autostats_cardinality_mode", 274 "autostats_enabled", 275 "autostats_histogram_mode", 276 "autostats_sampling", 277 "availability", 278 "avg", 279 "avg_row_length", 280 "avro", 281 "azure", 282 "background", 283 "_background_threads_for_cleanup", 284 "backup", 285 "backup_history", 286 "backup_id", 287 "backward", 288 "batch", 289 "batches", 290 "batch_interval", 291 "_batch_size_limit", 292 "before", 293 "begin", 294 "between", 295 "bigint", 296 "bin", 297 "binary", 298 "_binary", 299 "bit", 300 "bit_and", 301 "bit_count", 302 "bit_or", 303 "bit_xor", 304 "blob", 305 "bool", 306 "boolean", 307 "bootstrap", 308 "both", 309 "_bt", 310 "btree", 311 "bucket_count", 312 "by", 313 "byte", 314 "byte_length", 315 "cache", 316 "call", 317 "call_for_pipeline", 318 "called", 319 "capture", 320 "cascade", 321 "cascaded", 322 "case", 323 "cast", 324 "catalog", 325 "ceil", 326 "ceiling", 327 "chain", 328 "change", 329 "char", 330 "character", 331 "characteristics", 332 "character_length", 333 "char_length", 334 "charset", 335 "check", 336 "checkpoint", 337 "_check_can_connect", 338 "_check_consistency", 339 "checksum", 340 "_checksum", 341 "class", 342 "clear", 343 "client", 344 "client_found_rows", 345 "close", 346 "cluster", 347 "clustered", 348 "cnf", 349 "coalesce", 350 "coercibility", 351 "collate", 352 "collation", 353 "collect", 354 "column", 355 "columnar", 356 "columns", 357 "columnstore", 358 "columnstore_segment_rows", 359 "comment", 360 "comments", 361 "commit", 362 "committed", 363 "_commit_log_tail", 364 "committed", 365 "compact", 366 "compile", 367 "compressed", 368 "compression", 369 "concat", 370 "concat_ws", 371 "concurrent", 372 "concurrently", 373 "condition", 374 "configuration", 375 "connection", 376 "connection_id", 377 "connections", 378 "config", 379 "constraint", 380 "constraints", 381 "content", 382 "continue", 383 "_continue_replay", 384 "conv", 385 "conversion", 386 "convert", 387 "convert_tz", 388 "copy", 389 "_core", 390 "cos", 391 "cost", 392 "cot", 393 "count", 394 "create", 395 "credentials", 396 "cross", 397 "cube", 398 "csv", 399 "cume_dist", 400 "curdate", 401 "current", 402 "current_catalog", 403 "current_date", 404 "current_role", 405 "current_schema", 406 "current_security_groups", 407 "current_security_roles", 408 "current_time", 409 "current_timestamp", 410 "current_user", 411 "cursor", 412 "curtime", 413 "cycle", 414 "data", 415 "database", 416 "databases", 417 "date", 418 "date_add", 419 "datediff", 420 "date_format", 421 "date_sub", 422 "date_trunc", 423 "datetime", 424 "day", 425 "day_hour", 426 "day_microsecond", 427 "day_minute", 428 "dayname", 429 "dayofmonth", 430 "dayofweek", 431 "dayofyear", 432 "day_second", 433 "deallocate", 434 "dec", 435 "decimal", 436 "declare", 437 "decode", 438 "default", 439 "defaults", 440 "deferrable", 441 "deferred", 442 "defined", 443 "definer", 444 "degrees", 445 "delayed", 446 "delay_key_write", 447 "delete", 448 "delimiter", 449 "delimiters", 450 "dense_rank", 451 "desc", 452 "describe", 453 "detach", 454 "deterministic", 455 "dictionary", 456 "differential", 457 "directory", 458 "disable", 459 "discard", 460 "_disconnect", 461 "disk", 462 "distinct", 463 "distinctrow", 464 "distributed_joins", 465 "div", 466 "do", 467 "document", 468 "domain", 469 "dot_product", 470 "double", 471 "drop", 472 "_drop_profile", 473 "dual", 474 "dump", 475 "duplicate", 476 "dynamic", 477 "earliest", 478 "each", 479 "echo", 480 "election", 481 "else", 482 "elseif", 483 "elt", 484 "enable", 485 "enclosed", 486 "encoding", 487 "encrypted", 488 "end", 489 "engine", 490 "engines", 491 "enum", 492 "errors", 493 "escape", 494 "escaped", 495 "estimate", 496 "euclidean_distance", 497 "event", 498 "events", 499 "except", 500 "exclude", 501 "excluding", 502 "exclusive", 503 "execute", 504 "exists", 505 "exit", 506 "exp", 507 "explain", 508 "extended", 509 "extension", 510 "external", 511 "external_host", 512 "external_port", 513 "extract", 514 "extractor", 515 "extractors", 516 "extra_join", 517 "_failover", 518 "failed_login_attempts", 519 "failure", 520 "false", 521 "family", 522 "fault", 523 "fetch", 524 "field", 525 "fields", 526 "file", 527 "files", 528 "fill", 529 "first", 530 "first_value", 531 "fix_alter", 532 "fixed", 533 "float", 534 "float4", 535 "float8", 536 "floor", 537 "flush", 538 "following", 539 "for", 540 "force", 541 "force_compiled_mode", 542 "force_interpreter_mode", 543 "foreground", 544 "foreign", 545 "format", 546 "forward", 547 "found_rows", 548 "freeze", 549 "from", 550 "from_base64", 551 "from_days", 552 "from_unixtime", 553 "fs", 554 "_fsync", 555 "full", 556 "fulltext", 557 "function", 558 "functions", 559 "gc", 560 "gcs", 561 "get_format", 562 "_gc", 563 "_gcx", 564 "generate", 565 "geography", 566 "geography_area", 567 "geography_contains", 568 "geography_distance", 569 "geography_intersects", 570 "geography_latitude", 571 "geography_length", 572 "geography_longitude", 573 "geographypoint", 574 "geography_point", 575 "geography_within_distance", 576 "geometry", 577 "geometry_area", 578 "geometry_contains", 579 "geometry_distance", 580 "geometry_filter", 581 "geometry_intersects", 582 "geometry_length", 583 "geometrypoint", 584 "geometry_point", 585 "geometry_within_distance", 586 "geometry_x", 587 "geometry_y", 588 "global", 589 "_global_version_timestamp", 590 "grant", 591 "granted", 592 "grants", 593 "greatest", 594 "group", 595 "grouping", 596 "groups", 597 "group_concat", 598 "gzip", 599 "handle", 600 "handler", 601 "hard_cpu_limit_percentage", 602 "hash", 603 "has_temp_tables", 604 "having", 605 "hdfs", 606 "header", 607 "heartbeat_no_logging", 608 "hex", 609 "highlight", 610 "high_priority", 611 "hold", 612 "holding", 613 "host", 614 "hosts", 615 "hour", 616 "hour_microsecond", 617 "hour_minute", 618 "hour_second", 619 "identified", 620 "identity", 621 "if", 622 "ifnull", 623 "ignore", 624 "ilike", 625 "immediate", 626 "immutable", 627 "implicit", 628 "import", 629 "in", 630 "including", 631 "increment", 632 "incremental", 633 "index", 634 "indexes", 635 "inet_aton", 636 "inet_ntoa", 637 "inet6_aton", 638 "inet6_ntoa", 639 "infile", 640 "inherit", 641 "inherits", 642 "_init_profile", 643 "init", 644 "initcap", 645 "initialize", 646 "initially", 647 "inject", 648 "inline", 649 "inner", 650 "inout", 651 "input", 652 "insensitive", 653 "insert", 654 "insert_method", 655 "instance", 656 "instead", 657 "instr", 658 "int", 659 "int1", 660 "int2", 661 "int3", 662 "int4", 663 "int8", 664 "integer", 665 "_internal_dynamic_typecast", 666 "interpreter_mode", 667 "intersect", 668 "interval", 669 "into", 670 "invoker", 671 "is", 672 "isnull", 673 "isolation", 674 "iterate", 675 "join", 676 "json", 677 "json_agg", 678 "json_array_contains_double", 679 "json_array_contains_json", 680 "json_array_contains_string", 681 "json_array_push_double", 682 "json_array_push_json", 683 "json_array_push_string", 684 "json_delete_key", 685 "json_extract_double", 686 "json_extract_json", 687 "json_extract_string", 688 "json_extract_bigint", 689 "json_get_type", 690 "json_length", 691 "json_set_double", 692 "json_set_json", 693 "json_set_string", 694 "json_splice_double", 695 "json_splice_json", 696 "json_splice_string", 697 "kafka", 698 "key", 699 "key_block_size", 700 "keys", 701 "kill", 702 "killall", 703 "label", 704 "lag", 705 "language", 706 "large", 707 "last", 708 "last_day", 709 "last_insert_id", 710 "last_value", 711 "lateral", 712 "latest", 713 "lc_collate", 714 "lc_ctype", 715 "lcase", 716 "lead", 717 "leading", 718 "leaf", 719 "leakproof", 720 "least", 721 "leave", 722 "leaves", 723 "left", 724 "length", 725 "level", 726 "license", 727 "like", 728 "limit", 729 "lines", 730 "listen", 731 "llvm", 732 "ln", 733 "load", 734 "loaddata_where", 735 "_load", 736 "local", 737 "localtime", 738 "localtimestamp", 739 "locate", 740 "location", 741 "lock", 742 "log", 743 "log10", 744 "log2", 745 "long", 746 "longblob", 747 "longtext", 748 "loop", 749 "lower", 750 "low_priority", 751 "lpad", 752 "_ls", 753 "ltrim", 754 "lz4", 755 "management", 756 "_management_thread", 757 "mapping", 758 "master", 759 "match", 760 "materialized", 761 "max", 762 "maxvalue", 763 "max_concurrency", 764 "max_errors", 765 "max_partitions_per_batch", 766 "max_queue_depth", 767 "max_retries_per_batch_partition", 768 "max_rows", 769 "mbc", 770 "md5", 771 "mpl", 772 "median", 773 "mediumblob", 774 "mediumint", 775 "mediumtext", 776 "member", 777 "memory", 778 "memory_percentage", 779 "_memsql_table_id_lookup", 780 "memsql", 781 "memsql_deserialize", 782 "memsql_imitating_kafka", 783 "memsql_serialize", 784 "merge", 785 "metadata", 786 "microsecond", 787 "middleint", 788 "min", 789 "min_rows", 790 "minus", 791 "minute", 792 "minute_microsecond", 793 "minute_second", 794 "minvalue", 795 "mod", 796 "mode", 797 "model", 798 "modifies", 799 "modify", 800 "month", 801 "monthname", 802 "months_between", 803 "move", 804 "mpl", 805 "names", 806 "named", 807 "namespace", 808 "national", 809 "natural", 810 "nchar", 811 "next", 812 "no", 813 "node", 814 "none", 815 "no_query_rewrite", 816 "noparam", 817 "not", 818 "nothing", 819 "notify", 820 "now", 821 "nowait", 822 "no_write_to_binlog", 823 "no_query_rewrite", 824 "norely", 825 "nth_value", 826 "ntile", 827 "null", 828 "nullcols", 829 "nullif", 830 "nulls", 831 "numeric", 832 "nvarchar", 833 "object", 834 "octet_length", 835 "of", 836 "off", 837 "offline", 838 "offset", 839 "offsets", 840 "oids", 841 "on", 842 "online", 843 "only", 844 "open", 845 "operator", 846 "optimization", 847 "optimize", 848 "optimizer", 849 "optimizer_state", 850 "option", 851 "options", 852 "optionally", 853 "or", 854 "order", 855 "ordered_serialize", 856 "orphan", 857 "out", 858 "out_of_order", 859 "outer", 860 "outfile", 861 "over", 862 "overlaps", 863 "overlay", 864 "owned", 865 "owner", 866 "pack_keys", 867 "paired", 868 "parser", 869 "parquet", 870 "partial", 871 "partition", 872 "partition_id", 873 "partitioning", 874 "partitions", 875 "passing", 876 "password", 877 "password_lock_time", 878 "parser", 879 "pause", 880 "_pause_replay", 881 "percent_rank", 882 "percentile_cont", 883 "percentile_disc", 884 "periodic", 885 "persisted", 886 "pi", 887 "pipeline", 888 "pipelines", 889 "pivot", 890 "placing", 891 "plan", 892 "plans", 893 "plancache", 894 "plugins", 895 "pool", 896 "pools", 897 "port", 898 "position", 899 "pow", 900 "power", 901 "preceding", 902 "precision", 903 "prepare", 904 "prepared", 905 "preserve", 906 "primary", 907 "prior", 908 "privileges", 909 "procedural", 910 "procedure", 911 "procedures", 912 "process", 913 "processlist", 914 "profile", 915 "profiles", 916 "program", 917 "promote", 918 "proxy", 919 "purge", 920 "quarter", 921 "queries", 922 "query", 923 "query_timeout", 924 "queue", 925 "quote", 926 "radians", 927 "rand", 928 "range", 929 "rank", 930 "read", 931 "_read", 932 "reads", 933 "real", 934 "reassign", 935 "rebalance", 936 "recheck", 937 "record", 938 "recursive", 939 "redundancy", 940 "redundant", 941 "ref", 942 "reference", 943 "references", 944 "refresh", 945 "regexp", 946 "reindex", 947 "relative", 948 "release", 949 "reload", 950 "rely", 951 "remote", 952 "remove", 953 "rename", 954 "repair", 955 "_repair_table", 956 "repeat", 957 "repeatable", 958 "_repl", 959 "_reprovisioning", 960 "replace", 961 "replica", 962 "replicate", 963 "replicating", 964 "replication", 965 "durability", 966 "require", 967 "resource", 968 "resource_pool", 969 "reset", 970 "restart", 971 "restore", 972 "restrict", 973 "result", 974 "_resurrect", 975 "retry", 976 "return", 977 "returning", 978 "returns", 979 "reverse", 980 "revoke", 981 "rg_pool", 982 "right", 983 "right_anti_join", 984 "right_semi_join", 985 "right_straight_join", 986 "rlike", 987 "role", 988 "roles", 989 "rollback", 990 "rollup", 991 "round", 992 "routine", 993 "row", 994 "row_count", 995 "row_format", 996 "row_number", 997 "rows", 998 "rowstore", 999 "rule", 1000 "rpad", 1001 "_rpc", 1002 "rtrim", 1003 "running", 1004 "s3", 1005 "safe", 1006 "save", 1007 "savepoint", 1008 "scalar", 1009 "schema", 1010 "schemas", 1011 "schema_binding", 1012 "scroll", 1013 "search", 1014 "second", 1015 "second_microsecond", 1016 "sec_to_time", 1017 "security", 1018 "select", 1019 "semi_join", 1020 "_send_threads", 1021 "sensitive", 1022 "separator", 1023 "sequence", 1024 "sequences", 1025 "serial", 1026 "serializable", 1027 "series", 1028 "service_user", 1029 "server", 1030 "session", 1031 "session_user", 1032 "set", 1033 "setof", 1034 "security_lists_intersect", 1035 "sha", 1036 "sha1", 1037 "sha2", 1038 "shard", 1039 "sharded", 1040 "sharded_id", 1041 "share", 1042 "show", 1043 "shutdown", 1044 "sigmoid", 1045 "sign", 1046 "signal", 1047 "similar", 1048 "simple", 1049 "site", 1050 "signed", 1051 "sin", 1052 "skip", 1053 "skipped_batches", 1054 "sleep", 1055 "_sleep", 1056 "smallint", 1057 "snapshot", 1058 "_snapshot", 1059 "_snapshots", 1060 "soft_cpu_limit_percentage", 1061 "some", 1062 "soname", 1063 "sparse", 1064 "spatial", 1065 "spatial_check_index", 1066 "specific", 1067 "split", 1068 "sql", 1069 "sql_big_result", 1070 "sql_buffer_result", 1071 "sql_cache", 1072 "sql_calc_found_rows", 1073 "sqlexception", 1074 "sql_mode", 1075 "sql_no_cache", 1076 "sql_no_logging", 1077 "sql_small_result", 1078 "sqlstate", 1079 "sqlwarning", 1080 "sqrt", 1081 "ssl", 1082 "stable", 1083 "standalone", 1084 "start", 1085 "starting", 1086 "state", 1087 "statement", 1088 "statistics", 1089 "stats", 1090 "status", 1091 "std", 1092 "stddev", 1093 "stddev_pop", 1094 "stddev_samp", 1095 "stdin", 1096 "stdout", 1097 "stop", 1098 "storage", 1099 "str_to_date", 1100 "straight_join", 1101 "strict", 1102 "string", 1103 "strip", 1104 "subdate", 1105 "substr", 1106 "substring", 1107 "substring_index", 1108 "success", 1109 "sum", 1110 "super", 1111 "symmetric", 1112 "sync_snapshot", 1113 "sync", 1114 "_sync", 1115 "_sync2", 1116 "_sync_partitions", 1117 "_sync_snapshot", 1118 "synchronize", 1119 "sysid", 1120 "system", 1121 "table", 1122 "table_checksum", 1123 "tables", 1124 "tablespace", 1125 "tags", 1126 "tan", 1127 "target_size", 1128 "task", 1129 "temp", 1130 "template", 1131 "temporary", 1132 "temptable", 1133 "_term_bump", 1134 "terminate", 1135 "terminated", 1136 "test", 1137 "text", 1138 "then", 1139 "time", 1140 "timediff", 1141 "time_bucket", 1142 "time_format", 1143 "timeout", 1144 "timestamp", 1145 "timestampadd", 1146 "timestampdiff", 1147 "timezone", 1148 "time_to_sec", 1149 "tinyblob", 1150 "tinyint", 1151 "tinytext", 1152 "to", 1153 "to_base64", 1154 "to_char", 1155 "to_date", 1156 "to_days", 1157 "to_json", 1158 "to_number", 1159 "to_seconds", 1160 "to_timestamp", 1161 "tracelogs", 1162 "traditional", 1163 "trailing", 1164 "transform", 1165 "transaction", 1166 "_transactions_experimental", 1167 "treat", 1168 "trigger", 1169 "triggers", 1170 "trim", 1171 "true", 1172 "trunc", 1173 "truncate", 1174 "trusted", 1175 "two_phase", 1176 "_twopcid", 1177 "type", 1178 "types", 1179 "ucase", 1180 "unbounded", 1181 "uncommitted", 1182 "undefined", 1183 "undo", 1184 "unencrypted", 1185 "unenforced", 1186 "unhex", 1187 "unhold", 1188 "unicode", 1189 "union", 1190 "unique", 1191 "_unittest", 1192 "unix_timestamp", 1193 "unknown", 1194 "unlisten", 1195 "_unload", 1196 "unlock", 1197 "unlogged", 1198 "unpivot", 1199 "unsigned", 1200 "until", 1201 "update", 1202 "upgrade", 1203 "upper", 1204 "usage", 1205 "use", 1206 "user", 1207 "users", 1208 "using", 1209 "utc_date", 1210 "utc_time", 1211 "utc_timestamp", 1212 "_utf8", 1213 "vacuum", 1214 "valid", 1215 "validate", 1216 "validator", 1217 "value", 1218 "values", 1219 "varbinary", 1220 "varchar", 1221 "varcharacter", 1222 "variables", 1223 "variadic", 1224 "variance", 1225 "var_pop", 1226 "var_samp", 1227 "varying", 1228 "vector_sub", 1229 "verbose", 1230 "version", 1231 "view", 1232 "void", 1233 "volatile", 1234 "voting", 1235 "wait", 1236 "_wake", 1237 "warnings", 1238 "week", 1239 "weekday", 1240 "weekofyear", 1241 "when", 1242 "where", 1243 "while", 1244 "whitespace", 1245 "window", 1246 "with", 1247 "without", 1248 "within", 1249 "_wm_heartbeat", 1250 "work", 1251 "workload", 1252 "wrapper", 1253 "write", 1254 "xact_id", 1255 "xor", 1256 "year", 1257 "year_month", 1258 "yes", 1259 "zerofill", 1260 "zone", 1261 } 1262 1263 def jsonextractscalar_sql(self, expression: exp.JSONExtractScalar) -> str: 1264 json_type = expression.args.get("json_type") 1265 func_name = "JSON_EXTRACT_JSON" if json_type is None else f"JSON_EXTRACT_{json_type}" 1266 return json_extract_segments(func_name)(self, expression) 1267 1268 def jsonbextractscalar_sql(self, expression: exp.JSONBExtractScalar) -> str: 1269 json_type = expression.args.get("json_type") 1270 func_name = "BSON_EXTRACT_BSON" if json_type is None else f"BSON_EXTRACT_{json_type}" 1271 return json_extract_segments(func_name)(self, expression) 1272 1273 def jsonextractarray_sql(self, expression: exp.JSONExtractArray) -> str: 1274 self.unsupported("Arrays are not supported in SingleStore") 1275 return self.function_fallback_sql(expression) 1276 1277 @unsupported_args("on_condition") 1278 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1279 res: exp.Expression = exp.JSONExtractScalar( 1280 this=expression.this, 1281 expression=expression.args.get("path"), 1282 json_type="STRING", 1283 ) 1284 1285 returning = expression.args.get("returning") 1286 if returning is not None: 1287 res = exp.Cast(this=res, to=returning) 1288 1289 return self.sql(res)
SUPPORTS_ORDER_BY_ALL =
True
Whether ORDER BY ALL is supported (expands to all the selected columns) as in DuckDB, Spark3/Databricks
TIME_MAPPING: Dict[str, str] =
{'D': '%u', 'DD': '%d', 'DY': '%a', 'HH': '%I', 'HH12': '%I', 'HH24': '%H', 'MI': '%M', 'MM': '%m', 'MON': '%b', 'MONTH': '%B', 'SS': '%S', 'RR': '%y', 'YY': '%y', 'YYYY': '%Y', 'FF6': '%f'}
Associates this dialect's time formats with their equivalent Python strftime formats.
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 'SingleStore.Tokenizer'>
parser_class =
<class 'SingleStore.Parser'>
generator_class =
<class 'SingleStore.Generator'>
TIME_TRIE: Dict =
{'D': {0: True, 'D': {0: True}, 'Y': {0: True}}, 'H': {'H': {0: True, '1': {'2': {0: True}}, '2': {'4': {0: True}}}}, 'M': {'I': {0: True}, 'M': {0: True}, 'O': {'N': {0: True, 'T': {'H': {0: True}}}}}, 'S': {'S': {0: True}}, 'R': {'R': {0: True}}, 'Y': {'Y': {0: True, 'Y': {'Y': {0: True}}}}, 'F': {'F': {'6': {0: True}}}}
FORMAT_TRIE: Dict =
{'D': {0: True, 'D': {0: True}, 'Y': {0: True}}, 'H': {'H': {0: True, '1': {'2': {0: True}}, '2': {'4': {0: True}}}}, 'M': {'I': {0: True}, 'M': {0: True}, 'O': {'N': {0: True, 'T': {'H': {0: True}}}}}, 'S': {'S': {0: True}}, 'R': {'R': {0: True}}, 'Y': {'Y': {0: True, 'Y': {'Y': {0: True}}}}, 'F': {'F': {'6': {0: True}}}}
INVERSE_TIME_MAPPING: Dict[str, str] =
{'%u': 'D', '%d': 'DD', '%a': 'DY', '%I': 'HH12', '%H': 'HH24', '%M': 'MI', '%m': 'MM', '%b': 'MON', '%B': 'MONTH', '%S': 'SS', '%y': 'YY', '%Y': 'YYYY', '%f': 'FF6'}
INVERSE_TIME_TRIE: Dict =
{'%': {'u': {0: True}, 'd': {0: True}, 'a': {0: True}, 'I': {0: True}, 'H': {0: True}, 'M': {0: True}, 'm': {0: True}, 'b': {0: True}, 'B': {0: True}, 'S': {0: True}, 'y': {0: True}, 'Y': {0: True}, 'f': {0: True}}}
39 class Tokenizer(MySQL.Tokenizer): 40 BYTE_STRINGS = [("e'", "'"), ("E'", "'")] 41 42 KEYWORDS = { 43 **MySQL.Tokenizer.KEYWORDS, 44 "BSON": TokenType.JSONB, 45 "GEOGRAPHYPOINT": TokenType.GEOGRAPHYPOINT, 46 ":>": TokenType.COLON_GT, 47 "!:>": TokenType.NCOLON_GT, 48 "::$": TokenType.DCOLONDOLLAR, 49 "::%": TokenType.DCOLONPERCENT, 50 }
KEYWORDS =
{'{%': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{%-': <TokenType.BLOCK_START: 'BLOCK_START'>, '%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '+%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-%}': <TokenType.BLOCK_END: 'BLOCK_END'>, '{{+': <TokenType.BLOCK_START: 'BLOCK_START'>, '{{-': <TokenType.BLOCK_START: 'BLOCK_START'>, '+}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '-}}': <TokenType.BLOCK_END: 'BLOCK_END'>, '/*+': <TokenType.HINT: 'HINT'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '||': <TokenType.DPIPE: 'DPIPE'>, '|>': <TokenType.PIPE_GT: 'PIPE_GT'>, '>=': <TokenType.GTE: 'GTE'>, '<=': <TokenType.LTE: 'LTE'>, '<>': <TokenType.NEQ: 'NEQ'>, '!=': <TokenType.NEQ: 'NEQ'>, ':=': <TokenType.COLON_EQ: 'COLON_EQ'>, '<=>': <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>, '->': <TokenType.ARROW: 'ARROW'>, '->>': <TokenType.DARROW: 'DARROW'>, '=>': <TokenType.FARROW: 'FARROW'>, '#>': <TokenType.HASH_ARROW: 'HASH_ARROW'>, '#>>': <TokenType.DHASH_ARROW: 'DHASH_ARROW'>, '<->': <TokenType.LR_ARROW: 'LR_ARROW'>, '&&': <TokenType.DAMP: 'DAMP'>, '??': <TokenType.DQMARK: 'DQMARK'>, '~~~': <TokenType.GLOB: 'GLOB'>, '~~': <TokenType.LIKE: 'LIKE'>, '~~*': <TokenType.ILIKE: 'ILIKE'>, '~*': <TokenType.IRLIKE: 'IRLIKE'>, 'ALL': <TokenType.ALL: 'ALL'>, 'ALWAYS': <TokenType.ALWAYS: 'ALWAYS'>, 'AND': <TokenType.AND: 'AND'>, 'ANTI': <TokenType.ANTI: 'ANTI'>, 'ANY': <TokenType.ANY: 'ANY'>, 'ASC': <TokenType.ASC: 'ASC'>, 'AS': <TokenType.ALIAS: 'ALIAS'>, 'ASOF': <TokenType.ASOF: 'ASOF'>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, 'BEGIN': <TokenType.BEGIN: 'BEGIN'>, 'BETWEEN': <TokenType.BETWEEN: 'BETWEEN'>, 'CACHE': <TokenType.CACHE: 'CACHE'>, 'UNCACHE': <TokenType.UNCACHE: 'UNCACHE'>, 'CASE': <TokenType.CASE: 'CASE'>, 'CHARACTER SET': <TokenType.CHARACTER_SET: 'CHARACTER_SET'>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 'CLUSTER_BY'>, 'COLLATE': <TokenType.COLLATE: 'COLLATE'>, 'COLUMN': <TokenType.COLUMN: 'COLUMN'>, 'COMMIT': <TokenType.COMMIT: 'COMMIT'>, 'CONNECT BY': <TokenType.CONNECT_BY: 'CONNECT_BY'>, 'CONSTRAINT': <TokenType.CONSTRAINT: 'CONSTRAINT'>, 'COPY': <TokenType.COPY: 'COPY'>, 'CREATE': <TokenType.CREATE: 'CREATE'>, 'CROSS': <TokenType.CROSS: 'CROSS'>, 'CUBE': <TokenType.CUBE: 'CUBE'>, 'CURRENT_DATE': <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, 'CURRENT_SCHEMA': <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, 'CURRENT_TIME': <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, 'CURRENT_TIMESTAMP': <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, 'CURRENT_USER': <TokenType.CURRENT_USER: 'CURRENT_USER'>, 'DATABASE': <TokenType.DATABASE: 'DATABASE'>, 'DEFAULT': <TokenType.DEFAULT: 'DEFAULT'>, 'DELETE': <TokenType.DELETE: 'DELETE'>, 'DESC': <TokenType.DESC: 'DESC'>, 'DESCRIBE': <TokenType.DESCRIBE: 'DESCRIBE'>, 'DISTINCT': <TokenType.DISTINCT: 'DISTINCT'>, 'DISTRIBUTE BY': <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>, 'DIV': <TokenType.DIV: 'DIV'>, 'DROP': <TokenType.DROP: 'DROP'>, 'ELSE': <TokenType.ELSE: 'ELSE'>, 'END': <TokenType.END: 'END'>, 'ENUM': <TokenType.ENUM: 'ENUM'>, 'ESCAPE': <TokenType.ESCAPE: 'ESCAPE'>, 'EXCEPT': <TokenType.EXCEPT: 'EXCEPT'>, 'EXECUTE': <TokenType.EXECUTE: 'EXECUTE'>, 'EXISTS': <TokenType.EXISTS: 'EXISTS'>, 'FALSE': <TokenType.FALSE: 'FALSE'>, 'FETCH': <TokenType.FETCH: 'FETCH'>, 'FILTER': <TokenType.FILTER: 'FILTER'>, 'FIRST': <TokenType.FIRST: 'FIRST'>, 'FULL': <TokenType.FULL: 'FULL'>, 'FUNCTION': <TokenType.FUNCTION: 'FUNCTION'>, 'FOR': <TokenType.FOR: 'FOR'>, 'FOREIGN KEY': <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, 'FORMAT': <TokenType.FORMAT: 'FORMAT'>, 'FROM': <TokenType.FROM: 'FROM'>, 'GEOGRAPHY': <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, 'GEOMETRY': <TokenType.GEOMETRY: 'GEOMETRY'>, 'GLOB': <TokenType.GLOB: 'GLOB'>, 'GROUP BY': <TokenType.GROUP_BY: 'GROUP_BY'>, 'GROUPING SETS': <TokenType.GROUPING_SETS: 'GROUPING_SETS'>, 'HAVING': <TokenType.HAVING: 'HAVING'>, 'ILIKE': <TokenType.ILIKE: 'ILIKE'>, 'IN': <TokenType.IN: 'IN'>, 'INDEX': <TokenType.INDEX: 'INDEX'>, 'INET': <TokenType.INET: 'INET'>, 'INNER': <TokenType.INNER: 'INNER'>, 'INSERT': <TokenType.INSERT: 'INSERT'>, 'INTERVAL': <TokenType.INTERVAL: 'INTERVAL'>, 'INTERSECT': <TokenType.INTERSECT: 'INTERSECT'>, 'INTO': <TokenType.INTO: 'INTO'>, 'IS': <TokenType.IS: 'IS'>, 'ISNULL': <TokenType.ISNULL: 'ISNULL'>, 'JOIN': <TokenType.JOIN: 'JOIN'>, 'KEEP': <TokenType.KEEP: 'KEEP'>, 'KILL': <TokenType.KILL: 'KILL'>, 'LATERAL': <TokenType.LATERAL: 'LATERAL'>, 'LEFT': <TokenType.LEFT: 'LEFT'>, 'LIKE': <TokenType.LIKE: 'LIKE'>, 'LIMIT': <TokenType.LIMIT: 'LIMIT'>, 'LOAD': <TokenType.LOAD: 'LOAD'>, 'LOCK': <TokenType.LOCK: 'LOCK'>, 'MERGE': <TokenType.MERGE: 'MERGE'>, 'NAMESPACE': <TokenType.NAMESPACE: 'NAMESPACE'>, 'NATURAL': <TokenType.NATURAL: 'NATURAL'>, 'NEXT': <TokenType.NEXT: 'NEXT'>, 'NOT': <TokenType.NOT: 'NOT'>, 'NOTNULL': <TokenType.NOTNULL: 'NOTNULL'>, 'NULL': <TokenType.NULL: 'NULL'>, 'OBJECT': <TokenType.OBJECT: 'OBJECT'>, 'OFFSET': <TokenType.OFFSET: 'OFFSET'>, 'ON': <TokenType.ON: 'ON'>, 'OR': <TokenType.OR: 'OR'>, 'XOR': <TokenType.XOR: 'XOR'>, 'ORDER BY': <TokenType.ORDER_BY: 'ORDER_BY'>, 'ORDINALITY': <TokenType.ORDINALITY: 'ORDINALITY'>, 'OUTER': <TokenType.OUTER: 'OUTER'>, 'OVER': <TokenType.OVER: 'OVER'>, 'OVERLAPS': <TokenType.OVERLAPS: 'OVERLAPS'>, 'OVERWRITE': <TokenType.OVERWRITE: 'OVERWRITE'>, 'PARTITION': <TokenType.PARTITION: 'PARTITION'>, 'PARTITION BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PARTITIONED_BY': <TokenType.PARTITION_BY: 'PARTITION_BY'>, 'PERCENT': <TokenType.PERCENT: 'PERCENT'>, 'PIVOT': <TokenType.PIVOT: 'PIVOT'>, 'PRAGMA': <TokenType.PRAGMA: 'PRAGMA'>, 'PRIMARY KEY': <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>, 'PROCEDURE': <TokenType.PROCEDURE: 'PROCEDURE'>, 'QUALIFY': <TokenType.QUALIFY: 'QUALIFY'>, 'RANGE': <TokenType.RANGE: 'RANGE'>, 'RECURSIVE': <TokenType.RECURSIVE: 'RECURSIVE'>, 'REGEXP': <TokenType.RLIKE: 'RLIKE'>, 'RENAME': <TokenType.RENAME: 'RENAME'>, 'REPLACE': <TokenType.REPLACE: 'REPLACE'>, 'RETURNING': <TokenType.RETURNING: 'RETURNING'>, 'REFERENCES': <TokenType.REFERENCES: 'REFERENCES'>, 'RIGHT': <TokenType.RIGHT: 'RIGHT'>, 'RLIKE': <TokenType.RLIKE: 'RLIKE'>, 'ROLLBACK': <TokenType.ROLLBACK: 'ROLLBACK'>, 'ROLLUP': <TokenType.ROLLUP: 'ROLLUP'>, 'ROW': <TokenType.ROW: 'ROW'>, 'ROWS': <TokenType.ROWS: 'ROWS'>, 'SCHEMA': <TokenType.SCHEMA: 'SCHEMA'>, 'SELECT': <TokenType.SELECT: 'SELECT'>, 'SEMI': <TokenType.SEMI: 'SEMI'>, 'SET': <TokenType.SET: 'SET'>, 'SETTINGS': <TokenType.SETTINGS: 'SETTINGS'>, 'SHOW': <TokenType.SHOW: 'SHOW'>, 'SIMILAR TO': <TokenType.SIMILAR_TO: 'SIMILAR_TO'>, 'SOME': <TokenType.SOME: 'SOME'>, 'SORT BY': <TokenType.SORT_BY: 'SORT_BY'>, 'START WITH': <TokenType.START_WITH: 'START_WITH'>, 'STRAIGHT_JOIN': <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, 'TABLE': <TokenType.TABLE: 'TABLE'>, 'TABLESAMPLE': <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>, 'TEMP': <TokenType.TEMPORARY: 'TEMPORARY'>, 'TEMPORARY': <TokenType.TEMPORARY: 'TEMPORARY'>, 'THEN': <TokenType.THEN: 'THEN'>, 'TRUE': <TokenType.TRUE: 'TRUE'>, 'TRUNCATE': <TokenType.TRUNCATE: 'TRUNCATE'>, 'UNION': <TokenType.UNION: 'UNION'>, 'UNKNOWN': <TokenType.UNKNOWN: 'UNKNOWN'>, 'UNNEST': <TokenType.UNNEST: 'UNNEST'>, 'UNPIVOT': <TokenType.UNPIVOT: 'UNPIVOT'>, 'UPDATE': <TokenType.UPDATE: 'UPDATE'>, 'USE': <TokenType.USE: 'USE'>, 'USING': <TokenType.USING: 'USING'>, 'UUID': <TokenType.UUID: 'UUID'>, 'VALUES': <TokenType.VALUES: 'VALUES'>, 'VIEW': <TokenType.VIEW: 'VIEW'>, 'VOLATILE': <TokenType.VOLATILE: 'VOLATILE'>, 'WHEN': <TokenType.WHEN: 'WHEN'>, 'WHERE': <TokenType.WHERE: 'WHERE'>, 'WINDOW': <TokenType.WINDOW: 'WINDOW'>, 'WITH': <TokenType.WITH: 'WITH'>, 'APPLY': <TokenType.APPLY: 'APPLY'>, 'ARRAY': <TokenType.ARRAY: 'ARRAY'>, 'BIT': <TokenType.BIT: 'BIT'>, 'BOOL': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BOOLEAN': <TokenType.BOOLEAN: 'BOOLEAN'>, 'BYTE': <TokenType.TINYINT: 'TINYINT'>, 'MEDIUMINT': <TokenType.MEDIUMINT: 'MEDIUMINT'>, 'INT1': <TokenType.TINYINT: 'TINYINT'>, 'TINYINT': <TokenType.TINYINT: 'TINYINT'>, 'INT16': <TokenType.SMALLINT: 'SMALLINT'>, 'SHORT': <TokenType.SMALLINT: 'SMALLINT'>, 'SMALLINT': <TokenType.SMALLINT: 'SMALLINT'>, 'HUGEINT': <TokenType.INT128: 'INT128'>, 'UHUGEINT': <TokenType.UINT128: 'UINT128'>, 'INT2': <TokenType.SMALLINT: 'SMALLINT'>, 'INTEGER': <TokenType.INT: 'INT'>, 'INT': <TokenType.INT: 'INT'>, 'INT4': <TokenType.INT: 'INT'>, 'INT32': <TokenType.INT: 'INT'>, 'INT64': <TokenType.BIGINT: 'BIGINT'>, 'INT128': <TokenType.INT128: 'INT128'>, 'INT256': <TokenType.INT256: 'INT256'>, 'LONG': <TokenType.BIGINT: 'BIGINT'>, 'BIGINT': <TokenType.BIGINT: 'BIGINT'>, 'INT8': <TokenType.TINYINT: 'TINYINT'>, 'UINT': <TokenType.UINT: 'UINT'>, 'UINT128': <TokenType.UINT128: 'UINT128'>, 'UINT256': <TokenType.UINT256: 'UINT256'>, 'DEC': <TokenType.DECIMAL: 'DECIMAL'>, 'DECIMAL': <TokenType.DECIMAL: 'DECIMAL'>, 'DECIMAL32': <TokenType.DECIMAL32: 'DECIMAL32'>, 'DECIMAL64': <TokenType.DECIMAL64: 'DECIMAL64'>, 'DECIMAL128': <TokenType.DECIMAL128: 'DECIMAL128'>, 'DECIMAL256': <TokenType.DECIMAL256: 'DECIMAL256'>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'LIST': <TokenType.LIST: 'LIST'>, 'MAP': <TokenType.MAP: 'MAP'>, 'NULLABLE': <TokenType.NULLABLE: 'NULLABLE'>, 'NUMBER': <TokenType.DECIMAL: 'DECIMAL'>, 'NUMERIC': <TokenType.DECIMAL: 'DECIMAL'>, 'FIXED': <TokenType.DECIMAL: 'DECIMAL'>, 'REAL': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT4': <TokenType.FLOAT: 'FLOAT'>, 'FLOAT8': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE': <TokenType.DOUBLE: 'DOUBLE'>, 'DOUBLE PRECISION': <TokenType.DOUBLE: 'DOUBLE'>, 'JSON': <TokenType.JSON: 'JSON'>, 'JSONB': <TokenType.JSONB: 'JSONB'>, 'CHAR': <TokenType.CHAR: 'CHAR'>, 'CHARACTER': <TokenType.CHAR: 'CHAR'>, 'CHAR VARYING': <TokenType.VARCHAR: 'VARCHAR'>, 'CHARACTER VARYING': <TokenType.VARCHAR: 'VARCHAR'>, 'NCHAR': <TokenType.NCHAR: 'NCHAR'>, 'VARCHAR': <TokenType.VARCHAR: 'VARCHAR'>, 'VARCHAR2': <TokenType.VARCHAR: 'VARCHAR'>, 'NVARCHAR': <TokenType.NVARCHAR: 'NVARCHAR'>, 'NVARCHAR2': <TokenType.NVARCHAR: 'NVARCHAR'>, 'BPCHAR': <TokenType.BPCHAR: 'BPCHAR'>, 'STR': <TokenType.TEXT: 'TEXT'>, 'STRING': <TokenType.TEXT: 'TEXT'>, 'TEXT': <TokenType.TEXT: 'TEXT'>, 'LONGTEXT': <TokenType.LONGTEXT: 'LONGTEXT'>, 'MEDIUMTEXT': <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, 'TINYTEXT': <TokenType.TINYTEXT: 'TINYTEXT'>, 'CLOB': <TokenType.TEXT: 'TEXT'>, 'LONGVARCHAR': <TokenType.TEXT: 'TEXT'>, 'BINARY': <TokenType.BINARY: 'BINARY'>, 'BLOB': <TokenType.BLOB: 'BLOB'>, 'LONGBLOB': <TokenType.LONGBLOB: 'LONGBLOB'>, 'MEDIUMBLOB': <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, 'TINYBLOB': <TokenType.TINYBLOB: 'TINYBLOB'>, 'BYTEA': <TokenType.VARBINARY: 'VARBINARY'>, 'VARBINARY': <TokenType.VARBINARY: 'VARBINARY'>, 'TIME': <TokenType.TIME: 'TIME'>, 'TIMETZ': <TokenType.TIMETZ: 'TIMETZ'>, 'TIMESTAMP': <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, 'TIMESTAMPTZ': <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, 'TIMESTAMPLTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMP_LTZ': <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, 'TIMESTAMPNTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'TIMESTAMP_NTZ': <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, 'DATE': <TokenType.DATE: 'DATE'>, 'DATETIME': <TokenType.DATETIME: 'DATETIME'>, 'INT4RANGE': <TokenType.INT4RANGE: 'INT4RANGE'>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, 'INT8RANGE': <TokenType.INT8RANGE: 'INT8RANGE'>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, 'NUMRANGE': <TokenType.NUMRANGE: 'NUMRANGE'>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, 'TSRANGE': <TokenType.TSRANGE: 'TSRANGE'>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, 'TSTZRANGE': <TokenType.TSTZRANGE: 'TSTZRANGE'>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, 'DATERANGE': <TokenType.DATERANGE: 'DATERANGE'>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, 'UNIQUE': <TokenType.UNIQUE: 'UNIQUE'>, 'VECTOR': <TokenType.VECTOR: 'VECTOR'>, 'STRUCT': <TokenType.STRUCT: 'STRUCT'>, 'SEQUENCE': <TokenType.SEQUENCE: 'SEQUENCE'>, 'VARIANT': <TokenType.VARIANT: 'VARIANT'>, 'ALTER': <TokenType.ALTER: 'ALTER'>, 'ANALYZE': <TokenType.ANALYZE: 'ANALYZE'>, 'CALL': <TokenType.COMMAND: 'COMMAND'>, 'COMMENT': <TokenType.COMMENT: 'COMMENT'>, 'EXPLAIN': <TokenType.DESCRIBE: 'DESCRIBE'>, 'GRANT': <TokenType.GRANT: 'GRANT'>, 'OPTIMIZE': <TokenType.COMMAND: 'COMMAND'>, 'PREPARE': <TokenType.COMMAND: 'COMMAND'>, 'VACUUM': <TokenType.COMMAND: 'COMMAND'>, 'USER-DEFINED': <TokenType.USERDEFINED: 'USERDEFINED'>, 'FOR VERSION': <TokenType.VERSION_SNAPSHOT: 'VERSION_SNAPSHOT'>, 'FOR TIMESTAMP': <TokenType.TIMESTAMP_SNAPSHOT: 'TIMESTAMP_SNAPSHOT'>, 'CHARSET': <TokenType.CHARACTER_SET: 'CHARACTER_SET'>, 'DISTINCTROW': <TokenType.DISTINCT: 'DISTINCT'>, 'FORCE': <TokenType.FORCE: 'FORCE'>, 'IGNORE': <TokenType.IGNORE: 'IGNORE'>, 'KEY': <TokenType.KEY: 'KEY'>, 'LOCK TABLES': <TokenType.COMMAND: 'COMMAND'>, 'MEMBER OF': <TokenType.MEMBER_OF: 'MEMBER_OF'>, 'SEPARATOR': <TokenType.SEPARATOR: 'SEPARATOR'>, 'SERIAL': <TokenType.SERIAL: 'SERIAL'>, 'START': <TokenType.BEGIN: 'BEGIN'>, 'SIGNED': <TokenType.BIGINT: 'BIGINT'>, 'SIGNED INTEGER': <TokenType.BIGINT: 'BIGINT'>, 'UNLOCK TABLES': <TokenType.COMMAND: 'COMMAND'>, 'UNSIGNED': <TokenType.UBIGINT: 'UBIGINT'>, 'UNSIGNED INTEGER': <TokenType.UBIGINT: 'UBIGINT'>, 'YEAR': <TokenType.YEAR: 'YEAR'>, '_ARMSCII8': <TokenType.INTRODUCER: 'INTRODUCER'>, '_ASCII': <TokenType.INTRODUCER: 'INTRODUCER'>, '_BIG5': <TokenType.INTRODUCER: 'INTRODUCER'>, '_BINARY': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP1250': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP1251': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP1256': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP1257': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP850': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP852': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP866': <TokenType.INTRODUCER: 'INTRODUCER'>, '_CP932': <TokenType.INTRODUCER: 'INTRODUCER'>, '_DEC8': <TokenType.INTRODUCER: 'INTRODUCER'>, '_EUCJPMS': <TokenType.INTRODUCER: 'INTRODUCER'>, '_EUCKR': <TokenType.INTRODUCER: 'INTRODUCER'>, '_GB18030': <TokenType.INTRODUCER: 'INTRODUCER'>, '_GB2312': <TokenType.INTRODUCER: 'INTRODUCER'>, '_GBK': <TokenType.INTRODUCER: 'INTRODUCER'>, '_GEOSTD8': <TokenType.INTRODUCER: 'INTRODUCER'>, '_GREEK': <TokenType.INTRODUCER: 'INTRODUCER'>, '_HEBREW': <TokenType.INTRODUCER: 'INTRODUCER'>, '_HP8': <TokenType.INTRODUCER: 'INTRODUCER'>, '_KEYBCS2': <TokenType.INTRODUCER: 'INTRODUCER'>, '_KOI8R': <TokenType.INTRODUCER: 'INTRODUCER'>, '_KOI8U': <TokenType.INTRODUCER: 'INTRODUCER'>, '_LATIN1': <TokenType.INTRODUCER: 'INTRODUCER'>, '_LATIN2': <TokenType.INTRODUCER: 'INTRODUCER'>, '_LATIN5': <TokenType.INTRODUCER: 'INTRODUCER'>, '_LATIN7': <TokenType.INTRODUCER: 'INTRODUCER'>, '_MACCE': <TokenType.INTRODUCER: 'INTRODUCER'>, '_MACROMAN': <TokenType.INTRODUCER: 'INTRODUCER'>, '_SJIS': <TokenType.INTRODUCER: 'INTRODUCER'>, '_SWE7': <TokenType.INTRODUCER: 'INTRODUCER'>, '_TIS620': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UCS2': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UJIS': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UTF8': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UTF16': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UTF16LE': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UTF32': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UTF8MB3': <TokenType.INTRODUCER: 'INTRODUCER'>, '_UTF8MB4': <TokenType.INTRODUCER: 'INTRODUCER'>, '@@': <TokenType.SESSION_PARAMETER: 'SESSION_PARAMETER'>, 'BSON': <TokenType.JSONB: 'JSONB'>, 'GEOGRAPHYPOINT': <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, ':>': <TokenType.COLON_GT: 'COLON_GT'>, '!:>': <TokenType.NCOLON_GT: 'NCOLON_GT'>, '::$': <TokenType.DCOLONDOLLAR: 'DCOLONDOLLAR'>, '::%': <TokenType.DCOLONPERCENT: 'DCOLONPERCENT'>}
Inherited Members
- sqlglot.tokens.Tokenizer
- Tokenizer
- SINGLE_TOKENS
- RAW_STRINGS
- HEREDOC_STRINGS
- UNICODE_STRINGS
- VAR_SINGLE_TOKENS
- IDENTIFIER_ESCAPES
- HEREDOC_TAG_IS_IDENTIFIER
- HEREDOC_STRING_ALTERNATIVE
- STRING_ESCAPES_ALLOWED_IN_RAW_STRINGS
- HINT_START
- TOKENS_PRECEDING_HINT
- WHITE_SPACE
- COMMAND_PREFIX_TOKENS
- NUMERIC_LITERALS
- dialect
- use_rs_tokenizer
- reset
- tokenize
- tokenize_rs
- size
- sql
- tokens
52 class Parser(MySQL.Parser): 53 FUNCTIONS = { 54 **MySQL.Parser.FUNCTIONS, 55 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "singlestore"), 56 "TO_TIMESTAMP": build_formatted_time(exp.StrToTime, "singlestore"), 57 "TO_CHAR": build_formatted_time(exp.ToChar, "singlestore"), 58 "STR_TO_DATE": build_formatted_time(exp.StrToDate, "mysql"), 59 "DATE_FORMAT": build_formatted_time(exp.TimeToStr, "mysql"), 60 "TIME_FORMAT": lambda args: exp.TimeToStr( 61 # The first argument is converted to TIME(6) 62 # This is needed because exp.TimeToStr is converted to DATE_FORMAT 63 # which interprets the first argument as DATETIME and fails to parse 64 # string literals like '12:05:47' without a date part. 65 this=exp.Cast( 66 this=seq_get(args, 0), 67 to=exp.DataType.build( 68 exp.DataType.Type.TIME, 69 expressions=[exp.DataTypeParam(this=exp.Literal.number(6))], 70 ), 71 ), 72 format=MySQL.format_time(seq_get(args, 1)), 73 ), 74 "UNIX_TIMESTAMP": exp.StrToUnix.from_arg_list, 75 "FROM_UNIXTIME": build_formatted_time(exp.UnixToTime, "mysql"), 76 "BSON_EXTRACT_BSON": build_json_extract_path(exp.JSONBExtract), 77 "BSON_EXTRACT_STRING": build_json_extract_path( 78 exp.JSONBExtractScalar, json_type="STRING" 79 ), 80 "BSON_EXTRACT_DOUBLE": build_json_extract_path( 81 exp.JSONBExtractScalar, json_type="DOUBLE" 82 ), 83 "BSON_EXTRACT_BIGINT": build_json_extract_path( 84 exp.JSONBExtractScalar, json_type="BIGINT" 85 ), 86 "JSON_EXTRACT_JSON": build_json_extract_path(exp.JSONExtract), 87 "JSON_EXTRACT_STRING": build_json_extract_path( 88 exp.JSONExtractScalar, json_type="STRING" 89 ), 90 "JSON_EXTRACT_DOUBLE": build_json_extract_path( 91 exp.JSONExtractScalar, json_type="DOUBLE" 92 ), 93 "JSON_EXTRACT_BIGINT": build_json_extract_path( 94 exp.JSONExtractScalar, json_type="BIGINT" 95 ), 96 "DATE": exp.Date.from_arg_list, 97 } 98 99 CAST_COLUMN_OPERATORS = {TokenType.COLON_GT, TokenType.NCOLON_GT} 100 101 COLUMN_OPERATORS = { 102 TokenType.COLON_GT: lambda self, this, to: self.expression( 103 exp.Cast, 104 this=this, 105 to=to, 106 ), 107 TokenType.NCOLON_GT: lambda self, this, to: self.expression( 108 exp.TryCast, 109 this=this, 110 to=to, 111 ), 112 TokenType.DCOLON: lambda self, this, path: build_json_extract_path(exp.JSONExtract)( 113 [this, exp.Literal.string(path.name)] 114 ), 115 TokenType.DCOLONDOLLAR: lambda self, this, path: build_json_extract_path( 116 exp.JSONExtractScalar, json_type="STRING" 117 )([this, exp.Literal.string(path.name)]), 118 TokenType.DCOLONPERCENT: lambda self, this, path: build_json_extract_path( 119 exp.JSONExtractScalar, json_type="DOUBLE" 120 )([this, exp.Literal.string(path.name)]), 121 }
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 =
{'ABS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Abs'>>, 'ADD_MONTHS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AddMonths'>>, 'AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.And'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnonymousAggFunc'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'APPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Apply'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantile'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopK'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARGMAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'MAX_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARGMIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'MIN_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARRAY': <function Parser.<lambda>>, 'ARRAY_AGG': <function Parser.<lambda>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAll'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAny'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcat'>>, 'ARRAY_CONCAT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcatAgg'>>, 'ARRAY_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFirst'>>, 'ARRAY_INTERSECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_INTERSECTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayLast'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, 'ARRAY_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayRemove'>>, 'ARRAY_REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayReverse'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySlice'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ascii'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'BIT_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BIT_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCountAgg'>>, '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'>>, 'BYTE_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ByteLength'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHR': <function Parser.<lambda>>, 'CHAR': <function Parser.<lambda>>, 'COALESCE': <function build_coalesce>, 'IFNULL': <function build_coalesce>, 'NVL': <function build_coalesce>, 'CODE_POINTS_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToString'>>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COLUMNS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Columns'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedAggFunc'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedParameterizedAgg'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConnectByRoot'>>, 'CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, 'CONVERT_TO_CHARSET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConvertToCharset'>>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, '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'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTime'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'CURRENT_TIMESTAMP_L_T_Z': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestampLTZ'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Date'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateTrunc'>>, 'DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Datetime'>>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeAdd'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeDiff'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeSub'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DatetimeTrunc'>>, 'DAY': <function MySQL.Parser.<lambda>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAYOFMONTH': <function MySQL.Parser.<lambda>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK': <function MySQL.Parser.<lambda>>, 'DAYOFWEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'ISODOW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeekIso'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DAYOFYEAR': <function MySQL.Parser.<lambda>>, 'DECODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decode'>>, 'DECODE_CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecodeCase'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DiToDate'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'ENDS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'ENDSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, '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'>>, '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'>>, 'FLOOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Floor'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase'>>, '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_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, 'GET_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GetExtract'>>, 'GREATEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Greatest'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'GROUPING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Grouping'>>, 'HEX': <function build_hex>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'IIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'INITCAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Initcap'>>, 'INLINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Inline'>>, 'INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Int64'>>, 'IS_ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsAscii'>>, 'IS_INF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'ISINF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'IS_NAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'ISNAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArray'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAgg'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayContains'>>, 'JSONB_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContains'>>, '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_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONCast'>>, 'J_S_O_N_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExists'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExtractArray'>>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONFormat'>>, 'J_S_O_N_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'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONTable'>>, 'JSON_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONType'>>, 'J_S_O_N_VALUE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONValueArray'>>, 'JUSTIFY_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyDays'>>, 'JUSTIFY_HOURS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyHours'>>, 'JUSTIFY_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyInterval'>>, 'LAG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lag'>>, 'LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Last'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastValue'>>, 'LEAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lead'>>, 'LEAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Least'>>, 'LEFT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Left'>>, 'LENGTH': <function MySQL.Parser.<lambda>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHAR_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHARACTER_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.List'>>, 'LN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ln'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LowerHex'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'MAKE_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MakeInterval'>>, 'MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Map'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MatchAgainst'>>, 'MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Max'>>, 'MEDIAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Median'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MONTH': <function MySQL.Parser.<lambda>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMALIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normalize'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, 'OBJECT_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectInsert'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Or'>>, 'OVERLAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Overlay'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseDatetime'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PARSE_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseTime'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_EXTRACT_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtractAll'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpILike'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'REGEXP_REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpReplace'>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpSplit'>>, 'REPEAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Repeat'>>, 'REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Replace'>>, 'REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reverse'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SOUNDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Soundex'>>, 'SPACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Space'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SPLIT_PART': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SplitPart'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'ST_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StDistance'>>, 'ST_POINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'ST_MAKEPOINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <function build_formatted_time.<locals>._builder>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToMap'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToTime'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.String'>>, 'STRING_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'SPLIT_BY_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRTOK_TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StringToArray'>>, 'STRUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Struct'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StructExtract'>>, 'STUFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stuff'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUBSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Substring'>>, 'SUBSTRING_INDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SubstringIndex'>>, 'SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sum'>>, 'TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Time'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeAdd'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeDiff'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToDate'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToTime'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToUnix'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSub'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToStr'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToUnix'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeTrunc'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Timestamp'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampAdd'>>, 'TIMESTAMPDIFF': <function build_date_delta.<locals>._builder>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampSub'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTrunc'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToArray'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase64'>>, 'TO_CHAR': <function build_formatted_time.<locals>._builder>, 'TO_DAYS': <function MySQL.Parser.<lambda>>, 'TO_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, 'TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToMap'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToNumber'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Transform'>>, 'TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Translate'>>, 'TRIM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Trim'>>, 'TRY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Try'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDiToDi'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsAdd'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsDiff'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDatetime'>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTime'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTimestamp'>>, 'TYPEOF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Typeof'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNICODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unicode'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_MICROS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMicros'>>, 'UNIX_MILLIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMillis'>>, 'UNIX_SECONDS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixSeconds'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToStr'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTime'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTimeStr'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'UUID_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'WEEK': <function MySQL.Parser.<lambda>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <function MySQL.Parser.<lambda>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Xor'>>, 'YEAR': <function MySQL.Parser.<lambda>>, 'ARRAYAGG': <function Parser.<lambda>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'STRPOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'CHARINDEX': <function Parser.<lambda>>, 'INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'LOCATE': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, '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>, 'FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'FROM_UNIXTIME': <function build_formatted_time.<locals>._builder>, 'ISNULL': <function isnull_to_is_null>, 'MAKETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'MONTHNAME': <function MySQL.Parser.<lambda>>, 'SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'TO_DATE': <function build_formatted_time.<locals>._builder>, 'TO_TIMESTAMP': <function build_formatted_time.<locals>._builder>, 'TIME_FORMAT': <function SingleStore.Parser.<lambda>>, 'UNIX_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'BSON_EXTRACT_BSON': <function build_json_extract_path.<locals>._builder>, 'BSON_EXTRACT_STRING': <function build_json_extract_path.<locals>._builder>, 'BSON_EXTRACT_DOUBLE': <function build_json_extract_path.<locals>._builder>, 'BSON_EXTRACT_BIGINT': <function build_json_extract_path.<locals>._builder>, 'JSON_EXTRACT_JSON': <function build_json_extract_path.<locals>._builder>, 'JSON_EXTRACT_STRING': <function build_json_extract_path.<locals>._builder>, 'JSON_EXTRACT_DOUBLE': <function build_json_extract_path.<locals>._builder>, 'JSON_EXTRACT_BIGINT': <function build_json_extract_path.<locals>._builder>}
COLUMN_OPERATORS =
{<TokenType.COLON_GT: 'COLON_GT'>: <function SingleStore.Parser.<lambda>>, <TokenType.NCOLON_GT: 'NCOLON_GT'>: <function SingleStore.Parser.<lambda>>, <TokenType.DCOLON: 'DCOLON'>: <function SingleStore.Parser.<lambda>>, <TokenType.DCOLONDOLLAR: 'DCOLONDOLLAR'>: <function SingleStore.Parser.<lambda>>, <TokenType.DCOLONPERCENT: 'DCOLONPERCENT'>: <function SingleStore.Parser.<lambda>>}
TABLE_ALIAS_TOKENS =
{<TokenType.UNIQUE: 'UNIQUE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.END: 'END'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.BLOB: 'BLOB'>, <TokenType.NESTED: 'NESTED'>, <TokenType.TIME: 'TIME'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.SOME: 'SOME'>, <TokenType.BINARY: 'BINARY'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.DATE: 'DATE'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.SET: 'SET'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.FINAL: 'FINAL'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.TAG: 'TAG'>, <TokenType.COPY: 'COPY'>, <TokenType.TEXT: 'TEXT'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.GET: 'GET'>, <TokenType.SHOW: 'SHOW'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.NEXT: 'NEXT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.JSON: 'JSON'>, <TokenType.MERGE: 'MERGE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TOP: 'TOP'>, <TokenType.MONEY: 'MONEY'>, <TokenType.ANY: 'ANY'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.UINT256: 'UINT256'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.TABLE: 'TABLE'>, <TokenType.CASE: 'CASE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.DELETE: 'DELETE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.CUBE: 'CUBE'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.NAME: 'NAME'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.INET: 'INET'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.MAP: 'MAP'>, <TokenType.CACHE: 'CACHE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.IS: 'IS'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.INT128: 'INT128'>, <TokenType.RANGE: 'RANGE'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.MODEL: 'MODEL'>, <TokenType.ENUM: 'ENUM'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.NULL: 'NULL'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.POINT: 'POINT'>, <TokenType.DIV: 'DIV'>, <TokenType.SUPER: 'SUPER'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.DESC: 'DESC'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.SEMI: 'SEMI'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.ROWS: 'ROWS'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.ROW: 'ROW'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.UINT: 'UINT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SINK: 'SINK'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.XML: 'XML'>, <TokenType.VAR: 'VAR'>, <TokenType.VOID: 'VOID'>, <TokenType.KILL: 'KILL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.INT: 'INT'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.FIRST: 'FIRST'>, <TokenType.ASC: 'ASC'>, <TokenType.FILTER: 'FILTER'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.TRUE: 'TRUE'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.YEAR: 'YEAR'>, <TokenType.ALL: 'ALL'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.BIT: 'BIT'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.STAGE: 'STAGE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.UUID: 'UUID'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.VIEW: 'VIEW'>, <TokenType.PUT: 'PUT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.RING: 'RING'>, <TokenType.LOAD: 'LOAD'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.LIST: 'LIST'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.INT256: 'INT256'>, <TokenType.USERDEFINED: 'USERDEFINED'>}
ID_VAR_TOKENS =
{<TokenType.UNIQUE: 'UNIQUE'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.END: 'END'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.BLOB: 'BLOB'>, <TokenType.NESTED: 'NESTED'>, <TokenType.TIME: 'TIME'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.FULL: 'FULL'>, <TokenType.SOME: 'SOME'>, <TokenType.BINARY: 'BINARY'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.DATE: 'DATE'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.SET: 'SET'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.FINAL: 'FINAL'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.TAG: 'TAG'>, <TokenType.COPY: 'COPY'>, <TokenType.TEXT: 'TEXT'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.ANTI: 'ANTI'>, <TokenType.GET: 'GET'>, <TokenType.SHOW: 'SHOW'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.NEXT: 'NEXT'>, <TokenType.IPV4: 'IPV4'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.JSON: 'JSON'>, <TokenType.MERGE: 'MERGE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TOP: 'TOP'>, <TokenType.MONEY: 'MONEY'>, <TokenType.ANY: 'ANY'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.UINT256: 'UINT256'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.TABLE: 'TABLE'>, <TokenType.CASE: 'CASE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.RENAME: 'RENAME'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.DELETE: 'DELETE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.CUBE: 'CUBE'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.NAME: 'NAME'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.INET: 'INET'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.MAP: 'MAP'>, <TokenType.CACHE: 'CACHE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.IS: 'IS'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.INT128: 'INT128'>, <TokenType.RANGE: 'RANGE'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.MODEL: 'MODEL'>, <TokenType.ENUM: 'ENUM'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.NULL: 'NULL'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.POINT: 'POINT'>, <TokenType.DIV: 'DIV'>, <TokenType.SUPER: 'SUPER'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.DESC: 'DESC'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.ASOF: 'ASOF'>, <TokenType.SEMI: 'SEMI'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.UINT128: 'UINT128'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.ROWS: 'ROWS'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.KEEP: 'KEEP'>, <TokenType.ROW: 'ROW'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.UINT: 'UINT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.SINK: 'SINK'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.XML: 'XML'>, <TokenType.VAR: 'VAR'>, <TokenType.VOID: 'VOID'>, <TokenType.KILL: 'KILL'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.INT: 'INT'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.FIRST: 'FIRST'>, <TokenType.ASC: 'ASC'>, <TokenType.FILTER: 'FILTER'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.TRUE: 'TRUE'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.YEAR: 'YEAR'>, <TokenType.ALL: 'ALL'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.CHAR: 'CHAR'>, <TokenType.BIT: 'BIT'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.STAGE: 'STAGE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.UUID: 'UUID'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.VIEW: 'VIEW'>, <TokenType.PUT: 'PUT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.USE: 'USE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.RING: 'RING'>, <TokenType.LOAD: 'LOAD'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.LEFT: 'LEFT'>, <TokenType.LIST: 'LIST'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.INT256: 'INT256'>, <TokenType.USERDEFINED: 'USERDEFINED'>}
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
- NO_PAREN_FUNCTIONS
- 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
- 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
- NULL_TOKENS
- UNNEST_OFFSET_ALIAS_TOKENS
- SELECT_START_TOKENS
- COPY_INTO_VARLEN_OPTIONS
- IS_JSON_PREDICATE_KIND
- ODBC_DATETIME_LITERALS
- ON_CONDITION_TOKENS
- PRIVILEGE_FOLLOW_TOKENS
- DESCRIBE_STYLES
- ANALYZE_STYLES
- ANALYZE_EXPRESSION_PARSERS
- PARTITION_KEYWORDS
- AMBIGUOUS_ALIAS_TOKENS
- RECURSIVE_CTE_SEARCH_KIND
- MODIFIABLES
- STRICT_CAST
- PREFIXED_PIVOT_COLUMNS
- IDENTIFY_PIVOT_STRINGS
- TABLESAMPLE_CSV
- DEFAULT_SAMPLING_METHOD
- SET_REQUIRES_ASSIGNMENT_DELIMITER
- TRIM_PATTERN_FIRST
- MODIFIERS_ATTACHED_TO_SET_OP
- SET_OP_MODIFIERS
- NO_PAREN_IF_COMMANDS
- JSON_ARROWS_REQUIRE_JSON_TYPE
- COLON_IS_VARIANT_EXTRACT
- SUPPORTS_IMPLICIT_UNNEST
- INTERVAL_SPANS
- WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
- OPTIONAL_ALIAS_TOKEN_CTE
- ALTER_RENAME_REQUIRES_COLUMN
- JOINS_HAVE_EQUAL_PRECEDENCE
- ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
- MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS
- JSON_EXTRACT_REQUIRES_JSON_EXPRESSION
- 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
- FUNCTION_PARSERS
- STATEMENT_PARSERS
- SHOW_PARSERS
- PROPERTY_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
123 class Generator(MySQL.Generator): 124 SUPPORTED_JSON_PATH_PARTS = { 125 exp.JSONPathKey, 126 exp.JSONPathRoot, 127 exp.JSONPathSubscript, 128 } 129 130 TRANSFORMS = { 131 **MySQL.Generator.TRANSFORMS, 132 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 133 exp.StrToTime: lambda self, e: self.func("TO_TIMESTAMP", e.this, self.format_time(e)), 134 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 135 exp.StrToDate: lambda self, e: self.func( 136 "STR_TO_DATE", 137 e.this, 138 self.format_time( 139 e, 140 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 141 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 142 ), 143 ), 144 exp.TimeToStr: lambda self, e: self.func( 145 "DATE_FORMAT", 146 e.this, 147 self.format_time( 148 e, 149 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 150 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 151 ), 152 ), 153 exp.Date: unsupported_args("zone", "expressions")(rename_func("DATE")), 154 exp.Cast: unsupported_args("format", "action", "default")( 155 lambda self, e: f"{self.sql(e, 'this')} :> {self.sql(e, 'to')}" 156 ), 157 exp.TryCast: unsupported_args("format", "action", "default")( 158 lambda self, e: f"{self.sql(e, 'this')} !:> {self.sql(e, 'to')}" 159 ), 160 exp.StrToUnix: unsupported_args("format")(rename_func("UNIX_TIMESTAMP")), 161 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 162 exp.TimeStrToUnix: rename_func("UNIX_TIMESTAMP"), 163 exp.UnixSeconds: rename_func("UNIX_TIMESTAMP"), 164 exp.UnixToStr: lambda self, e: self.func( 165 "FROM_UNIXTIME", 166 e.this, 167 self.format_time( 168 e, 169 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 170 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 171 ), 172 ), 173 exp.UnixToTime: unsupported_args("scale", "zone", "hours", "minutes")( 174 lambda self, e: self.func( 175 "FROM_UNIXTIME", 176 e.this, 177 self.format_time( 178 e, 179 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 180 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 181 ), 182 ), 183 ), 184 exp.UnixToTimeStr: lambda self, e: f"FROM_UNIXTIME({self.sql(e, 'this')}) :> TEXT", 185 exp.JSONExtract: unsupported_args( 186 "only_json_types", 187 "expressions", 188 "variant_extract", 189 "json_query", 190 "option", 191 "quote", 192 "on_condition", 193 "requires_json", 194 )(json_extract_segments("JSON_EXTRACT_JSON")), 195 exp.JSONBExtract: json_extract_segments("BSON_EXTRACT_BSON"), 196 exp.JSONPathKey: json_path_key_only_name, 197 exp.JSONPathSubscript: lambda self, e: self.json_path_part(e.this), 198 exp.JSONPathRoot: lambda *_: "", 199 } 200 TRANSFORMS.pop(exp.JSONExtractScalar) 201 TRANSFORMS.pop(exp.JSONPathFilter) 202 TRANSFORMS.pop(exp.JSONPathRecursive) 203 TRANSFORMS.pop(exp.JSONPathScript) 204 TRANSFORMS.pop(exp.JSONPathSelector) 205 TRANSFORMS.pop(exp.JSONPathSlice) 206 TRANSFORMS.pop(exp.JSONPathUnion) 207 TRANSFORMS.pop(exp.JSONPathWildcard) 208 209 # https://docs.singlestore.com/cloud/reference/sql-reference/restricted-keywords/list-of-restricted-keywords/ 210 RESERVED_KEYWORDS = { 211 "abs", 212 "absolute", 213 "access", 214 "account", 215 "acos", 216 "action", 217 "add", 218 "adddate", 219 "addtime", 220 "admin", 221 "aes_decrypt", 222 "aes_encrypt", 223 "after", 224 "against", 225 "aggregate", 226 "aggregates", 227 "aggregator", 228 "aggregator_id", 229 "aggregator_plan_hash", 230 "aggregators", 231 "algorithm", 232 "all", 233 "also", 234 "alter", 235 "always", 236 "analyse", 237 "analyze", 238 "and", 239 "anti_join", 240 "any", 241 "any_value", 242 "approx_count_distinct", 243 "approx_count_distinct_accumulate", 244 "approx_count_distinct_combine", 245 "approx_count_distinct_estimate", 246 "approx_geography_intersects", 247 "approx_percentile", 248 "arghistory", 249 "arrange", 250 "arrangement", 251 "array", 252 "as", 253 "asc", 254 "ascii", 255 "asensitive", 256 "asin", 257 "asm", 258 "assertion", 259 "assignment", 260 "ast", 261 "asymmetric", 262 "async", 263 "at", 264 "atan", 265 "atan2", 266 "attach", 267 "attribute", 268 "authorization", 269 "auto", 270 "auto_increment", 271 "auto_reprovision", 272 "autostats", 273 "autostats_cardinality_mode", 274 "autostats_enabled", 275 "autostats_histogram_mode", 276 "autostats_sampling", 277 "availability", 278 "avg", 279 "avg_row_length", 280 "avro", 281 "azure", 282 "background", 283 "_background_threads_for_cleanup", 284 "backup", 285 "backup_history", 286 "backup_id", 287 "backward", 288 "batch", 289 "batches", 290 "batch_interval", 291 "_batch_size_limit", 292 "before", 293 "begin", 294 "between", 295 "bigint", 296 "bin", 297 "binary", 298 "_binary", 299 "bit", 300 "bit_and", 301 "bit_count", 302 "bit_or", 303 "bit_xor", 304 "blob", 305 "bool", 306 "boolean", 307 "bootstrap", 308 "both", 309 "_bt", 310 "btree", 311 "bucket_count", 312 "by", 313 "byte", 314 "byte_length", 315 "cache", 316 "call", 317 "call_for_pipeline", 318 "called", 319 "capture", 320 "cascade", 321 "cascaded", 322 "case", 323 "cast", 324 "catalog", 325 "ceil", 326 "ceiling", 327 "chain", 328 "change", 329 "char", 330 "character", 331 "characteristics", 332 "character_length", 333 "char_length", 334 "charset", 335 "check", 336 "checkpoint", 337 "_check_can_connect", 338 "_check_consistency", 339 "checksum", 340 "_checksum", 341 "class", 342 "clear", 343 "client", 344 "client_found_rows", 345 "close", 346 "cluster", 347 "clustered", 348 "cnf", 349 "coalesce", 350 "coercibility", 351 "collate", 352 "collation", 353 "collect", 354 "column", 355 "columnar", 356 "columns", 357 "columnstore", 358 "columnstore_segment_rows", 359 "comment", 360 "comments", 361 "commit", 362 "committed", 363 "_commit_log_tail", 364 "committed", 365 "compact", 366 "compile", 367 "compressed", 368 "compression", 369 "concat", 370 "concat_ws", 371 "concurrent", 372 "concurrently", 373 "condition", 374 "configuration", 375 "connection", 376 "connection_id", 377 "connections", 378 "config", 379 "constraint", 380 "constraints", 381 "content", 382 "continue", 383 "_continue_replay", 384 "conv", 385 "conversion", 386 "convert", 387 "convert_tz", 388 "copy", 389 "_core", 390 "cos", 391 "cost", 392 "cot", 393 "count", 394 "create", 395 "credentials", 396 "cross", 397 "cube", 398 "csv", 399 "cume_dist", 400 "curdate", 401 "current", 402 "current_catalog", 403 "current_date", 404 "current_role", 405 "current_schema", 406 "current_security_groups", 407 "current_security_roles", 408 "current_time", 409 "current_timestamp", 410 "current_user", 411 "cursor", 412 "curtime", 413 "cycle", 414 "data", 415 "database", 416 "databases", 417 "date", 418 "date_add", 419 "datediff", 420 "date_format", 421 "date_sub", 422 "date_trunc", 423 "datetime", 424 "day", 425 "day_hour", 426 "day_microsecond", 427 "day_minute", 428 "dayname", 429 "dayofmonth", 430 "dayofweek", 431 "dayofyear", 432 "day_second", 433 "deallocate", 434 "dec", 435 "decimal", 436 "declare", 437 "decode", 438 "default", 439 "defaults", 440 "deferrable", 441 "deferred", 442 "defined", 443 "definer", 444 "degrees", 445 "delayed", 446 "delay_key_write", 447 "delete", 448 "delimiter", 449 "delimiters", 450 "dense_rank", 451 "desc", 452 "describe", 453 "detach", 454 "deterministic", 455 "dictionary", 456 "differential", 457 "directory", 458 "disable", 459 "discard", 460 "_disconnect", 461 "disk", 462 "distinct", 463 "distinctrow", 464 "distributed_joins", 465 "div", 466 "do", 467 "document", 468 "domain", 469 "dot_product", 470 "double", 471 "drop", 472 "_drop_profile", 473 "dual", 474 "dump", 475 "duplicate", 476 "dynamic", 477 "earliest", 478 "each", 479 "echo", 480 "election", 481 "else", 482 "elseif", 483 "elt", 484 "enable", 485 "enclosed", 486 "encoding", 487 "encrypted", 488 "end", 489 "engine", 490 "engines", 491 "enum", 492 "errors", 493 "escape", 494 "escaped", 495 "estimate", 496 "euclidean_distance", 497 "event", 498 "events", 499 "except", 500 "exclude", 501 "excluding", 502 "exclusive", 503 "execute", 504 "exists", 505 "exit", 506 "exp", 507 "explain", 508 "extended", 509 "extension", 510 "external", 511 "external_host", 512 "external_port", 513 "extract", 514 "extractor", 515 "extractors", 516 "extra_join", 517 "_failover", 518 "failed_login_attempts", 519 "failure", 520 "false", 521 "family", 522 "fault", 523 "fetch", 524 "field", 525 "fields", 526 "file", 527 "files", 528 "fill", 529 "first", 530 "first_value", 531 "fix_alter", 532 "fixed", 533 "float", 534 "float4", 535 "float8", 536 "floor", 537 "flush", 538 "following", 539 "for", 540 "force", 541 "force_compiled_mode", 542 "force_interpreter_mode", 543 "foreground", 544 "foreign", 545 "format", 546 "forward", 547 "found_rows", 548 "freeze", 549 "from", 550 "from_base64", 551 "from_days", 552 "from_unixtime", 553 "fs", 554 "_fsync", 555 "full", 556 "fulltext", 557 "function", 558 "functions", 559 "gc", 560 "gcs", 561 "get_format", 562 "_gc", 563 "_gcx", 564 "generate", 565 "geography", 566 "geography_area", 567 "geography_contains", 568 "geography_distance", 569 "geography_intersects", 570 "geography_latitude", 571 "geography_length", 572 "geography_longitude", 573 "geographypoint", 574 "geography_point", 575 "geography_within_distance", 576 "geometry", 577 "geometry_area", 578 "geometry_contains", 579 "geometry_distance", 580 "geometry_filter", 581 "geometry_intersects", 582 "geometry_length", 583 "geometrypoint", 584 "geometry_point", 585 "geometry_within_distance", 586 "geometry_x", 587 "geometry_y", 588 "global", 589 "_global_version_timestamp", 590 "grant", 591 "granted", 592 "grants", 593 "greatest", 594 "group", 595 "grouping", 596 "groups", 597 "group_concat", 598 "gzip", 599 "handle", 600 "handler", 601 "hard_cpu_limit_percentage", 602 "hash", 603 "has_temp_tables", 604 "having", 605 "hdfs", 606 "header", 607 "heartbeat_no_logging", 608 "hex", 609 "highlight", 610 "high_priority", 611 "hold", 612 "holding", 613 "host", 614 "hosts", 615 "hour", 616 "hour_microsecond", 617 "hour_minute", 618 "hour_second", 619 "identified", 620 "identity", 621 "if", 622 "ifnull", 623 "ignore", 624 "ilike", 625 "immediate", 626 "immutable", 627 "implicit", 628 "import", 629 "in", 630 "including", 631 "increment", 632 "incremental", 633 "index", 634 "indexes", 635 "inet_aton", 636 "inet_ntoa", 637 "inet6_aton", 638 "inet6_ntoa", 639 "infile", 640 "inherit", 641 "inherits", 642 "_init_profile", 643 "init", 644 "initcap", 645 "initialize", 646 "initially", 647 "inject", 648 "inline", 649 "inner", 650 "inout", 651 "input", 652 "insensitive", 653 "insert", 654 "insert_method", 655 "instance", 656 "instead", 657 "instr", 658 "int", 659 "int1", 660 "int2", 661 "int3", 662 "int4", 663 "int8", 664 "integer", 665 "_internal_dynamic_typecast", 666 "interpreter_mode", 667 "intersect", 668 "interval", 669 "into", 670 "invoker", 671 "is", 672 "isnull", 673 "isolation", 674 "iterate", 675 "join", 676 "json", 677 "json_agg", 678 "json_array_contains_double", 679 "json_array_contains_json", 680 "json_array_contains_string", 681 "json_array_push_double", 682 "json_array_push_json", 683 "json_array_push_string", 684 "json_delete_key", 685 "json_extract_double", 686 "json_extract_json", 687 "json_extract_string", 688 "json_extract_bigint", 689 "json_get_type", 690 "json_length", 691 "json_set_double", 692 "json_set_json", 693 "json_set_string", 694 "json_splice_double", 695 "json_splice_json", 696 "json_splice_string", 697 "kafka", 698 "key", 699 "key_block_size", 700 "keys", 701 "kill", 702 "killall", 703 "label", 704 "lag", 705 "language", 706 "large", 707 "last", 708 "last_day", 709 "last_insert_id", 710 "last_value", 711 "lateral", 712 "latest", 713 "lc_collate", 714 "lc_ctype", 715 "lcase", 716 "lead", 717 "leading", 718 "leaf", 719 "leakproof", 720 "least", 721 "leave", 722 "leaves", 723 "left", 724 "length", 725 "level", 726 "license", 727 "like", 728 "limit", 729 "lines", 730 "listen", 731 "llvm", 732 "ln", 733 "load", 734 "loaddata_where", 735 "_load", 736 "local", 737 "localtime", 738 "localtimestamp", 739 "locate", 740 "location", 741 "lock", 742 "log", 743 "log10", 744 "log2", 745 "long", 746 "longblob", 747 "longtext", 748 "loop", 749 "lower", 750 "low_priority", 751 "lpad", 752 "_ls", 753 "ltrim", 754 "lz4", 755 "management", 756 "_management_thread", 757 "mapping", 758 "master", 759 "match", 760 "materialized", 761 "max", 762 "maxvalue", 763 "max_concurrency", 764 "max_errors", 765 "max_partitions_per_batch", 766 "max_queue_depth", 767 "max_retries_per_batch_partition", 768 "max_rows", 769 "mbc", 770 "md5", 771 "mpl", 772 "median", 773 "mediumblob", 774 "mediumint", 775 "mediumtext", 776 "member", 777 "memory", 778 "memory_percentage", 779 "_memsql_table_id_lookup", 780 "memsql", 781 "memsql_deserialize", 782 "memsql_imitating_kafka", 783 "memsql_serialize", 784 "merge", 785 "metadata", 786 "microsecond", 787 "middleint", 788 "min", 789 "min_rows", 790 "minus", 791 "minute", 792 "minute_microsecond", 793 "minute_second", 794 "minvalue", 795 "mod", 796 "mode", 797 "model", 798 "modifies", 799 "modify", 800 "month", 801 "monthname", 802 "months_between", 803 "move", 804 "mpl", 805 "names", 806 "named", 807 "namespace", 808 "national", 809 "natural", 810 "nchar", 811 "next", 812 "no", 813 "node", 814 "none", 815 "no_query_rewrite", 816 "noparam", 817 "not", 818 "nothing", 819 "notify", 820 "now", 821 "nowait", 822 "no_write_to_binlog", 823 "no_query_rewrite", 824 "norely", 825 "nth_value", 826 "ntile", 827 "null", 828 "nullcols", 829 "nullif", 830 "nulls", 831 "numeric", 832 "nvarchar", 833 "object", 834 "octet_length", 835 "of", 836 "off", 837 "offline", 838 "offset", 839 "offsets", 840 "oids", 841 "on", 842 "online", 843 "only", 844 "open", 845 "operator", 846 "optimization", 847 "optimize", 848 "optimizer", 849 "optimizer_state", 850 "option", 851 "options", 852 "optionally", 853 "or", 854 "order", 855 "ordered_serialize", 856 "orphan", 857 "out", 858 "out_of_order", 859 "outer", 860 "outfile", 861 "over", 862 "overlaps", 863 "overlay", 864 "owned", 865 "owner", 866 "pack_keys", 867 "paired", 868 "parser", 869 "parquet", 870 "partial", 871 "partition", 872 "partition_id", 873 "partitioning", 874 "partitions", 875 "passing", 876 "password", 877 "password_lock_time", 878 "parser", 879 "pause", 880 "_pause_replay", 881 "percent_rank", 882 "percentile_cont", 883 "percentile_disc", 884 "periodic", 885 "persisted", 886 "pi", 887 "pipeline", 888 "pipelines", 889 "pivot", 890 "placing", 891 "plan", 892 "plans", 893 "plancache", 894 "plugins", 895 "pool", 896 "pools", 897 "port", 898 "position", 899 "pow", 900 "power", 901 "preceding", 902 "precision", 903 "prepare", 904 "prepared", 905 "preserve", 906 "primary", 907 "prior", 908 "privileges", 909 "procedural", 910 "procedure", 911 "procedures", 912 "process", 913 "processlist", 914 "profile", 915 "profiles", 916 "program", 917 "promote", 918 "proxy", 919 "purge", 920 "quarter", 921 "queries", 922 "query", 923 "query_timeout", 924 "queue", 925 "quote", 926 "radians", 927 "rand", 928 "range", 929 "rank", 930 "read", 931 "_read", 932 "reads", 933 "real", 934 "reassign", 935 "rebalance", 936 "recheck", 937 "record", 938 "recursive", 939 "redundancy", 940 "redundant", 941 "ref", 942 "reference", 943 "references", 944 "refresh", 945 "regexp", 946 "reindex", 947 "relative", 948 "release", 949 "reload", 950 "rely", 951 "remote", 952 "remove", 953 "rename", 954 "repair", 955 "_repair_table", 956 "repeat", 957 "repeatable", 958 "_repl", 959 "_reprovisioning", 960 "replace", 961 "replica", 962 "replicate", 963 "replicating", 964 "replication", 965 "durability", 966 "require", 967 "resource", 968 "resource_pool", 969 "reset", 970 "restart", 971 "restore", 972 "restrict", 973 "result", 974 "_resurrect", 975 "retry", 976 "return", 977 "returning", 978 "returns", 979 "reverse", 980 "revoke", 981 "rg_pool", 982 "right", 983 "right_anti_join", 984 "right_semi_join", 985 "right_straight_join", 986 "rlike", 987 "role", 988 "roles", 989 "rollback", 990 "rollup", 991 "round", 992 "routine", 993 "row", 994 "row_count", 995 "row_format", 996 "row_number", 997 "rows", 998 "rowstore", 999 "rule", 1000 "rpad", 1001 "_rpc", 1002 "rtrim", 1003 "running", 1004 "s3", 1005 "safe", 1006 "save", 1007 "savepoint", 1008 "scalar", 1009 "schema", 1010 "schemas", 1011 "schema_binding", 1012 "scroll", 1013 "search", 1014 "second", 1015 "second_microsecond", 1016 "sec_to_time", 1017 "security", 1018 "select", 1019 "semi_join", 1020 "_send_threads", 1021 "sensitive", 1022 "separator", 1023 "sequence", 1024 "sequences", 1025 "serial", 1026 "serializable", 1027 "series", 1028 "service_user", 1029 "server", 1030 "session", 1031 "session_user", 1032 "set", 1033 "setof", 1034 "security_lists_intersect", 1035 "sha", 1036 "sha1", 1037 "sha2", 1038 "shard", 1039 "sharded", 1040 "sharded_id", 1041 "share", 1042 "show", 1043 "shutdown", 1044 "sigmoid", 1045 "sign", 1046 "signal", 1047 "similar", 1048 "simple", 1049 "site", 1050 "signed", 1051 "sin", 1052 "skip", 1053 "skipped_batches", 1054 "sleep", 1055 "_sleep", 1056 "smallint", 1057 "snapshot", 1058 "_snapshot", 1059 "_snapshots", 1060 "soft_cpu_limit_percentage", 1061 "some", 1062 "soname", 1063 "sparse", 1064 "spatial", 1065 "spatial_check_index", 1066 "specific", 1067 "split", 1068 "sql", 1069 "sql_big_result", 1070 "sql_buffer_result", 1071 "sql_cache", 1072 "sql_calc_found_rows", 1073 "sqlexception", 1074 "sql_mode", 1075 "sql_no_cache", 1076 "sql_no_logging", 1077 "sql_small_result", 1078 "sqlstate", 1079 "sqlwarning", 1080 "sqrt", 1081 "ssl", 1082 "stable", 1083 "standalone", 1084 "start", 1085 "starting", 1086 "state", 1087 "statement", 1088 "statistics", 1089 "stats", 1090 "status", 1091 "std", 1092 "stddev", 1093 "stddev_pop", 1094 "stddev_samp", 1095 "stdin", 1096 "stdout", 1097 "stop", 1098 "storage", 1099 "str_to_date", 1100 "straight_join", 1101 "strict", 1102 "string", 1103 "strip", 1104 "subdate", 1105 "substr", 1106 "substring", 1107 "substring_index", 1108 "success", 1109 "sum", 1110 "super", 1111 "symmetric", 1112 "sync_snapshot", 1113 "sync", 1114 "_sync", 1115 "_sync2", 1116 "_sync_partitions", 1117 "_sync_snapshot", 1118 "synchronize", 1119 "sysid", 1120 "system", 1121 "table", 1122 "table_checksum", 1123 "tables", 1124 "tablespace", 1125 "tags", 1126 "tan", 1127 "target_size", 1128 "task", 1129 "temp", 1130 "template", 1131 "temporary", 1132 "temptable", 1133 "_term_bump", 1134 "terminate", 1135 "terminated", 1136 "test", 1137 "text", 1138 "then", 1139 "time", 1140 "timediff", 1141 "time_bucket", 1142 "time_format", 1143 "timeout", 1144 "timestamp", 1145 "timestampadd", 1146 "timestampdiff", 1147 "timezone", 1148 "time_to_sec", 1149 "tinyblob", 1150 "tinyint", 1151 "tinytext", 1152 "to", 1153 "to_base64", 1154 "to_char", 1155 "to_date", 1156 "to_days", 1157 "to_json", 1158 "to_number", 1159 "to_seconds", 1160 "to_timestamp", 1161 "tracelogs", 1162 "traditional", 1163 "trailing", 1164 "transform", 1165 "transaction", 1166 "_transactions_experimental", 1167 "treat", 1168 "trigger", 1169 "triggers", 1170 "trim", 1171 "true", 1172 "trunc", 1173 "truncate", 1174 "trusted", 1175 "two_phase", 1176 "_twopcid", 1177 "type", 1178 "types", 1179 "ucase", 1180 "unbounded", 1181 "uncommitted", 1182 "undefined", 1183 "undo", 1184 "unencrypted", 1185 "unenforced", 1186 "unhex", 1187 "unhold", 1188 "unicode", 1189 "union", 1190 "unique", 1191 "_unittest", 1192 "unix_timestamp", 1193 "unknown", 1194 "unlisten", 1195 "_unload", 1196 "unlock", 1197 "unlogged", 1198 "unpivot", 1199 "unsigned", 1200 "until", 1201 "update", 1202 "upgrade", 1203 "upper", 1204 "usage", 1205 "use", 1206 "user", 1207 "users", 1208 "using", 1209 "utc_date", 1210 "utc_time", 1211 "utc_timestamp", 1212 "_utf8", 1213 "vacuum", 1214 "valid", 1215 "validate", 1216 "validator", 1217 "value", 1218 "values", 1219 "varbinary", 1220 "varchar", 1221 "varcharacter", 1222 "variables", 1223 "variadic", 1224 "variance", 1225 "var_pop", 1226 "var_samp", 1227 "varying", 1228 "vector_sub", 1229 "verbose", 1230 "version", 1231 "view", 1232 "void", 1233 "volatile", 1234 "voting", 1235 "wait", 1236 "_wake", 1237 "warnings", 1238 "week", 1239 "weekday", 1240 "weekofyear", 1241 "when", 1242 "where", 1243 "while", 1244 "whitespace", 1245 "window", 1246 "with", 1247 "without", 1248 "within", 1249 "_wm_heartbeat", 1250 "work", 1251 "workload", 1252 "wrapper", 1253 "write", 1254 "xact_id", 1255 "xor", 1256 "year", 1257 "year_month", 1258 "yes", 1259 "zerofill", 1260 "zone", 1261 } 1262 1263 def jsonextractscalar_sql(self, expression: exp.JSONExtractScalar) -> str: 1264 json_type = expression.args.get("json_type") 1265 func_name = "JSON_EXTRACT_JSON" if json_type is None else f"JSON_EXTRACT_{json_type}" 1266 return json_extract_segments(func_name)(self, expression) 1267 1268 def jsonbextractscalar_sql(self, expression: exp.JSONBExtractScalar) -> str: 1269 json_type = expression.args.get("json_type") 1270 func_name = "BSON_EXTRACT_BSON" if json_type is None else f"BSON_EXTRACT_{json_type}" 1271 return json_extract_segments(func_name)(self, expression) 1272 1273 def jsonextractarray_sql(self, expression: exp.JSONExtractArray) -> str: 1274 self.unsupported("Arrays are not supported in SingleStore") 1275 return self.function_fallback_sql(expression) 1276 1277 @unsupported_args("on_condition") 1278 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1279 res: exp.Expression = exp.JSONExtractScalar( 1280 this=expression.this, 1281 expression=expression.args.get("path"), 1282 json_type="STRING", 1283 ) 1284 1285 returning = expression.args.get("returning") 1286 if returning is not None: 1287 res = exp.Cast(this=res, to=returning) 1288 1289 return self.sql(res)
Generator converts a given syntax tree to the corresponding SQL string.
Arguments:
- pretty: Whether to format the produced SQL string. Default: False.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True or 'always': Always quote. 'safe': Only quote identifiers that are case insensitive.
- normalize: Whether to normalize identifiers to lowercase. Default: False.
- pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
- indent: The indentation size in a formatted string. For example, this affects the
indentation of subqueries and filters under a
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
SUPPORTED_JSON_PATH_PARTS =
{<class 'sqlglot.expressions.JSONPathSubscript'>, <class 'sqlglot.expressions.JSONPathKey'>, <class 'sqlglot.expressions.JSONPathRoot'>}
TRANSFORMS =
{<class 'sqlglot.expressions.JSONPathKey'>: <function json_path_key_only_name>, <class 'sqlglot.expressions.JSONPathRoot'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function SingleStore.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.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.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionedByBucket'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionByTruncate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PositionalColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Put'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TableColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Union'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingTemplateProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingData'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Uuid'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WeekStart'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CurrentDate'>: <function no_paren_current_date_sql>, <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 _date_trunc_sql>, <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 MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.ILike'>: <function no_ilike_sql>, <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 SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.StrToTime'>: <function SingleStore.Generator.<lambda>>, <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 SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Trim'>: <function trim_sql>, <class 'sqlglot.expressions.TryCast'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDsAdd'>: <function date_add_sql.<locals>.func>, <class 'sqlglot.expressions.TsOrDsDiff'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDsToDate'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Unicode'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.UnixToTime'>: <function SingleStore.Generator.<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.ToChar'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Date'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Cast'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.StrToUnix'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TimeToUnix'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.UnixSeconds'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.UnixToStr'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.UnixToTimeStr'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.JSONExtract'>: <function json_extract_segments.<locals>._json_extract_segments>, <class 'sqlglot.expressions.JSONBExtract'>: <function json_extract_segments.<locals>._json_extract_segments>}
RESERVED_KEYWORDS =
{'geometry_within_distance', 'option', 'geography_contains', '_read', 'json_extract_json', 'privileges', 'begin', 'blob', 'localtime', 'dayname', 'exclusive', 'identified', 'search', 'storage', 'float', 'replicating', 'procedures', 'proxy', 'preserve', 'voting', 'delayed', 'ignore', 'ilike', 'null', 'mbc', 'comments', 'inline', 'online', 'int3', 'language', 'geometry_area', 'extractor', '_global_version_timestamp', 'procedural', 'asm', 'minute_second', 's3', 'week', 'type', 'exists', 'left', '_rpc', 'action', 'check', 'char_length', 'leaf', 'upgrade', 'latest', 'status', 'nulls', 'temptable', 'any_value', 'incremental', 'where', 'charset', 'nowait', 'mediumtext', 'memory_percentage', 'notify', 'discard', 'lead', 'fixed', 'global', 'limit', 'max_rows', 'mode', 'current_schema', 'revoke', 'copy', 'collect', 'valid', 'hdfs', 'primary', 'months_between', 'current', 'inet6_ntoa', 'while', 'stats', 'json_extract_bigint', '_repl', 'loop', 'inherit', 'analyse', 'json_splice_json', 'now', 'round', 'leaves', 'nchar', 'varchar', 'varying', 'result', 'signed', '_check_can_connect', 'stddev_samp', 'index', 'max_partitions_per_batch', 'record', 'ast', 'collation', 'memsql_deserialize', 'prior', 'redundancy', 'transform', 'json_set_double', '_sync_partitions', 'dump', 'dictionary', 'day_microsecond', 'checksum', 'statement', 'text', 'azure', 'overlay', 'open', 'bootstrap', 'concurrently', 'mpl', 'sql_no_logging', 'orphan', 'role', 'ntile', 'schema', 'listen', 'geometrypoint', 'varcharacter', 'minvalue', 'values', 'sequence', 'geometry_filter', 'day_minute', 'replica', 'array', 'outfile', 'convert', 'relative', 'fs', '_sync', 'sqlwarning', 'rowstore', 'earliest', 'float8', 'restore', 'inner', 'numeric', 'lcase', 'json_delete_key', 'rename', 'time_to_sec', 'persisted', 'dayofyear', 'interval', 'decode', 'duplicate', 'minus', 'autostats_histogram_mode', 'rank', 'rg_pool', 'character_length', 'nvarchar', 'types', 'integer', 'unencrypted', 'div', 'unbounded', 'unpivot', 'prepared', 'unicode', 'data', 'atan2', 'initially', 'usage', 'spatial', 'if', 'pow', 'scalar', 'columnstore_segment_rows', 'to_char', 'addtime', 'handle', 'longblob', 'national', 'election', 'to_base64', 'engine', 'curdate', 'default', 'input', 'json_length', 'ltrim', 'ceil', 'extension', 'oids', 'strip', 'no_write_to_binlog', '_memsql_table_id_lookup', 'update', 'sysid', 'str_to_date', 'json_splice_double', 'int', 'timezone', 'using', 'constraints', 'case', 'euclidean_distance', '_reprovisioning', 'grouping', 'log10', 'until', 'cross', 'arrange', 'yes', 'trailing', 'tablespace', 'clustered', 'cycle', 'byte', 'write', 'log2', 'admin', 'sql_buffer_result', 'row', 'directory', 'distinctrow', 'local', 'substring_index', 'avg_row_length', 'maxvalue', 'ordered_serialize', 'pi', 'adddate', 'current_time', 'locate', 'document', 'var_samp', 'autostats', 'password_lock_time', 'some', 'date_format', 'stdout', 'autostats_sampling', 'wait', 'bucket_count', 'deallocate', 'server', 'octet_length', 'approx_count_distinct_combine', 'async', '_continue_replay', 'concurrent', 'fields', 'aggregator', 'lag', 'return', 'floor', 'sql_cache', 'tinyblob', 'session', 'shutdown', 'cot', 'current_role', 'iterate', 'json_array_push_double', 'percent_rank', 'weekofyear', 'abs', 'assertion', 'substring', 'unsigned', 'anti_join', 'optimizer', 'inout', 'greatest', 'json_array_contains_string', 'match', 'generate', '_drop_profile', 'refresh', 'super', 'optimize', 'extractors', 'import', 'having', 'sqlexception', 'fetch', 'skipped_batches', 'pause', 'day_second', '_binary', 'move', 'current_security_roles', 'any', 'date_sub', 'mediumint', 'avg', 'convert_tz', 'as', 'aggregate', 'offset', 'trunc', 'deferred', 'processlist', 'query', 'force_compiled_mode', 'release', 'temp', 'columns', '_failover', 'plugins', 'natural', 'plancache', 'geometry_x', 'datediff', 'autostats_enabled', 'except', 'replication', 'least', 'triggers', 'int1', 'owned', 'json_array_contains_json', 'schema_binding', 'full', 'from_days', 'cache', '_background_threads_for_cleanup', 'client', 'configuration', '_commit_log_tail', 'lc_collate', 'all', 'sync', 'union', 'timestampdiff', 'merge', 'to_days', 'partial', 'arghistory', '_gcx', 'nothing', 'config', 'sensitive', 'coalesce', 'mediumblob', 'stddev_pop', 'to_timestamp', 'extended', 'purge', 'ref', 'remote', 'overlaps', 'failed_login_attempts', 'wrapper', 'gzip', 'autostats_cardinality_mode', 'compressed', 'key_block_size', 'cursor', 'out', 'atan', 'retry', 'last', 'date', 'end', 'auto_increment', 'instead', 'profiles', 'json_set_json', 'rollback', 'management', 'test', '_disconnect', 'drop', 'start', 'value', 'variance', 'statistics', 'double', 'sync_snapshot', 'distinct', 'disable', 'partition', 'aes_decrypt', 'order', 'json_agg', 'require', 'estimate', 'instr', 'nth_value', 'rows', 'insert_method', 'alter', 'cast', 'collate', 'preceding', 'backup', 'owner', 'aggregator_id', 'unique', 'backward', 'large', '_wm_heartbeat', 'current_timestamp', 'exp', '_term_bump', 'variables', 'inet_aton', 'sql', 'asensitive', 'spatial_check_index', 'unhold', 'unenforced', 'hex', 'reverse', 'batch_interval', 'commit', 'min', 'right_semi_join', 'approx_percentile', 'functions', 'service_user', 'hour', 'format', 'dense_rank', 'stdin', 'dec', '_snapshots', 'infile', 'foreign', 'freeze', 'monthname', 'datetime', 'fix_alter', '_init_profile', '_resurrect', 'setof', 'routine', 'comment', 'partitioning', 'to_json', 'algorithm', 'availability', 'version', 'geometry_length', 'int8', 'events', 'increment', 'then', 'column', 'json_extract_string', 'exit', 'without', 'geography_latitude', '_gc', 'fault', 'off', 'external_port', 'failure', 'resource', 'tags', 'backup_history', 'reference', 'create', 'asymmetric', 'immediate', 'condition', 'dual', 'content', 'grants', 'simple', 'including', 'set', 'max_retries_per_batch_partition', 'regexp', 'key', 'with', 'timestampadd', 'min_rows', 'resource_pool', 'compact', 'session_user', 'sql_mode', 'offline', 'bin', 'instance', 'from_base64', 'process', 'close', 'model', 'geographypoint', 'unlogged', 'restrict', 'node', 'approx_count_distinct', 'repair', 'echo', 'bit_count', 'files', 'soft_cpu_limit_percentage', 'external_host', 'users', 'program', 'modifies', 'tan', 'inherits', 'view', 'trusted', 'approx_count_distinct_accumulate', 'timeout', 'outer', 'max', 'table_checksum', 'geography_distance', '_utf8', 'hard_cpu_limit_percentage', 'add', 'attribute', 'sha2', 'table', 'bit', 'two_phase', 'asin', 'isolation', 'string', 'weekday', 'metadata', 'partitions', 'master', 'rebalance', 'recursive', 'tracelogs', 'timediff', 'force', 'within', 'zerofill', '_checksum', 'current_date', 'initialize', 'compile', 'for', 'describe', '_unittest', 'passing', 'geography_area', 'desc', 'reindex', 'encoding', 'found_rows', 'running', 'first', 'geometry_distance', 'change', 'group_concat', 'middleint', 'tables', 'approx_geography_intersects', 'terminated', 'rollup', 'cascade', 'elseif', 'log', 'utc_time', '_check_consistency', 'invoker', 'geography_intersects', 'is', 'isnull', 'and', 'excluding', 'account', 'strict', 'time_bucket', 'shard', 'sequences', 'geography_length', 'coercibility', 'template', 'treat', 'encrypted', 'ascii', 'database', 'replace', 'skip', 'file', 'power', 'btree', 'undo', 'columnar', 'arrangement', 'parser', 'md5', 'stable', 'unlock', 'initcap', 'plans', 'differential', 'characteristics', 'named', 'microsecond', 'smallint', 'vacuum', 'geometry', 'similar', 'quote', 'longtext', 'execute', 'repeat', 'geography_longitude', 'json', 'killall', 'percentile_disc', 'trim', 'ceiling', 'whitespace', 'sum', 'indexes', 'inet6_aton', 'security_lists_intersect', 'concat', 'extract', 'group', 'paired', 'do', 'int4', 'dayofmonth', 'committed', 'real', 'header', 'semi_join', 'heartbeat_no_logging', '_transactions_experimental', 'from', 'distributed_joins', 'both', 'max_errors', 'geography_point', 'high_priority', 'task', 'engines', 'zone', 'background', 'reads', 'warnings', 'subdate', 'year', 'analyze', 'cos', 'else', 'intersect', 'to_seconds', '_send_threads', 'sharded_id', 'batches', 'minute_microsecond', 'pipelines', 'materialized', 'procedure', 'gcs', '_wake', 'second_microsecond', 'sparse', 'when', 'enclosed', 'float4', '_management_thread', '_sync2', 'sqlstate', 'domain', 'second', 'enum', 'authorization', 'save', 'true', 'each', 'like', 'rpad', 'call_for_pipeline', 'names', 'upper', 'references', 'pipeline', 'current_user', 'max_queue_depth', 'by', '_core', 'undefined', 'terminate', 'columnstore', 'current_security_groups', 'synchronize', 'member', 'offsets', 'cascaded', 'specific', 'std', 'groups', 'roles', 'starting', 'kafka', 'capture', 'over', 'date_trunc', 'user', 'query_timeout', 'csv', 'precision', 'catalog', 'conversion', 'escaped', 'series', 'between', 'repeatable', 'schemas', '_sync_snapshot', 'queries', 'detach', 'uncommitted', 'sleep', 'chain', 'sha', 'after', 'snapshot', 'success', 'stddev', 'event', 'signal', 'conv', 'geometry_y', 'inet_ntoa', 'durability', 'batch', 'last_day', 'temporary', 'dayofweek', 'connections', 'hour_second', 'defaults', 'out_of_order', 'decimal', 'foreground', 'rely', 'geometry_point', 'void', 'returning', 'day_hour', 'right', 'geometry_intersects', 'geography_within_distance', 'share', 'to_number', 'into', 'tinytext', 'ln', 'optimizer_state', 'traditional', 'prepare', 'sec_to_time', 'insensitive', 'straight_join', 'level', 'lc_ctype', 'forward', 'from_unixtime', 'deferrable', 'operator', 'radians', 'bit_and', 'lines', 'validate', 'continue', 'password', 'placing', 'defined', 'xor', 'always', '_repair_table', 'truncate', 'boolean', 'restart', 'safe', 'flush', 'none', 'var_pop', 'fulltext', 'parquet', 'granted', 'lock', 'llvm', 'on', 'remove', 'approx_count_distinct_estimate', 'localtimestamp', 'leakproof', 'sign', 'client_found_rows', 'savepoint', 'stop', 'redundant', 'sin', 'implicit', 'standalone', 'lateral', 'vector_sub', 'range', 'concat_ws', '_sleep', 'interpreter_mode', 'first_value', 'deterministic', 'kill', 'delete', 'in', 'unhex', '_pause_replay', 'errors', 'port', 'json_array_push_string', 'keys', 'following', 'sql_calc_found_rows', 'rule', 'aggregators', 'auto_reprovision', 'connection_id', 'workload', 'rand', 'time_format', 'quarter', 'acos', 'ucase', 'external', 'namespace', 'hold', 'checkpoint', 'xact_id', 'assignment', 'validator', 'show', 'sql_big_result', 'json_set_string', 'verbose', 'soname', 'split', 'escape', 'object', 'compression', 'extra_join', 'reset', 'also', 'declare', '_fsync', 'position', 'delimiters', 'options', 'pools', 'byte_length', 'ifnull', 'lpad', 'aggregator_plan_hash', 'norely', 'work', 'substr', 'memsql_serialize', 'insert', 'plan', 'memsql_imitating_kafka', 'nullcols', 'auto', 'leading', 'against', 'credentials', 'access', 'not', 'force_interpreter_mode', 'unix_timestamp', 'hash', 'has_temp_tables', 'databases', 'lz4', 'minute', 'row_number', 'state', 'int2', 'month', '_ls', 'absolute', 'false', 'bool', 'constraint', 'only', 'mapping', 'avro', 'inject', 'cluster', 'loaddata_where', 'rlike', 'lower', 'json_splice_string', 'sql_no_cache', 'aes_encrypt', '_load', 'optimization', 'site', 'fill', 'sha1', 'recheck', 'init', 'location', 'length', 'next', 'json_array_contains_double', 'delimiter', 'pivot', 'identity', 'cnf', 'hour_microsecond', 'delay_key_write', 'dot_product', 'sigmoid', 'of', 'curtime', 'to_date', 'family', 'cume_dist', 'modify', 'window', 'backup_id', 'degrees', 'right_straight_join', 'call', 'aggregates', 'attach', 'partition_id', 'symmetric', 'ssl', 'license', 'disk', 'date_add', 'trigger', 'definer', 'grant', 'pack_keys', 'hour_minute', 'to', 'handler', 'scroll', 'noparam', 'count', 'percentile_cont', 'transaction', 'enable', 'max_concurrency', 'utc_date', 'varbinary', 'replicate', 'mod', 'row_count', 'pool', 'memory', 'queue', 'class', 'right_anti_join', 'explain', 'returns', 'join', 'no_query_rewrite', 'unlisten', 'geography', 'memsql', 'connection', 'periodic', 'json_get_type', '_twopcid', 'last_insert_id', 'serial', 'nullif', 'profile', '_batch_size_limit', 'host', 'row_format', 'time', 'serializable', 'volatile', 'exclude', 'cost', 'separator', 'sharded', 'rtrim', 'bigint', 'json_array_push_json', 'holding', 'leave', 'sql_small_result', 'unknown', 'field', 'geometry_contains', 'hosts', 'system', 'before', 'highlight', 'clear', 'tinyint', 'binary', 'use', '_bt', 'sqrt', '_snapshot', 'char', 'cube', 'function', 'label', 'reload', '_unload', 'select', 'year_month', 'or', 'dynamic', 'no', 'gc', 'called', 'character', 'current_catalog', 'long', 'target_size', 'immutable', 'read', 'security', 'bit_or', 'utc_timestamp', 'promote', 'json_extract_double', 'bit_xor', 'variadic', 'at', 'get_format', 'timestamp', '_internal_dynamic_typecast', 'last_value', 'optionally', 'elt', 'median', 'asc', 'low_priority', 'day', 'load', 'reassign'}
@unsupported_args('on_condition')
def
jsonvalue_sql(self, expression: sqlglot.expressions.JSONValue) -> str:
1277 @unsupported_args("on_condition") 1278 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1279 res: exp.Expression = exp.JSONExtractScalar( 1280 this=expression.this, 1281 expression=expression.args.get("path"), 1282 json_type="STRING", 1283 ) 1284 1285 returning = expression.args.get("returning") 1286 if returning is not None: 1287 res = exp.Cast(this=res, to=returning) 1288 1289 return self.sql(res)
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
- RENAME_TABLE_WITH_DB
- GROUPINGS_SEP
- INDEX_ON
- QUERY_HINTS
- IS_BOOL_ALLOWED
- LIMIT_IS_TOP
- RETURNING_END
- EXTRACT_ALLOWS_QUOTES
- TZ_TO_WITH_TIME_ZONE
- ALTER_TABLE_INCLUDE_COLUMN_KEYWORD
- UNNEST_WITH_ORDINALITY
- AGGREGATE_FILTER_SUPPORTED
- SEMI_ANTI_JOIN_WITH_SIDE
- COMPUTED_COLUMN_WITH_TYPE
- SUPPORTS_TABLE_COPY
- TABLESAMPLE_REQUIRES_PARENS
- TABLESAMPLE_SIZE_IS_ROWS
- TABLESAMPLE_KEYWORDS
- TABLESAMPLE_WITH_METHOD
- TABLESAMPLE_SEED_KEYWORD
- COLLATE_IS_FUNC
- DATA_TYPE_SPECIFIERS_ALLOWED
- ENSURE_BOOLS
- CTE_RECURSIVE_KEYWORD_REQUIRED
- SUPPORTS_SINGLE_ARG_CONCAT
- SUPPORTS_TABLE_ALIAS_COLUMNS
- UNPIVOT_ALIASES_ARE_IDENTIFIERS
- INSERT_OVERWRITE
- SUPPORTS_SELECT_INTO
- SUPPORTS_UNLOGGED_TABLES
- SUPPORTS_CREATE_TABLE_LIKE
- LIKE_PROPERTY_INSIDE_SCHEMA
- MULTI_ARG_DISTINCT
- JSON_PATH_SINGLE_QUOTE_ESCAPE
- CAN_IMPLEMENT_ARRAY_ANY
- SUPPORTS_WINDOW_EXCLUDE
- SET_OP_MODIFIERS
- COPY_PARAMS_ARE_WRAPPED
- COPY_PARAMS_EQ_REQUIRED
- COPY_HAS_INTO_KEYWORD
- STAR_EXCEPT
- HEX_FUNC
- WITH_PROPERTIES_PREFIX
- 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
- TIME_PART_SINGULARS
- TOKEN_MAPPING
- STRUCT_DELIMITER
- PARAMETER_TOKEN
- NAMED_PLACEHOLDER_TOKEN
- EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
- WITH_SEPARATED_COMMENTS
- EXCLUDE_COMMENTS
- UNWRAPPED_INTERVAL_VALUES
- PARAMETERIZABLE_TEXT_TYPES
- EXPRESSIONS_WITHOUT_NESTED_CTES
- RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS
- SAFE_JSON_PATH_KEY_RE
- SENTINEL_LINE_BREAK
- pretty
- identify
- normalize
- pad
- unsupported_level
- max_unsupported
- leading_comma
- max_text_width
- comments
- dialect
- normalize_functions
- unsupported_messages
- generate
- preprocess
- unsupported
- sep
- seg
- sanitize_comment
- maybe_comment
- wrap
- no_identify
- normalize_func
- indent
- sql
- uncache_sql
- cache_sql
- characterset_sql
- column_parts
- column_sql
- columnposition_sql
- columndef_sql
- columnconstraint_sql
- autoincrementcolumnconstraint_sql
- compresscolumnconstraint_sql
- generatedasidentitycolumnconstraint_sql
- generatedasrowcolumnconstraint_sql
- periodforsystemtimeconstraint_sql
- notnullcolumnconstraint_sql
- primarykeycolumnconstraint_sql
- uniquecolumnconstraint_sql
- createable_sql
- create_sql
- sequenceproperties_sql
- clone_sql
- describe_sql
- heredoc_sql
- prepend_ctes
- with_sql
- cte_sql
- tablealias_sql
- bitstring_sql
- hexstring_sql
- bytestring_sql
- unicodestring_sql
- rawstring_sql
- datatypeparam_sql
- directory_sql
- delete_sql
- drop_sql
- set_operation
- set_operations
- fetch_sql
- limitoptions_sql
- filter_sql
- hint_sql
- indexparameters_sql
- index_sql
- identifier_sql
- hex_sql
- lowerhex_sql
- inputoutputformat_sql
- national_sql
- partition_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
- table_sql
- tablefromrows_sql
- tablesample_sql
- pivot_sql
- version_sql
- tuple_sql
- update_sql
- values_sql
- var_sql
- into_sql
- from_sql
- groupingsets_sql
- rollup_sql
- cube_sql
- group_sql
- having_sql
- connect_sql
- prior_sql
- join_sql
- lambda_sql
- lateral_op
- lateral_sql
- limit_sql
- offset_sql
- setitem_sql
- set_sql
- queryband_sql
- pragma_sql
- lock_sql
- literal_sql
- escape_str
- loaddata_sql
- null_sql
- boolean_sql
- order_sql
- withfill_sql
- cluster_sql
- distribute_sql
- sort_sql
- ordered_sql
- matchrecognizemeasure_sql
- matchrecognize_sql
- query_modifiers
- options_modifier
- for_modifiers
- queryoption_sql
- offset_limit_modifiers
- after_limit_modifiers
- select_sql
- schema_sql
- schema_columns_sql
- star_sql
- parameter_sql
- sessionparameter_sql
- placeholder_sql
- subquery_sql
- qualify_sql
- unnest_sql
- prewhere_sql
- where_sql
- window_sql
- partition_by_sql
- windowspec_sql
- withingroup_sql
- between_sql
- bracket_offset_expressions
- bracket_sql
- all_sql
- any_sql
- exists_sql
- case_sql
- constraint_sql
- nextvaluefor_sql
- trim_sql
- convert_concat_args
- concat_sql
- concatws_sql
- check_sql
- foreignkey_sql
- primarykey_sql
- if_sql
- matchagainst_sql
- jsonkeyvalue_sql
- jsonpath_sql
- json_path_part
- formatjson_sql
- formatphrase_sql
- jsonobject_sql
- jsonobjectagg_sql
- jsonarray_sql
- jsonarrayagg_sql
- jsoncolumndef_sql
- jsonschema_sql
- jsontable_sql
- openjsoncolumndef_sql
- openjson_sql
- in_sql
- in_unnest_op
- interval_sql
- return_sql
- reference_sql
- anonymous_sql
- paren_sql
- neg_sql
- not_sql
- alias_sql
- pivotalias_sql
- aliases_sql
- atindex_sql
- fromtimezone_sql
- add_sql
- and_sql
- or_sql
- xor_sql
- connector_sql
- bitwiseand_sql
- bitwiseleftshift_sql
- bitwisenot_sql
- bitwiseor_sql
- bitwiserightshift_sql
- bitwisexor_sql
- currentdate_sql
- collate_sql
- command_sql
- comment_sql
- mergetreettlaction_sql
- mergetreettl_sql
- transaction_sql
- commit_sql
- rollback_sql
- alterindex_sql
- alterdiststyle_sql
- altersortkey_sql
- alterrename_sql
- renamecolumn_sql
- alterset_sql
- alter_sql
- add_column_sql
- droppartition_sql
- addconstraint_sql
- addpartition_sql
- distinct_sql
- ignorenulls_sql
- respectnulls_sql
- havingmax_sql
- intdiv_sql
- div_sql
- safedivide_sql
- overlaps_sql
- distance_sql
- dot_sql
- eq_sql
- propertyeq_sql
- escape_sql
- glob_sql
- gt_sql
- gte_sql
- is_sql
- like_sql
- ilike_sql
- similarto_sql
- lt_sql
- lte_sql
- mod_sql
- mul_sql
- neq_sql
- nullsafeeq_sql
- nullsafeneq_sql
- slice_sql
- sub_sql
- trycast_sql
- jsoncast_sql
- try_sql
- log_sql
- use_sql
- binary
- ceil_floor
- function_fallback_sql
- func
- format_args
- too_wide
- format_time
- expressions
- op_expressions
- naked_property
- tag_sql
- token_sql
- userdefinedfunction_sql
- joinhint_sql
- kwarg_sql
- when_sql
- whens_sql
- merge_sql
- tochar_sql
- tonumber_sql
- dictproperty_sql
- dictrange_sql
- dictsubproperty_sql
- duplicatekeyproperty_sql
- uniquekeyproperty_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
- forin_sql
- refresh_sql
- toarray_sql
- tsordstotime_sql
- tsordstotimestamp_sql
- tsordstodatetime_sql
- tsordstodate_sql
- unixdate_sql
- lastday_sql
- dateadd_sql
- arrayany_sql
- struct_sql
- partitionrange_sql
- truncatetable_sql
- convert_sql
- copyparameter_sql
- credentials_sql
- copy_sql
- semicolon_sql
- datadeletionproperty_sql
- maskingpolicycolumnconstraint_sql
- gapfill_sql
- scope_resolution
- scoperesolution_sql
- parsejson_sql
- rand_sql
- changes_sql
- pad_sql
- summarize_sql
- explodinggenerateseries_sql
- arrayconcat_sql
- json_sql
- conditionalinsert_sql
- multitableinserts_sql
- oncondition_sql
- jsonextractquote_sql
- jsonexists_sql
- arrayagg_sql
- apply_sql
- grant_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
- featuresattime_sql
- watermarkcolumnconstraint_sql
- encodeproperty_sql
- includeproperty_sql
- xmlelement_sql
- xmlkeyvalueoption_sql
- partitionbyrangeproperty_sql
- partitionbyrangepropertydynamic_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
- get_put_sql
- translatecharacters_sql
- decodecase_sql
- semanticview_sql
- getextract_sql
- datefromunixdate_sql
- space_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
- LAST_DAY_SUPPORTS_DATE_PART
- 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
- VARCHAR_REQUIRES_SIZE
- SUPPORTS_MEDIAN
- UNSIGNED_TYPE_MAPPING
- TIMESTAMP_TYPE_MAPPING
- TYPE_MAPPING
- PROPERTIES_LOCATION
- LIMIT_FETCH
- LIMIT_ONLY_LITERALS
- CHAR_CAST_MAPPING
- SIGNED_CAST_MAPPING
- CAST_MAPPING
- TIMESTAMP_FUNC_TYPES
- computedcolumnconstraint_sql
- array_sql
- arraycontainsall_sql
- dpipe_sql
- extract_sql
- datatype_sql
- jsonarraycontains_sql
- cast_sql
- show_sql
- altercolumn_sql
- chr_sql
- timestamptrunc_sql
- converttimezone_sql
- attimezone_sql
- isascii_sql
- currentschema_sql