sqlglot.dialects.singlestore
1import re 2 3from sqlglot import TokenType 4import typing as t 5 6from sqlglot import exp 7from sqlglot.dialects.dialect import ( 8 build_formatted_time, 9 build_json_extract_path, 10 json_extract_segments, 11 json_path_key_only_name, 12 rename_func, 13 bool_xor_sql, 14 count_if_to_sum, 15 timestamptrunc_sql, 16 date_add_interval_sql, 17 timestampdiff_sql, 18) 19from sqlglot.dialects.mysql import MySQL, _remove_ts_or_ds_to_date, date_add_sql, _show_parser 20from sqlglot.expressions import DataType 21from sqlglot.generator import unsupported_args 22from sqlglot.helper import seq_get 23 24 25def cast_to_time6( 26 expression: t.Optional[exp.Expression], time_type: DataType.Type = exp.DataType.Type.TIME 27) -> exp.Cast: 28 return exp.Cast( 29 this=expression, 30 to=exp.DataType.build( 31 time_type, 32 expressions=[exp.DataTypeParam(this=exp.Literal.number(6))], 33 ), 34 ) 35 36 37class SingleStore(MySQL): 38 SUPPORTS_ORDER_BY_ALL = True 39 40 TIME_MAPPING: t.Dict[str, str] = { 41 "D": "%u", # Day of week (1-7) 42 "DD": "%d", # day of month (01-31) 43 "DY": "%a", # abbreviated name of day 44 "HH": "%I", # Hour of day (01-12) 45 "HH12": "%I", # alias for HH 46 "HH24": "%H", # Hour of day (00-23) 47 "MI": "%M", # Minute (00-59) 48 "MM": "%m", # Month (01-12; January = 01) 49 "MON": "%b", # Abbreviated name of month 50 "MONTH": "%B", # Name of month 51 "SS": "%S", # Second (00-59) 52 "RR": "%y", # 15 53 "YY": "%y", # 15 54 "YYYY": "%Y", # 2015 55 "FF6": "%f", # only 6 digits are supported in python formats 56 } 57 58 VECTOR_TYPE_ALIASES = { 59 "I8": "TINYINT", 60 "I16": "SMALLINT", 61 "I32": "INT", 62 "I64": "BIGINT", 63 "F32": "FLOAT", 64 "F64": "DOUBLE", 65 } 66 67 INVERSE_VECTOR_TYPE_ALIASES = {v: k for k, v in VECTOR_TYPE_ALIASES.items()} 68 69 class Tokenizer(MySQL.Tokenizer): 70 BYTE_STRINGS = [("e'", "'"), ("E'", "'")] 71 72 KEYWORDS = { 73 **MySQL.Tokenizer.KEYWORDS, 74 "BSON": TokenType.JSONB, 75 "GEOGRAPHYPOINT": TokenType.GEOGRAPHYPOINT, 76 "TIMESTAMP": TokenType.TIMESTAMP, 77 "UTC_DATE": TokenType.UTC_DATE, 78 "UTC_TIME": TokenType.UTC_TIME, 79 "UTC_TIMESTAMP": TokenType.UTC_TIMESTAMP, 80 ":>": TokenType.COLON_GT, 81 "!:>": TokenType.NCOLON_GT, 82 "::$": TokenType.DCOLONDOLLAR, 83 "::%": TokenType.DCOLONPERCENT, 84 "::?": TokenType.DCOLONQMARK, 85 "RECORD": TokenType.STRUCT, 86 } 87 88 class Parser(MySQL.Parser): 89 FUNCTIONS = { 90 **MySQL.Parser.FUNCTIONS, 91 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "singlestore"), 92 "TO_TIMESTAMP": build_formatted_time(exp.StrToTime, "singlestore"), 93 "TO_CHAR": build_formatted_time(exp.ToChar, "singlestore"), 94 "STR_TO_DATE": build_formatted_time(exp.StrToDate, "mysql"), 95 "DATE_FORMAT": build_formatted_time(exp.TimeToStr, "mysql"), 96 # The first argument of following functions is converted to TIME(6) 97 # This is needed because exp.TimeToStr is converted to DATE_FORMAT 98 # which interprets the first argument as DATETIME and fails to parse 99 # string literals like '12:05:47' without a date part. 100 "TIME_FORMAT": lambda args: exp.TimeToStr( 101 this=cast_to_time6(seq_get(args, 0)), 102 format=MySQL.format_time(seq_get(args, 1)), 103 ), 104 "HOUR": lambda args: exp.cast( 105 exp.TimeToStr( 106 this=cast_to_time6(seq_get(args, 0)), 107 format=MySQL.format_time(exp.Literal.string("%k")), 108 ), 109 DataType.Type.INT, 110 ), 111 "MICROSECOND": lambda args: exp.cast( 112 exp.TimeToStr( 113 this=cast_to_time6(seq_get(args, 0)), 114 format=MySQL.format_time(exp.Literal.string("%f")), 115 ), 116 DataType.Type.INT, 117 ), 118 "SECOND": lambda args: exp.cast( 119 exp.TimeToStr( 120 this=cast_to_time6(seq_get(args, 0)), 121 format=MySQL.format_time(exp.Literal.string("%s")), 122 ), 123 DataType.Type.INT, 124 ), 125 "MINUTE": lambda args: exp.cast( 126 exp.TimeToStr( 127 this=cast_to_time6(seq_get(args, 0)), 128 format=MySQL.format_time(exp.Literal.string("%i")), 129 ), 130 DataType.Type.INT, 131 ), 132 "MONTHNAME": lambda args: exp.TimeToStr( 133 this=seq_get(args, 0), 134 format=MySQL.format_time(exp.Literal.string("%M")), 135 ), 136 "WEEKDAY": lambda args: exp.paren(exp.DayOfWeek(this=seq_get(args, 0)) + 5, copy=False) 137 % 7, 138 "UNIX_TIMESTAMP": exp.StrToUnix.from_arg_list, 139 "FROM_UNIXTIME": build_formatted_time(exp.UnixToTime, "mysql"), 140 "TIME_BUCKET": lambda args: exp.DateBin( 141 this=seq_get(args, 0), 142 expression=seq_get(args, 1), 143 origin=seq_get(args, 2), 144 ), 145 "BSON_EXTRACT_BSON": build_json_extract_path(exp.JSONBExtract), 146 "BSON_EXTRACT_STRING": build_json_extract_path( 147 exp.JSONBExtractScalar, json_type="STRING" 148 ), 149 "BSON_EXTRACT_DOUBLE": build_json_extract_path( 150 exp.JSONBExtractScalar, json_type="DOUBLE" 151 ), 152 "BSON_EXTRACT_BIGINT": build_json_extract_path( 153 exp.JSONBExtractScalar, json_type="BIGINT" 154 ), 155 "JSON_EXTRACT_JSON": build_json_extract_path(exp.JSONExtract), 156 "JSON_EXTRACT_STRING": build_json_extract_path( 157 exp.JSONExtractScalar, json_type="STRING" 158 ), 159 "JSON_EXTRACT_DOUBLE": build_json_extract_path( 160 exp.JSONExtractScalar, json_type="DOUBLE" 161 ), 162 "JSON_EXTRACT_BIGINT": build_json_extract_path( 163 exp.JSONExtractScalar, json_type="BIGINT" 164 ), 165 "JSON_ARRAY_CONTAINS_STRING": lambda args: exp.JSONArrayContains( 166 this=seq_get(args, 1), 167 expression=seq_get(args, 0), 168 json_type="STRING", 169 ), 170 "JSON_ARRAY_CONTAINS_DOUBLE": lambda args: exp.JSONArrayContains( 171 this=seq_get(args, 1), 172 expression=seq_get(args, 0), 173 json_type="DOUBLE", 174 ), 175 "JSON_ARRAY_CONTAINS_JSON": lambda args: exp.JSONArrayContains( 176 this=seq_get(args, 1), 177 expression=seq_get(args, 0), 178 json_type="JSON", 179 ), 180 "JSON_KEYS": lambda args: exp.JSONKeys( 181 this=seq_get(args, 0), 182 expressions=args[1:], 183 ), 184 "JSON_PRETTY": exp.JSONFormat.from_arg_list, 185 "JSON_BUILD_ARRAY": lambda args: exp.JSONArray(expressions=args), 186 "JSON_BUILD_OBJECT": lambda args: exp.JSONObject(expressions=args), 187 "DATE": exp.Date.from_arg_list, 188 "DAYNAME": lambda args: exp.TimeToStr( 189 this=seq_get(args, 0), 190 format=MySQL.format_time(exp.Literal.string("%W")), 191 ), 192 "TIMESTAMPDIFF": lambda args: exp.TimestampDiff( 193 this=seq_get(args, 2), 194 expression=seq_get(args, 1), 195 unit=seq_get(args, 0), 196 ), 197 "APPROX_COUNT_DISTINCT": exp.Hll.from_arg_list, 198 "APPROX_PERCENTILE": lambda args, dialect: exp.ApproxQuantile( 199 this=seq_get(args, 0), 200 quantile=seq_get(args, 1), 201 error_tolerance=seq_get(args, 2), 202 ), 203 "VARIANCE": exp.VariancePop.from_arg_list, 204 "INSTR": exp.Contains.from_arg_list, 205 "REGEXP_MATCH": lambda args: exp.RegexpExtractAll( 206 this=seq_get(args, 0), 207 expression=seq_get(args, 1), 208 parameters=seq_get(args, 2), 209 ), 210 "REGEXP_SUBSTR": lambda args: exp.RegexpExtract( 211 this=seq_get(args, 0), 212 expression=seq_get(args, 1), 213 position=seq_get(args, 2), 214 occurrence=seq_get(args, 3), 215 parameters=seq_get(args, 4), 216 ), 217 "REDUCE": lambda args: exp.Reduce( 218 initial=seq_get(args, 0), 219 this=seq_get(args, 1), 220 merge=seq_get(args, 2), 221 ), 222 } 223 224 FUNCTION_PARSERS: t.Dict[str, t.Callable] = { 225 **MySQL.Parser.FUNCTION_PARSERS, 226 "JSON_AGG": lambda self: exp.JSONArrayAgg( 227 this=self._parse_term(), 228 order=self._parse_order(), 229 ), 230 } 231 232 NO_PAREN_FUNCTIONS = { 233 **MySQL.Parser.NO_PAREN_FUNCTIONS, 234 TokenType.UTC_DATE: exp.UtcDate, 235 TokenType.UTC_TIME: exp.UtcTime, 236 TokenType.UTC_TIMESTAMP: exp.UtcTimestamp, 237 } 238 239 CAST_COLUMN_OPERATORS = {TokenType.COLON_GT, TokenType.NCOLON_GT} 240 241 COLUMN_OPERATORS = { 242 **MySQL.Parser.COLUMN_OPERATORS, 243 TokenType.COLON_GT: lambda self, this, to: self.expression( 244 exp.Cast, 245 this=this, 246 to=to, 247 ), 248 TokenType.NCOLON_GT: lambda self, this, to: self.expression( 249 exp.TryCast, 250 this=this, 251 to=to, 252 ), 253 TokenType.DCOLON: lambda self, this, path: build_json_extract_path(exp.JSONExtract)( 254 [this, exp.Literal.string(path.name)] 255 ), 256 TokenType.DCOLONDOLLAR: lambda self, this, path: build_json_extract_path( 257 exp.JSONExtractScalar, json_type="STRING" 258 )([this, exp.Literal.string(path.name)]), 259 TokenType.DCOLONPERCENT: lambda self, this, path: build_json_extract_path( 260 exp.JSONExtractScalar, json_type="DOUBLE" 261 )([this, exp.Literal.string(path.name)]), 262 TokenType.DCOLONQMARK: lambda self, this, path: self.expression( 263 exp.JSONExists, 264 this=this, 265 path=path.name, 266 from_dcolonqmark=True, 267 ), 268 } 269 COLUMN_OPERATORS.pop(TokenType.ARROW) 270 COLUMN_OPERATORS.pop(TokenType.DARROW) 271 COLUMN_OPERATORS.pop(TokenType.HASH_ARROW) 272 COLUMN_OPERATORS.pop(TokenType.DHASH_ARROW) 273 COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER) 274 275 SHOW_PARSERS = { 276 **MySQL.Parser.SHOW_PARSERS, 277 "AGGREGATES": _show_parser("AGGREGATES"), 278 "CDC EXTRACTOR POOL": _show_parser("CDC EXTRACTOR POOL"), 279 "CREATE AGGREGATE": _show_parser("CREATE AGGREGATE", target=True), 280 "CREATE PIPELINE": _show_parser("CREATE PIPELINE", target=True), 281 "CREATE PROJECTION": _show_parser("CREATE PROJECTION", target=True), 282 "DATABASE STATUS": _show_parser("DATABASE STATUS"), 283 "DISTRIBUTED_PLANCACHE STATUS": _show_parser("DISTRIBUTED_PLANCACHE STATUS"), 284 "FULLTEXT SERVICE METRICS LOCAL": _show_parser("FULLTEXT SERVICE METRICS LOCAL"), 285 "FULLTEXT SERVICE METRICS FOR NODE": _show_parser( 286 "FULLTEXT SERVICE METRICS FOR NODE", target=True 287 ), 288 "FULLTEXT SERVICE STATUS": _show_parser("FULLTEXT SERVICE STATUS"), 289 "FUNCTIONS": _show_parser("FUNCTIONS"), 290 "GROUPS": _show_parser("GROUPS"), 291 "GROUPS FOR ROLE": _show_parser("GROUPS FOR ROLE", target=True), 292 "GROUPS FOR USER": _show_parser("GROUPS FOR USER", target=True), 293 "INDEXES": _show_parser("INDEX", target="FROM"), 294 "KEYS": _show_parser("INDEX", target="FROM"), 295 "LINKS": _show_parser("LINKS", target="ON"), 296 "LOAD ERRORS": _show_parser("LOAD ERRORS"), 297 "LOAD WARNINGS": _show_parser("LOAD WARNINGS"), 298 "PARTITIONS": _show_parser("PARTITIONS", target="ON"), 299 "PIPELINES": _show_parser("PIPELINES"), 300 "PLAN": _show_parser("PLAN", target=True), 301 "PLANCACHE": _show_parser("PLANCACHE"), 302 "PROCEDURES": _show_parser("PROCEDURES"), 303 "PROJECTIONS": _show_parser("PROJECTIONS", target="ON TABLE"), 304 "REPLICATION STATUS": _show_parser("REPLICATION STATUS"), 305 "REPRODUCTION": _show_parser("REPRODUCTION"), 306 "RESOURCE POOLS": _show_parser("RESOURCE POOLS"), 307 "ROLES": _show_parser("ROLES"), 308 "ROLES FOR USER": _show_parser("ROLES FOR USER", target=True), 309 "ROLES FOR GROUP": _show_parser("ROLES FOR GROUP", target=True), 310 "STATUS EXTENDED": _show_parser("STATUS EXTENDED"), 311 "USERS": _show_parser("USERS"), 312 "USERS FOR ROLE": _show_parser("USERS FOR ROLE", target=True), 313 "USERS FOR GROUP": _show_parser("USERS FOR GROUP", target=True), 314 } 315 316 ALTER_PARSERS = { 317 **MySQL.Parser.ALTER_PARSERS, 318 "CHANGE": lambda self: self.expression( 319 exp.RenameColumn, this=self._parse_column(), to=self._parse_column() 320 ), 321 } 322 323 def _parse_vector_expressions( 324 self, expressions: t.List[exp.Expression] 325 ) -> t.List[exp.Expression]: 326 type_name = expressions[1].name.upper() 327 if type_name in self.dialect.VECTOR_TYPE_ALIASES: 328 type_name = self.dialect.VECTOR_TYPE_ALIASES[type_name] 329 330 return [exp.DataType.build(type_name, dialect=self.dialect), expressions[0]] 331 332 class Generator(MySQL.Generator): 333 SUPPORTS_UESCAPE = False 334 NULL_ORDERING_SUPPORTED = True 335 MATCH_AGAINST_TABLE_PREFIX = "TABLE " 336 STRUCT_DELIMITER = ("(", ")") 337 338 @staticmethod 339 def _unicode_substitute(m: re.Match[str]) -> str: 340 # Interpret the number as hex and convert it to the Unicode string 341 return chr(int(m.group(1), 16)) 342 343 UNICODE_SUBSTITUTE: t.Optional[t.Callable[[re.Match[str]], str]] = _unicode_substitute 344 345 SUPPORTED_JSON_PATH_PARTS = { 346 exp.JSONPathKey, 347 exp.JSONPathRoot, 348 exp.JSONPathSubscript, 349 } 350 351 TRANSFORMS = { 352 **MySQL.Generator.TRANSFORMS, 353 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)) 354 if e.args.get("format") 355 else self.func("DATE", e.this), 356 exp.StrToTime: lambda self, e: self.func("TO_TIMESTAMP", e.this, self.format_time(e)), 357 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 358 exp.StrToDate: lambda self, e: self.func( 359 "STR_TO_DATE", 360 e.this, 361 self.format_time( 362 e, 363 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 364 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 365 ), 366 ), 367 exp.TimeToStr: lambda self, e: self.func( 368 "DATE_FORMAT", 369 e.this, 370 self.format_time( 371 e, 372 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 373 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 374 ), 375 ), 376 exp.Date: unsupported_args("zone", "expressions")(rename_func("DATE")), 377 exp.Cast: unsupported_args("format", "action", "default")( 378 lambda self, e: f"{self.sql(e, 'this')} :> {self.sql(e, 'to')}" 379 ), 380 exp.TryCast: unsupported_args("format", "action", "default")( 381 lambda self, e: f"{self.sql(e, 'this')} !:> {self.sql(e, 'to')}" 382 ), 383 exp.CastToStrType: lambda self, e: self.sql( 384 exp.cast(e.this, DataType.build(e.args["to"].name)) 385 ), 386 exp.StrToUnix: unsupported_args("format")(rename_func("UNIX_TIMESTAMP")), 387 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 388 exp.TimeStrToUnix: rename_func("UNIX_TIMESTAMP"), 389 exp.UnixSeconds: rename_func("UNIX_TIMESTAMP"), 390 exp.UnixToStr: lambda self, e: self.func( 391 "FROM_UNIXTIME", 392 e.this, 393 self.format_time( 394 e, 395 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 396 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 397 ), 398 ), 399 exp.UnixToTime: unsupported_args("scale", "zone", "hours", "minutes")( 400 lambda self, e: self.func( 401 "FROM_UNIXTIME", 402 e.this, 403 self.format_time( 404 e, 405 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 406 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 407 ), 408 ), 409 ), 410 exp.UnixToTimeStr: lambda self, e: f"FROM_UNIXTIME({self.sql(e, 'this')}) :> TEXT", 411 exp.DateBin: unsupported_args("unit", "zone")( 412 lambda self, e: self.func("TIME_BUCKET", e.this, e.expression, e.args.get("origin")) 413 ), 414 exp.TimeStrToDate: lambda self, e: self.sql(exp.cast(e.this, exp.DataType.Type.DATE)), 415 exp.FromTimeZone: lambda self, e: self.func( 416 "CONVERT_TZ", e.this, e.args.get("zone"), "'UTC'" 417 ), 418 exp.DiToDate: lambda self, 419 e: f"STR_TO_DATE({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT})", 420 exp.DateToDi: lambda self, 421 e: f"(DATE_FORMAT({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT}) :> INT)", 422 exp.TsOrDiToDi: lambda self, 423 e: f"(DATE_FORMAT({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT}) :> INT)", 424 exp.Time: unsupported_args("zone")(lambda self, e: f"{self.sql(e, 'this')} :> TIME"), 425 exp.DatetimeAdd: _remove_ts_or_ds_to_date(date_add_sql("ADD")), 426 exp.DatetimeTrunc: unsupported_args("zone")(timestamptrunc_sql()), 427 exp.DatetimeSub: date_add_interval_sql("DATE", "SUB"), 428 exp.DatetimeDiff: timestampdiff_sql, 429 exp.DateTrunc: unsupported_args("zone")(timestamptrunc_sql()), 430 exp.DateDiff: unsupported_args("zone")( 431 lambda self, e: timestampdiff_sql(self, e) 432 if e.unit is not None 433 else self.func("DATEDIFF", e.this, e.expression) 434 ), 435 exp.TsOrDsDiff: lambda self, e: timestampdiff_sql(self, e) 436 if e.unit is not None 437 else self.func("DATEDIFF", e.this, e.expression), 438 exp.TimestampTrunc: unsupported_args("zone")(timestamptrunc_sql()), 439 exp.CurrentDatetime: lambda self, e: self.sql( 440 cast_to_time6( 441 exp.CurrentTimestamp(this=exp.Literal.number(6)), exp.DataType.Type.DATETIME 442 ) 443 ), 444 exp.JSONExtract: unsupported_args( 445 "only_json_types", 446 "expressions", 447 "variant_extract", 448 "json_query", 449 "option", 450 "quote", 451 "on_condition", 452 "requires_json", 453 )(json_extract_segments("JSON_EXTRACT_JSON")), 454 exp.JSONBExtract: json_extract_segments("BSON_EXTRACT_BSON"), 455 exp.JSONPathKey: json_path_key_only_name, 456 exp.JSONPathSubscript: lambda self, e: self.json_path_part(e.this), 457 exp.JSONPathRoot: lambda *_: "", 458 exp.JSONFormat: unsupported_args("options", "is_json")(rename_func("JSON_PRETTY")), 459 exp.JSONArrayAgg: unsupported_args("null_handling", "return_type", "strict")( 460 lambda self, e: self.func("JSON_AGG", e.this, suffix=f"{self.sql(e, 'order')})") 461 ), 462 exp.JSONArray: unsupported_args("null_handling", "return_type", "strict")( 463 rename_func("JSON_BUILD_ARRAY") 464 ), 465 exp.JSONBExists: lambda self, e: self.func( 466 "BSON_MATCH_ANY_EXISTS", e.this, e.args.get("path") 467 ), 468 exp.JSONExists: lambda self, e: ( 469 f"{self.sql(e.this)}::?{self.sql(e.args.get('path'))}" 470 if e.args.get("from_dcolonqmark") 471 else self.func("JSON_MATCH_ANY_EXISTS", e.this, e.args.get("path")) 472 ), 473 exp.JSONObject: unsupported_args( 474 "null_handling", "unique_keys", "return_type", "encoding" 475 )(rename_func("JSON_BUILD_OBJECT")), 476 exp.DayOfWeekIso: lambda self, e: f"(({self.func('DAYOFWEEK', e.this)} % 7) + 1)", 477 exp.DayOfMonth: rename_func("DAY"), 478 exp.Hll: rename_func("APPROX_COUNT_DISTINCT"), 479 exp.ApproxDistinct: rename_func("APPROX_COUNT_DISTINCT"), 480 exp.CountIf: count_if_to_sum, 481 exp.LogicalOr: lambda self, e: f"MAX(ABS({self.sql(e, 'this')}))", 482 exp.LogicalAnd: lambda self, e: f"MIN(ABS({self.sql(e, 'this')}))", 483 exp.ApproxQuantile: unsupported_args("accuracy", "weight")( 484 lambda self, e: self.func( 485 "APPROX_PERCENTILE", 486 e.this, 487 e.args.get("quantile"), 488 e.args.get("error_tolerance"), 489 ) 490 ), 491 exp.Variance: rename_func("VAR_SAMP"), 492 exp.VariancePop: rename_func("VAR_POP"), 493 exp.Xor: bool_xor_sql, 494 exp.Cbrt: lambda self, e: self.sql( 495 exp.Pow(this=e.this, expression=exp.Literal.number(1) / exp.Literal.number(3)) 496 ), 497 exp.RegexpLike: lambda self, e: self.binary(e, "RLIKE"), 498 exp.Repeat: lambda self, e: self.func( 499 "LPAD", 500 exp.Literal.string(""), 501 exp.Mul(this=self.func("LENGTH", e.this), expression=e.args.get("times")), 502 e.this, 503 ), 504 exp.IsAscii: lambda self, e: f"({self.sql(e, 'this')} RLIKE '^[\x00-\x7f]*$')", 505 exp.MD5Digest: lambda self, e: self.func("UNHEX", self.func("MD5", e.this)), 506 exp.Contains: rename_func("INSTR"), 507 exp.RegexpExtractAll: unsupported_args("position", "occurrence", "group")( 508 lambda self, e: self.func( 509 "REGEXP_MATCH", 510 e.this, 511 e.expression, 512 e.args.get("parameters"), 513 ) 514 ), 515 exp.RegexpExtract: unsupported_args("group")( 516 lambda self, e: self.func( 517 "REGEXP_SUBSTR", 518 e.this, 519 e.expression, 520 e.args.get("position"), 521 e.args.get("occurrence"), 522 e.args.get("parameters"), 523 ) 524 ), 525 exp.StartsWith: lambda self, e: self.func( 526 "REGEXP_INSTR", e.this, self.func("CONCAT", exp.Literal.string("^"), e.expression) 527 ), 528 exp.FromBase: lambda self, e: self.func( 529 "CONV", e.this, e.expression, exp.Literal.number(10) 530 ), 531 exp.RegexpILike: lambda self, e: self.binary( 532 exp.RegexpLike( 533 this=exp.Lower(this=e.this), 534 expression=exp.Lower(this=e.expression), 535 ), 536 "RLIKE", 537 ), 538 exp.Stuff: lambda self, e: self.func( 539 "CONCAT", 540 self.func("SUBSTRING", e.this, exp.Literal.number(1), e.args.get("start") - 1), 541 e.expression, 542 self.func("SUBSTRING", e.this, e.args.get("start") + e.args.get("length")), 543 ), 544 exp.National: lambda self, e: self.national_sql(e, prefix=""), 545 exp.Reduce: unsupported_args("finish")( 546 lambda self, e: self.func( 547 "REDUCE", e.args.get("initial"), e.this, e.args.get("merge") 548 ) 549 ), 550 exp.MatchAgainst: unsupported_args("modifier")( 551 lambda self, e: super().matchagainst_sql(e) 552 ), 553 exp.Show: unsupported_args( 554 "history", 555 "terse", 556 "offset", 557 "starts_with", 558 "limit", 559 "from_", 560 "scope", 561 "scope_kind", 562 "mutex", 563 "query", 564 "channel", 565 "log", 566 "types", 567 "privileges", 568 )(lambda self, e: super().show_sql(e)), 569 exp.Describe: unsupported_args( 570 "style", 571 "kind", 572 "expressions", 573 "partition", 574 "format", 575 )(lambda self, e: super().describe_sql(e)), 576 } 577 TRANSFORMS.pop(exp.JSONExtractScalar) 578 TRANSFORMS.pop(exp.CurrentDate) 579 580 UNSUPPORTED_TYPES = { 581 exp.DataType.Type.ARRAY, 582 exp.DataType.Type.AGGREGATEFUNCTION, 583 exp.DataType.Type.SIMPLEAGGREGATEFUNCTION, 584 exp.DataType.Type.BIGSERIAL, 585 exp.DataType.Type.BPCHAR, 586 exp.DataType.Type.DATEMULTIRANGE, 587 exp.DataType.Type.DATERANGE, 588 exp.DataType.Type.DYNAMIC, 589 exp.DataType.Type.HLLSKETCH, 590 exp.DataType.Type.HSTORE, 591 exp.DataType.Type.IMAGE, 592 exp.DataType.Type.INET, 593 exp.DataType.Type.INT128, 594 exp.DataType.Type.INT256, 595 exp.DataType.Type.INT4MULTIRANGE, 596 exp.DataType.Type.INT4RANGE, 597 exp.DataType.Type.INT8MULTIRANGE, 598 exp.DataType.Type.INT8RANGE, 599 exp.DataType.Type.INTERVAL, 600 exp.DataType.Type.IPADDRESS, 601 exp.DataType.Type.IPPREFIX, 602 exp.DataType.Type.IPV4, 603 exp.DataType.Type.IPV6, 604 exp.DataType.Type.LIST, 605 exp.DataType.Type.MAP, 606 exp.DataType.Type.LOWCARDINALITY, 607 exp.DataType.Type.MONEY, 608 exp.DataType.Type.MULTILINESTRING, 609 exp.DataType.Type.NAME, 610 exp.DataType.Type.NESTED, 611 exp.DataType.Type.NOTHING, 612 exp.DataType.Type.NULL, 613 exp.DataType.Type.NUMMULTIRANGE, 614 exp.DataType.Type.NUMRANGE, 615 exp.DataType.Type.OBJECT, 616 exp.DataType.Type.RANGE, 617 exp.DataType.Type.ROWVERSION, 618 exp.DataType.Type.SERIAL, 619 exp.DataType.Type.SMALLSERIAL, 620 exp.DataType.Type.SMALLMONEY, 621 exp.DataType.Type.SUPER, 622 exp.DataType.Type.TIMETZ, 623 exp.DataType.Type.TIMESTAMPNTZ, 624 exp.DataType.Type.TIMESTAMPLTZ, 625 exp.DataType.Type.TIMESTAMPTZ, 626 exp.DataType.Type.TIMESTAMP_NS, 627 exp.DataType.Type.TSMULTIRANGE, 628 exp.DataType.Type.TSRANGE, 629 exp.DataType.Type.TSTZMULTIRANGE, 630 exp.DataType.Type.TSTZRANGE, 631 exp.DataType.Type.UINT128, 632 exp.DataType.Type.UINT256, 633 exp.DataType.Type.UNION, 634 exp.DataType.Type.UNKNOWN, 635 exp.DataType.Type.USERDEFINED, 636 exp.DataType.Type.UUID, 637 exp.DataType.Type.VARIANT, 638 exp.DataType.Type.XML, 639 exp.DataType.Type.TDIGEST, 640 } 641 642 TYPE_MAPPING = { 643 **MySQL.Generator.TYPE_MAPPING, 644 exp.DataType.Type.BIGDECIMAL: "DECIMAL", 645 exp.DataType.Type.BIT: "BOOLEAN", 646 exp.DataType.Type.DATE32: "DATE", 647 exp.DataType.Type.DATETIME64: "DATETIME", 648 exp.DataType.Type.DECIMAL32: "DECIMAL", 649 exp.DataType.Type.DECIMAL64: "DECIMAL", 650 exp.DataType.Type.DECIMAL128: "DECIMAL", 651 exp.DataType.Type.DECIMAL256: "DECIMAL", 652 exp.DataType.Type.ENUM8: "ENUM", 653 exp.DataType.Type.ENUM16: "ENUM", 654 exp.DataType.Type.FIXEDSTRING: "TEXT", 655 exp.DataType.Type.GEOMETRY: "GEOGRAPHY", 656 exp.DataType.Type.POINT: "GEOGRAPHYPOINT", 657 exp.DataType.Type.RING: "GEOGRAPHY", 658 exp.DataType.Type.LINESTRING: "GEOGRAPHY", 659 exp.DataType.Type.POLYGON: "GEOGRAPHY", 660 exp.DataType.Type.MULTIPOLYGON: "GEOGRAPHY", 661 exp.DataType.Type.STRUCT: "RECORD", 662 exp.DataType.Type.JSONB: "BSON", 663 exp.DataType.Type.TIMESTAMP: "TIMESTAMP", 664 exp.DataType.Type.TIMESTAMP_S: "TIMESTAMP", 665 exp.DataType.Type.TIMESTAMP_MS: "TIMESTAMP(6)", 666 } 667 668 # https://docs.singlestore.com/cloud/reference/sql-reference/restricted-keywords/list-of-restricted-keywords/ 669 RESERVED_KEYWORDS = { 670 "abs", 671 "absolute", 672 "access", 673 "account", 674 "acos", 675 "action", 676 "add", 677 "adddate", 678 "addtime", 679 "admin", 680 "aes_decrypt", 681 "aes_encrypt", 682 "after", 683 "against", 684 "aggregate", 685 "aggregates", 686 "aggregator", 687 "aggregator_id", 688 "aggregator_plan_hash", 689 "aggregators", 690 "algorithm", 691 "all", 692 "also", 693 "alter", 694 "always", 695 "analyse", 696 "analyze", 697 "and", 698 "anti_join", 699 "any", 700 "any_value", 701 "approx_count_distinct", 702 "approx_count_distinct_accumulate", 703 "approx_count_distinct_combine", 704 "approx_count_distinct_estimate", 705 "approx_geography_intersects", 706 "approx_percentile", 707 "arghistory", 708 "arrange", 709 "arrangement", 710 "array", 711 "as", 712 "asc", 713 "ascii", 714 "asensitive", 715 "asin", 716 "asm", 717 "assertion", 718 "assignment", 719 "ast", 720 "asymmetric", 721 "async", 722 "at", 723 "atan", 724 "atan2", 725 "attach", 726 "attribute", 727 "authorization", 728 "auto", 729 "auto_increment", 730 "auto_reprovision", 731 "autostats", 732 "autostats_cardinality_mode", 733 "autostats_enabled", 734 "autostats_histogram_mode", 735 "autostats_sampling", 736 "availability", 737 "avg", 738 "avg_row_length", 739 "avro", 740 "azure", 741 "background", 742 "_background_threads_for_cleanup", 743 "backup", 744 "backup_history", 745 "backup_id", 746 "backward", 747 "batch", 748 "batches", 749 "batch_interval", 750 "_batch_size_limit", 751 "before", 752 "begin", 753 "between", 754 "bigint", 755 "bin", 756 "binary", 757 "_binary", 758 "bit", 759 "bit_and", 760 "bit_count", 761 "bit_or", 762 "bit_xor", 763 "blob", 764 "bool", 765 "boolean", 766 "bootstrap", 767 "both", 768 "_bt", 769 "btree", 770 "bucket_count", 771 "by", 772 "byte", 773 "byte_length", 774 "cache", 775 "call", 776 "call_for_pipeline", 777 "called", 778 "capture", 779 "cascade", 780 "cascaded", 781 "case", 782 "cast", 783 "catalog", 784 "ceil", 785 "ceiling", 786 "chain", 787 "change", 788 "char", 789 "character", 790 "characteristics", 791 "character_length", 792 "char_length", 793 "charset", 794 "check", 795 "checkpoint", 796 "_check_can_connect", 797 "_check_consistency", 798 "checksum", 799 "_checksum", 800 "class", 801 "clear", 802 "client", 803 "client_found_rows", 804 "close", 805 "cluster", 806 "clustered", 807 "cnf", 808 "coalesce", 809 "coercibility", 810 "collate", 811 "collation", 812 "collect", 813 "column", 814 "columnar", 815 "columns", 816 "columnstore", 817 "columnstore_segment_rows", 818 "comment", 819 "comments", 820 "commit", 821 "committed", 822 "_commit_log_tail", 823 "committed", 824 "compact", 825 "compile", 826 "compressed", 827 "compression", 828 "concat", 829 "concat_ws", 830 "concurrent", 831 "concurrently", 832 "condition", 833 "configuration", 834 "connection", 835 "connection_id", 836 "connections", 837 "config", 838 "constraint", 839 "constraints", 840 "content", 841 "continue", 842 "_continue_replay", 843 "conv", 844 "conversion", 845 "convert", 846 "convert_tz", 847 "copy", 848 "_core", 849 "cos", 850 "cost", 851 "cot", 852 "count", 853 "create", 854 "credentials", 855 "cross", 856 "cube", 857 "csv", 858 "cume_dist", 859 "curdate", 860 "current", 861 "current_catalog", 862 "current_date", 863 "current_role", 864 "current_schema", 865 "current_security_groups", 866 "current_security_roles", 867 "current_time", 868 "current_timestamp", 869 "current_user", 870 "cursor", 871 "curtime", 872 "cycle", 873 "data", 874 "database", 875 "databases", 876 "date", 877 "date_add", 878 "datediff", 879 "date_format", 880 "date_sub", 881 "date_trunc", 882 "datetime", 883 "day", 884 "day_hour", 885 "day_microsecond", 886 "day_minute", 887 "dayname", 888 "dayofmonth", 889 "dayofweek", 890 "dayofyear", 891 "day_second", 892 "deallocate", 893 "dec", 894 "decimal", 895 "declare", 896 "decode", 897 "default", 898 "defaults", 899 "deferrable", 900 "deferred", 901 "defined", 902 "definer", 903 "degrees", 904 "delayed", 905 "delay_key_write", 906 "delete", 907 "delimiter", 908 "delimiters", 909 "dense_rank", 910 "desc", 911 "describe", 912 "detach", 913 "deterministic", 914 "dictionary", 915 "differential", 916 "directory", 917 "disable", 918 "discard", 919 "_disconnect", 920 "disk", 921 "distinct", 922 "distinctrow", 923 "distributed_joins", 924 "div", 925 "do", 926 "document", 927 "domain", 928 "dot_product", 929 "double", 930 "drop", 931 "_drop_profile", 932 "dual", 933 "dump", 934 "duplicate", 935 "dynamic", 936 "earliest", 937 "each", 938 "echo", 939 "election", 940 "else", 941 "elseif", 942 "elt", 943 "enable", 944 "enclosed", 945 "encoding", 946 "encrypted", 947 "end", 948 "engine", 949 "engines", 950 "enum", 951 "errors", 952 "escape", 953 "escaped", 954 "estimate", 955 "euclidean_distance", 956 "event", 957 "events", 958 "except", 959 "exclude", 960 "excluding", 961 "exclusive", 962 "execute", 963 "exists", 964 "exit", 965 "exp", 966 "explain", 967 "extended", 968 "extension", 969 "external", 970 "external_host", 971 "external_port", 972 "extract", 973 "extractor", 974 "extractors", 975 "extra_join", 976 "_failover", 977 "failed_login_attempts", 978 "failure", 979 "false", 980 "family", 981 "fault", 982 "fetch", 983 "field", 984 "fields", 985 "file", 986 "files", 987 "fill", 988 "first", 989 "first_value", 990 "fix_alter", 991 "fixed", 992 "float", 993 "float4", 994 "float8", 995 "floor", 996 "flush", 997 "following", 998 "for", 999 "force", 1000 "force_compiled_mode", 1001 "force_interpreter_mode", 1002 "foreground", 1003 "foreign", 1004 "format", 1005 "forward", 1006 "found_rows", 1007 "freeze", 1008 "from", 1009 "from_base64", 1010 "from_days", 1011 "from_unixtime", 1012 "fs", 1013 "_fsync", 1014 "full", 1015 "fulltext", 1016 "function", 1017 "functions", 1018 "gc", 1019 "gcs", 1020 "get_format", 1021 "_gc", 1022 "_gcx", 1023 "generate", 1024 "geography", 1025 "geography_area", 1026 "geography_contains", 1027 "geography_distance", 1028 "geography_intersects", 1029 "geography_latitude", 1030 "geography_length", 1031 "geography_longitude", 1032 "geographypoint", 1033 "geography_point", 1034 "geography_within_distance", 1035 "geometry", 1036 "geometry_area", 1037 "geometry_contains", 1038 "geometry_distance", 1039 "geometry_filter", 1040 "geometry_intersects", 1041 "geometry_length", 1042 "geometrypoint", 1043 "geometry_point", 1044 "geometry_within_distance", 1045 "geometry_x", 1046 "geometry_y", 1047 "global", 1048 "_global_version_timestamp", 1049 "grant", 1050 "granted", 1051 "grants", 1052 "greatest", 1053 "group", 1054 "grouping", 1055 "groups", 1056 "group_concat", 1057 "gzip", 1058 "handle", 1059 "handler", 1060 "hard_cpu_limit_percentage", 1061 "hash", 1062 "has_temp_tables", 1063 "having", 1064 "hdfs", 1065 "header", 1066 "heartbeat_no_logging", 1067 "hex", 1068 "highlight", 1069 "high_priority", 1070 "hold", 1071 "holding", 1072 "host", 1073 "hosts", 1074 "hour", 1075 "hour_microsecond", 1076 "hour_minute", 1077 "hour_second", 1078 "identified", 1079 "identity", 1080 "if", 1081 "ifnull", 1082 "ignore", 1083 "ilike", 1084 "immediate", 1085 "immutable", 1086 "implicit", 1087 "import", 1088 "in", 1089 "including", 1090 "increment", 1091 "incremental", 1092 "index", 1093 "indexes", 1094 "inet_aton", 1095 "inet_ntoa", 1096 "inet6_aton", 1097 "inet6_ntoa", 1098 "infile", 1099 "inherit", 1100 "inherits", 1101 "_init_profile", 1102 "init", 1103 "initcap", 1104 "initialize", 1105 "initially", 1106 "inject", 1107 "inline", 1108 "inner", 1109 "inout", 1110 "input", 1111 "insensitive", 1112 "insert", 1113 "insert_method", 1114 "instance", 1115 "instead", 1116 "instr", 1117 "int", 1118 "int1", 1119 "int2", 1120 "int3", 1121 "int4", 1122 "int8", 1123 "integer", 1124 "_internal_dynamic_typecast", 1125 "interpreter_mode", 1126 "intersect", 1127 "interval", 1128 "into", 1129 "invoker", 1130 "is", 1131 "isnull", 1132 "isolation", 1133 "iterate", 1134 "join", 1135 "json", 1136 "json_agg", 1137 "json_array_contains_double", 1138 "json_array_contains_json", 1139 "json_array_contains_string", 1140 "json_array_push_double", 1141 "json_array_push_json", 1142 "json_array_push_string", 1143 "json_delete_key", 1144 "json_extract_double", 1145 "json_extract_json", 1146 "json_extract_string", 1147 "json_extract_bigint", 1148 "json_get_type", 1149 "json_length", 1150 "json_set_double", 1151 "json_set_json", 1152 "json_set_string", 1153 "json_splice_double", 1154 "json_splice_json", 1155 "json_splice_string", 1156 "kafka", 1157 "key", 1158 "key_block_size", 1159 "keys", 1160 "kill", 1161 "killall", 1162 "label", 1163 "lag", 1164 "language", 1165 "large", 1166 "last", 1167 "last_day", 1168 "last_insert_id", 1169 "last_value", 1170 "lateral", 1171 "latest", 1172 "lc_collate", 1173 "lc_ctype", 1174 "lcase", 1175 "lead", 1176 "leading", 1177 "leaf", 1178 "leakproof", 1179 "least", 1180 "leave", 1181 "leaves", 1182 "left", 1183 "length", 1184 "level", 1185 "license", 1186 "like", 1187 "limit", 1188 "lines", 1189 "listen", 1190 "llvm", 1191 "ln", 1192 "load", 1193 "loaddata_where", 1194 "_load", 1195 "local", 1196 "localtime", 1197 "localtimestamp", 1198 "locate", 1199 "location", 1200 "lock", 1201 "log", 1202 "log10", 1203 "log2", 1204 "long", 1205 "longblob", 1206 "longtext", 1207 "loop", 1208 "lower", 1209 "low_priority", 1210 "lpad", 1211 "_ls", 1212 "ltrim", 1213 "lz4", 1214 "management", 1215 "_management_thread", 1216 "mapping", 1217 "master", 1218 "match", 1219 "materialized", 1220 "max", 1221 "maxvalue", 1222 "max_concurrency", 1223 "max_errors", 1224 "max_partitions_per_batch", 1225 "max_queue_depth", 1226 "max_retries_per_batch_partition", 1227 "max_rows", 1228 "mbc", 1229 "md5", 1230 "mpl", 1231 "median", 1232 "mediumblob", 1233 "mediumint", 1234 "mediumtext", 1235 "member", 1236 "memory", 1237 "memory_percentage", 1238 "_memsql_table_id_lookup", 1239 "memsql", 1240 "memsql_deserialize", 1241 "memsql_imitating_kafka", 1242 "memsql_serialize", 1243 "merge", 1244 "metadata", 1245 "microsecond", 1246 "middleint", 1247 "min", 1248 "min_rows", 1249 "minus", 1250 "minute", 1251 "minute_microsecond", 1252 "minute_second", 1253 "minvalue", 1254 "mod", 1255 "mode", 1256 "model", 1257 "modifies", 1258 "modify", 1259 "month", 1260 "monthname", 1261 "months_between", 1262 "move", 1263 "mpl", 1264 "names", 1265 "named", 1266 "namespace", 1267 "national", 1268 "natural", 1269 "nchar", 1270 "next", 1271 "no", 1272 "node", 1273 "none", 1274 "no_query_rewrite", 1275 "noparam", 1276 "not", 1277 "nothing", 1278 "notify", 1279 "now", 1280 "nowait", 1281 "no_write_to_binlog", 1282 "no_query_rewrite", 1283 "norely", 1284 "nth_value", 1285 "ntile", 1286 "null", 1287 "nullcols", 1288 "nullif", 1289 "nulls", 1290 "numeric", 1291 "nvarchar", 1292 "object", 1293 "octet_length", 1294 "of", 1295 "off", 1296 "offline", 1297 "offset", 1298 "offsets", 1299 "oids", 1300 "on", 1301 "online", 1302 "only", 1303 "open", 1304 "operator", 1305 "optimization", 1306 "optimize", 1307 "optimizer", 1308 "optimizer_state", 1309 "option", 1310 "options", 1311 "optionally", 1312 "or", 1313 "order", 1314 "ordered_serialize", 1315 "orphan", 1316 "out", 1317 "out_of_order", 1318 "outer", 1319 "outfile", 1320 "over", 1321 "overlaps", 1322 "overlay", 1323 "owned", 1324 "owner", 1325 "pack_keys", 1326 "paired", 1327 "parser", 1328 "parquet", 1329 "partial", 1330 "partition", 1331 "partition_id", 1332 "partitioning", 1333 "partitions", 1334 "passing", 1335 "password", 1336 "password_lock_time", 1337 "parser", 1338 "pause", 1339 "_pause_replay", 1340 "percent_rank", 1341 "percentile_cont", 1342 "percentile_disc", 1343 "periodic", 1344 "persisted", 1345 "pi", 1346 "pipeline", 1347 "pipelines", 1348 "pivot", 1349 "placing", 1350 "plan", 1351 "plans", 1352 "plancache", 1353 "plugins", 1354 "pool", 1355 "pools", 1356 "port", 1357 "position", 1358 "pow", 1359 "power", 1360 "preceding", 1361 "precision", 1362 "prepare", 1363 "prepared", 1364 "preserve", 1365 "primary", 1366 "prior", 1367 "privileges", 1368 "procedural", 1369 "procedure", 1370 "procedures", 1371 "process", 1372 "processlist", 1373 "profile", 1374 "profiles", 1375 "program", 1376 "promote", 1377 "proxy", 1378 "purge", 1379 "quarter", 1380 "queries", 1381 "query", 1382 "query_timeout", 1383 "queue", 1384 "quote", 1385 "radians", 1386 "rand", 1387 "range", 1388 "rank", 1389 "read", 1390 "_read", 1391 "reads", 1392 "real", 1393 "reassign", 1394 "rebalance", 1395 "recheck", 1396 "record", 1397 "recursive", 1398 "redundancy", 1399 "redundant", 1400 "ref", 1401 "reference", 1402 "references", 1403 "refresh", 1404 "regexp", 1405 "reindex", 1406 "relative", 1407 "release", 1408 "reload", 1409 "rely", 1410 "remote", 1411 "remove", 1412 "rename", 1413 "repair", 1414 "_repair_table", 1415 "repeat", 1416 "repeatable", 1417 "_repl", 1418 "_reprovisioning", 1419 "replace", 1420 "replica", 1421 "replicate", 1422 "replicating", 1423 "replication", 1424 "durability", 1425 "require", 1426 "resource", 1427 "resource_pool", 1428 "reset", 1429 "restart", 1430 "restore", 1431 "restrict", 1432 "result", 1433 "_resurrect", 1434 "retry", 1435 "return", 1436 "returning", 1437 "returns", 1438 "reverse", 1439 "revoke", 1440 "rg_pool", 1441 "right", 1442 "right_anti_join", 1443 "right_semi_join", 1444 "right_straight_join", 1445 "rlike", 1446 "role", 1447 "roles", 1448 "rollback", 1449 "rollup", 1450 "round", 1451 "routine", 1452 "row", 1453 "row_count", 1454 "row_format", 1455 "row_number", 1456 "rows", 1457 "rowstore", 1458 "rule", 1459 "rpad", 1460 "_rpc", 1461 "rtrim", 1462 "running", 1463 "s3", 1464 "safe", 1465 "save", 1466 "savepoint", 1467 "scalar", 1468 "schema", 1469 "schemas", 1470 "schema_binding", 1471 "scroll", 1472 "search", 1473 "second", 1474 "second_microsecond", 1475 "sec_to_time", 1476 "security", 1477 "select", 1478 "semi_join", 1479 "_send_threads", 1480 "sensitive", 1481 "separator", 1482 "sequence", 1483 "sequences", 1484 "serial", 1485 "serializable", 1486 "series", 1487 "service_user", 1488 "server", 1489 "session", 1490 "session_user", 1491 "set", 1492 "setof", 1493 "security_lists_intersect", 1494 "sha", 1495 "sha1", 1496 "sha2", 1497 "shard", 1498 "sharded", 1499 "sharded_id", 1500 "share", 1501 "show", 1502 "shutdown", 1503 "sigmoid", 1504 "sign", 1505 "signal", 1506 "similar", 1507 "simple", 1508 "site", 1509 "signed", 1510 "sin", 1511 "skip", 1512 "skipped_batches", 1513 "sleep", 1514 "_sleep", 1515 "smallint", 1516 "snapshot", 1517 "_snapshot", 1518 "_snapshots", 1519 "soft_cpu_limit_percentage", 1520 "some", 1521 "soname", 1522 "sparse", 1523 "spatial", 1524 "spatial_check_index", 1525 "specific", 1526 "split", 1527 "sql", 1528 "sql_big_result", 1529 "sql_buffer_result", 1530 "sql_cache", 1531 "sql_calc_found_rows", 1532 "sqlexception", 1533 "sql_mode", 1534 "sql_no_cache", 1535 "sql_no_logging", 1536 "sql_small_result", 1537 "sqlstate", 1538 "sqlwarning", 1539 "sqrt", 1540 "ssl", 1541 "stable", 1542 "standalone", 1543 "start", 1544 "starting", 1545 "state", 1546 "statement", 1547 "statistics", 1548 "stats", 1549 "status", 1550 "std", 1551 "stddev", 1552 "stddev_pop", 1553 "stddev_samp", 1554 "stdin", 1555 "stdout", 1556 "stop", 1557 "storage", 1558 "str_to_date", 1559 "straight_join", 1560 "strict", 1561 "string", 1562 "strip", 1563 "subdate", 1564 "substr", 1565 "substring", 1566 "substring_index", 1567 "success", 1568 "sum", 1569 "super", 1570 "symmetric", 1571 "sync_snapshot", 1572 "sync", 1573 "_sync", 1574 "_sync2", 1575 "_sync_partitions", 1576 "_sync_snapshot", 1577 "synchronize", 1578 "sysid", 1579 "system", 1580 "table", 1581 "table_checksum", 1582 "tables", 1583 "tablespace", 1584 "tags", 1585 "tan", 1586 "target_size", 1587 "task", 1588 "temp", 1589 "template", 1590 "temporary", 1591 "temptable", 1592 "_term_bump", 1593 "terminate", 1594 "terminated", 1595 "test", 1596 "text", 1597 "then", 1598 "time", 1599 "timediff", 1600 "time_bucket", 1601 "time_format", 1602 "timeout", 1603 "timestamp", 1604 "timestampadd", 1605 "timestampdiff", 1606 "timezone", 1607 "time_to_sec", 1608 "tinyblob", 1609 "tinyint", 1610 "tinytext", 1611 "to", 1612 "to_base64", 1613 "to_char", 1614 "to_date", 1615 "to_days", 1616 "to_json", 1617 "to_number", 1618 "to_seconds", 1619 "to_timestamp", 1620 "tracelogs", 1621 "traditional", 1622 "trailing", 1623 "transform", 1624 "transaction", 1625 "_transactions_experimental", 1626 "treat", 1627 "trigger", 1628 "triggers", 1629 "trim", 1630 "true", 1631 "trunc", 1632 "truncate", 1633 "trusted", 1634 "two_phase", 1635 "_twopcid", 1636 "type", 1637 "types", 1638 "ucase", 1639 "unbounded", 1640 "uncommitted", 1641 "undefined", 1642 "undo", 1643 "unencrypted", 1644 "unenforced", 1645 "unhex", 1646 "unhold", 1647 "unicode", 1648 "union", 1649 "unique", 1650 "_unittest", 1651 "unix_timestamp", 1652 "unknown", 1653 "unlisten", 1654 "_unload", 1655 "unlock", 1656 "unlogged", 1657 "unpivot", 1658 "unsigned", 1659 "until", 1660 "update", 1661 "upgrade", 1662 "upper", 1663 "usage", 1664 "use", 1665 "user", 1666 "users", 1667 "using", 1668 "utc_date", 1669 "utc_time", 1670 "utc_timestamp", 1671 "_utf8", 1672 "vacuum", 1673 "valid", 1674 "validate", 1675 "validator", 1676 "value", 1677 "values", 1678 "varbinary", 1679 "varchar", 1680 "varcharacter", 1681 "variables", 1682 "variadic", 1683 "variance", 1684 "var_pop", 1685 "var_samp", 1686 "varying", 1687 "vector_sub", 1688 "verbose", 1689 "version", 1690 "view", 1691 "void", 1692 "volatile", 1693 "voting", 1694 "wait", 1695 "_wake", 1696 "warnings", 1697 "week", 1698 "weekday", 1699 "weekofyear", 1700 "when", 1701 "where", 1702 "while", 1703 "whitespace", 1704 "window", 1705 "with", 1706 "without", 1707 "within", 1708 "_wm_heartbeat", 1709 "work", 1710 "workload", 1711 "wrapper", 1712 "write", 1713 "xact_id", 1714 "xor", 1715 "year", 1716 "year_month", 1717 "yes", 1718 "zerofill", 1719 "zone", 1720 } 1721 1722 def jsonextractscalar_sql(self, expression: exp.JSONExtractScalar) -> str: 1723 json_type = expression.args.get("json_type") 1724 func_name = "JSON_EXTRACT_JSON" if json_type is None else f"JSON_EXTRACT_{json_type}" 1725 return json_extract_segments(func_name)(self, expression) 1726 1727 def jsonbextractscalar_sql(self, expression: exp.JSONBExtractScalar) -> str: 1728 json_type = expression.args.get("json_type") 1729 func_name = "BSON_EXTRACT_BSON" if json_type is None else f"BSON_EXTRACT_{json_type}" 1730 return json_extract_segments(func_name)(self, expression) 1731 1732 def jsonextractarray_sql(self, expression: exp.JSONExtractArray) -> str: 1733 self.unsupported("Arrays are not supported in SingleStore") 1734 return self.function_fallback_sql(expression) 1735 1736 @unsupported_args("on_condition") 1737 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1738 res: exp.Expression = exp.JSONExtractScalar( 1739 this=expression.this, 1740 expression=expression.args.get("path"), 1741 json_type="STRING", 1742 ) 1743 1744 returning = expression.args.get("returning") 1745 if returning is not None: 1746 res = exp.Cast(this=res, to=returning) 1747 1748 return self.sql(res) 1749 1750 def all_sql(self, expression: exp.All) -> str: 1751 self.unsupported("ALL subquery predicate is not supported in SingleStore") 1752 return super().all_sql(expression) 1753 1754 def jsonarraycontains_sql(self, expression: exp.JSONArrayContains) -> str: 1755 json_type = expression.text("json_type").upper() 1756 1757 if json_type: 1758 return self.func( 1759 f"JSON_ARRAY_CONTAINS_{json_type}", expression.expression, expression.this 1760 ) 1761 1762 return self.func( 1763 "JSON_ARRAY_CONTAINS_JSON", 1764 expression.expression, 1765 self.func("TO_JSON", expression.this), 1766 ) 1767 1768 @unsupported_args("kind", "values") 1769 def datatype_sql(self, expression: exp.DataType) -> str: 1770 if expression.args.get("nested") and not expression.is_type(exp.DataType.Type.STRUCT): 1771 self.unsupported( 1772 f"Argument 'nested' is not supported for representation of '{expression.this.value}' in SingleStore" 1773 ) 1774 1775 if expression.is_type(exp.DataType.Type.VARBINARY) and not expression.expressions: 1776 # `VARBINARY` must always have a size - if it doesn't, we always generate `BLOB` 1777 return "BLOB" 1778 if expression.is_type( 1779 exp.DataType.Type.DECIMAL32, 1780 exp.DataType.Type.DECIMAL64, 1781 exp.DataType.Type.DECIMAL128, 1782 exp.DataType.Type.DECIMAL256, 1783 ): 1784 scale = self.expressions(expression, flat=True) 1785 1786 if expression.is_type(exp.DataType.Type.DECIMAL32): 1787 precision = "9" 1788 elif expression.is_type(exp.DataType.Type.DECIMAL64): 1789 precision = "18" 1790 elif expression.is_type(exp.DataType.Type.DECIMAL128): 1791 precision = "38" 1792 else: 1793 # 65 is a maximum precision supported in SingleStore 1794 precision = "65" 1795 if scale is not None: 1796 return f"DECIMAL({precision}, {scale[0]})" 1797 else: 1798 return f"DECIMAL({precision})" 1799 if expression.is_type(exp.DataType.Type.VECTOR): 1800 expressions = expression.expressions 1801 if len(expressions) == 2: 1802 type_name = self.sql(expressions[0]) 1803 if type_name in self.dialect.INVERSE_VECTOR_TYPE_ALIASES: 1804 type_name = self.dialect.INVERSE_VECTOR_TYPE_ALIASES[type_name] 1805 1806 return f"VECTOR({self.sql(expressions[1])}, {type_name})" 1807 1808 return super().datatype_sql(expression) 1809 1810 def collate_sql(self, expression: exp.Collate) -> str: 1811 # SingleStore does not support setting a collation for column in the SELECT query, 1812 # so we cast column to a LONGTEXT type with specific collation 1813 return self.binary(expression, ":> LONGTEXT COLLATE") 1814 1815 def currentdate_sql(self, expression: exp.CurrentDate) -> str: 1816 timezone = expression.this 1817 if timezone: 1818 if isinstance(timezone, exp.Literal) and timezone.name.lower() == "utc": 1819 return self.func("UTC_DATE") 1820 self.unsupported("CurrentDate with timezone is not supported in SingleStore") 1821 1822 return self.func("CURRENT_DATE") 1823 1824 def currenttime_sql(self, expression: exp.CurrentTime) -> str: 1825 arg = expression.this 1826 if arg: 1827 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1828 return self.func("UTC_TIME") 1829 if isinstance(arg, exp.Literal) and arg.is_number: 1830 return self.func("CURRENT_TIME", arg) 1831 self.unsupported("CurrentTime with timezone is not supported in SingleStore") 1832 1833 return self.func("CURRENT_TIME") 1834 1835 def currenttimestamp_sql(self, expression: exp.CurrentTimestamp) -> str: 1836 arg = expression.this 1837 if arg: 1838 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1839 return self.func("UTC_TIMESTAMP") 1840 if isinstance(arg, exp.Literal) and arg.is_number: 1841 return self.func("CURRENT_TIMESTAMP", arg) 1842 self.unsupported("CurrentTimestamp with timezone is not supported in SingleStore") 1843 1844 return self.func("CURRENT_TIMESTAMP") 1845 1846 def standardhash_sql(self, expression: exp.StandardHash) -> str: 1847 hash_function = expression.expression 1848 if hash_function is None: 1849 return self.func("SHA", expression.this) 1850 if isinstance(hash_function, exp.Literal): 1851 if hash_function.name.lower() == "sha": 1852 return self.func("SHA", expression.this) 1853 if hash_function.name.lower() == "md5": 1854 return self.func("MD5", expression.this) 1855 1856 self.unsupported( 1857 f"{hash_function.this} hash method is not supported in SingleStore" 1858 ) 1859 return self.func("SHA", expression.this) 1860 1861 self.unsupported("STANDARD_HASH function is not supported in SingleStore") 1862 return self.func("SHA", expression.this) 1863 1864 @unsupported_args("is_database", "exists", "cluster", "identity", "option", "partition") 1865 def truncatetable_sql(self, expression: exp.TruncateTable) -> str: 1866 statements = [] 1867 for expression in expression.expressions: 1868 statements.append(f"TRUNCATE {self.sql(expression)}") 1869 1870 return "; ".join(statements) 1871 1872 @unsupported_args("exists") 1873 def renamecolumn_sql(self, expression: exp.RenameColumn) -> str: 1874 old_column = self.sql(expression, "this") 1875 new_column = self.sql(expression, "to") 1876 return f"CHANGE {old_column} {new_column}" 1877 1878 @unsupported_args("drop", "comment", "allow_null", "visible", "using") 1879 def altercolumn_sql(self, expression: exp.AlterColumn) -> str: 1880 alter = super().altercolumn_sql(expression) 1881 1882 collate = self.sql(expression, "collate") 1883 collate = f" COLLATE {collate}" if collate else "" 1884 return f"{alter}{collate}" 1885 1886 def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint) -> str: 1887 this = self.sql(expression, "this") 1888 not_null = " NOT NULL" if expression.args.get("not_null") else "" 1889 type = self.sql(expression, "data_type") or "AUTO" 1890 return f"AS {this} PERSISTED {type}{not_null}"
def
cast_to_time6( expression: Optional[sqlglot.expressions.Expression], time_type: sqlglot.expressions.DataType.Type = <Type.TIME: 'TIME'>) -> sqlglot.expressions.Cast:
38class SingleStore(MySQL): 39 SUPPORTS_ORDER_BY_ALL = True 40 41 TIME_MAPPING: t.Dict[str, str] = { 42 "D": "%u", # Day of week (1-7) 43 "DD": "%d", # day of month (01-31) 44 "DY": "%a", # abbreviated name of day 45 "HH": "%I", # Hour of day (01-12) 46 "HH12": "%I", # alias for HH 47 "HH24": "%H", # Hour of day (00-23) 48 "MI": "%M", # Minute (00-59) 49 "MM": "%m", # Month (01-12; January = 01) 50 "MON": "%b", # Abbreviated name of month 51 "MONTH": "%B", # Name of month 52 "SS": "%S", # Second (00-59) 53 "RR": "%y", # 15 54 "YY": "%y", # 15 55 "YYYY": "%Y", # 2015 56 "FF6": "%f", # only 6 digits are supported in python formats 57 } 58 59 VECTOR_TYPE_ALIASES = { 60 "I8": "TINYINT", 61 "I16": "SMALLINT", 62 "I32": "INT", 63 "I64": "BIGINT", 64 "F32": "FLOAT", 65 "F64": "DOUBLE", 66 } 67 68 INVERSE_VECTOR_TYPE_ALIASES = {v: k for k, v in VECTOR_TYPE_ALIASES.items()} 69 70 class Tokenizer(MySQL.Tokenizer): 71 BYTE_STRINGS = [("e'", "'"), ("E'", "'")] 72 73 KEYWORDS = { 74 **MySQL.Tokenizer.KEYWORDS, 75 "BSON": TokenType.JSONB, 76 "GEOGRAPHYPOINT": TokenType.GEOGRAPHYPOINT, 77 "TIMESTAMP": TokenType.TIMESTAMP, 78 "UTC_DATE": TokenType.UTC_DATE, 79 "UTC_TIME": TokenType.UTC_TIME, 80 "UTC_TIMESTAMP": TokenType.UTC_TIMESTAMP, 81 ":>": TokenType.COLON_GT, 82 "!:>": TokenType.NCOLON_GT, 83 "::$": TokenType.DCOLONDOLLAR, 84 "::%": TokenType.DCOLONPERCENT, 85 "::?": TokenType.DCOLONQMARK, 86 "RECORD": TokenType.STRUCT, 87 } 88 89 class Parser(MySQL.Parser): 90 FUNCTIONS = { 91 **MySQL.Parser.FUNCTIONS, 92 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "singlestore"), 93 "TO_TIMESTAMP": build_formatted_time(exp.StrToTime, "singlestore"), 94 "TO_CHAR": build_formatted_time(exp.ToChar, "singlestore"), 95 "STR_TO_DATE": build_formatted_time(exp.StrToDate, "mysql"), 96 "DATE_FORMAT": build_formatted_time(exp.TimeToStr, "mysql"), 97 # The first argument of following functions is converted to TIME(6) 98 # This is needed because exp.TimeToStr is converted to DATE_FORMAT 99 # which interprets the first argument as DATETIME and fails to parse 100 # string literals like '12:05:47' without a date part. 101 "TIME_FORMAT": lambda args: exp.TimeToStr( 102 this=cast_to_time6(seq_get(args, 0)), 103 format=MySQL.format_time(seq_get(args, 1)), 104 ), 105 "HOUR": lambda args: exp.cast( 106 exp.TimeToStr( 107 this=cast_to_time6(seq_get(args, 0)), 108 format=MySQL.format_time(exp.Literal.string("%k")), 109 ), 110 DataType.Type.INT, 111 ), 112 "MICROSECOND": lambda args: exp.cast( 113 exp.TimeToStr( 114 this=cast_to_time6(seq_get(args, 0)), 115 format=MySQL.format_time(exp.Literal.string("%f")), 116 ), 117 DataType.Type.INT, 118 ), 119 "SECOND": lambda args: exp.cast( 120 exp.TimeToStr( 121 this=cast_to_time6(seq_get(args, 0)), 122 format=MySQL.format_time(exp.Literal.string("%s")), 123 ), 124 DataType.Type.INT, 125 ), 126 "MINUTE": lambda args: exp.cast( 127 exp.TimeToStr( 128 this=cast_to_time6(seq_get(args, 0)), 129 format=MySQL.format_time(exp.Literal.string("%i")), 130 ), 131 DataType.Type.INT, 132 ), 133 "MONTHNAME": lambda args: exp.TimeToStr( 134 this=seq_get(args, 0), 135 format=MySQL.format_time(exp.Literal.string("%M")), 136 ), 137 "WEEKDAY": lambda args: exp.paren(exp.DayOfWeek(this=seq_get(args, 0)) + 5, copy=False) 138 % 7, 139 "UNIX_TIMESTAMP": exp.StrToUnix.from_arg_list, 140 "FROM_UNIXTIME": build_formatted_time(exp.UnixToTime, "mysql"), 141 "TIME_BUCKET": lambda args: exp.DateBin( 142 this=seq_get(args, 0), 143 expression=seq_get(args, 1), 144 origin=seq_get(args, 2), 145 ), 146 "BSON_EXTRACT_BSON": build_json_extract_path(exp.JSONBExtract), 147 "BSON_EXTRACT_STRING": build_json_extract_path( 148 exp.JSONBExtractScalar, json_type="STRING" 149 ), 150 "BSON_EXTRACT_DOUBLE": build_json_extract_path( 151 exp.JSONBExtractScalar, json_type="DOUBLE" 152 ), 153 "BSON_EXTRACT_BIGINT": build_json_extract_path( 154 exp.JSONBExtractScalar, json_type="BIGINT" 155 ), 156 "JSON_EXTRACT_JSON": build_json_extract_path(exp.JSONExtract), 157 "JSON_EXTRACT_STRING": build_json_extract_path( 158 exp.JSONExtractScalar, json_type="STRING" 159 ), 160 "JSON_EXTRACT_DOUBLE": build_json_extract_path( 161 exp.JSONExtractScalar, json_type="DOUBLE" 162 ), 163 "JSON_EXTRACT_BIGINT": build_json_extract_path( 164 exp.JSONExtractScalar, json_type="BIGINT" 165 ), 166 "JSON_ARRAY_CONTAINS_STRING": lambda args: exp.JSONArrayContains( 167 this=seq_get(args, 1), 168 expression=seq_get(args, 0), 169 json_type="STRING", 170 ), 171 "JSON_ARRAY_CONTAINS_DOUBLE": lambda args: exp.JSONArrayContains( 172 this=seq_get(args, 1), 173 expression=seq_get(args, 0), 174 json_type="DOUBLE", 175 ), 176 "JSON_ARRAY_CONTAINS_JSON": lambda args: exp.JSONArrayContains( 177 this=seq_get(args, 1), 178 expression=seq_get(args, 0), 179 json_type="JSON", 180 ), 181 "JSON_KEYS": lambda args: exp.JSONKeys( 182 this=seq_get(args, 0), 183 expressions=args[1:], 184 ), 185 "JSON_PRETTY": exp.JSONFormat.from_arg_list, 186 "JSON_BUILD_ARRAY": lambda args: exp.JSONArray(expressions=args), 187 "JSON_BUILD_OBJECT": lambda args: exp.JSONObject(expressions=args), 188 "DATE": exp.Date.from_arg_list, 189 "DAYNAME": lambda args: exp.TimeToStr( 190 this=seq_get(args, 0), 191 format=MySQL.format_time(exp.Literal.string("%W")), 192 ), 193 "TIMESTAMPDIFF": lambda args: exp.TimestampDiff( 194 this=seq_get(args, 2), 195 expression=seq_get(args, 1), 196 unit=seq_get(args, 0), 197 ), 198 "APPROX_COUNT_DISTINCT": exp.Hll.from_arg_list, 199 "APPROX_PERCENTILE": lambda args, dialect: exp.ApproxQuantile( 200 this=seq_get(args, 0), 201 quantile=seq_get(args, 1), 202 error_tolerance=seq_get(args, 2), 203 ), 204 "VARIANCE": exp.VariancePop.from_arg_list, 205 "INSTR": exp.Contains.from_arg_list, 206 "REGEXP_MATCH": lambda args: exp.RegexpExtractAll( 207 this=seq_get(args, 0), 208 expression=seq_get(args, 1), 209 parameters=seq_get(args, 2), 210 ), 211 "REGEXP_SUBSTR": lambda args: exp.RegexpExtract( 212 this=seq_get(args, 0), 213 expression=seq_get(args, 1), 214 position=seq_get(args, 2), 215 occurrence=seq_get(args, 3), 216 parameters=seq_get(args, 4), 217 ), 218 "REDUCE": lambda args: exp.Reduce( 219 initial=seq_get(args, 0), 220 this=seq_get(args, 1), 221 merge=seq_get(args, 2), 222 ), 223 } 224 225 FUNCTION_PARSERS: t.Dict[str, t.Callable] = { 226 **MySQL.Parser.FUNCTION_PARSERS, 227 "JSON_AGG": lambda self: exp.JSONArrayAgg( 228 this=self._parse_term(), 229 order=self._parse_order(), 230 ), 231 } 232 233 NO_PAREN_FUNCTIONS = { 234 **MySQL.Parser.NO_PAREN_FUNCTIONS, 235 TokenType.UTC_DATE: exp.UtcDate, 236 TokenType.UTC_TIME: exp.UtcTime, 237 TokenType.UTC_TIMESTAMP: exp.UtcTimestamp, 238 } 239 240 CAST_COLUMN_OPERATORS = {TokenType.COLON_GT, TokenType.NCOLON_GT} 241 242 COLUMN_OPERATORS = { 243 **MySQL.Parser.COLUMN_OPERATORS, 244 TokenType.COLON_GT: lambda self, this, to: self.expression( 245 exp.Cast, 246 this=this, 247 to=to, 248 ), 249 TokenType.NCOLON_GT: lambda self, this, to: self.expression( 250 exp.TryCast, 251 this=this, 252 to=to, 253 ), 254 TokenType.DCOLON: lambda self, this, path: build_json_extract_path(exp.JSONExtract)( 255 [this, exp.Literal.string(path.name)] 256 ), 257 TokenType.DCOLONDOLLAR: lambda self, this, path: build_json_extract_path( 258 exp.JSONExtractScalar, json_type="STRING" 259 )([this, exp.Literal.string(path.name)]), 260 TokenType.DCOLONPERCENT: lambda self, this, path: build_json_extract_path( 261 exp.JSONExtractScalar, json_type="DOUBLE" 262 )([this, exp.Literal.string(path.name)]), 263 TokenType.DCOLONQMARK: lambda self, this, path: self.expression( 264 exp.JSONExists, 265 this=this, 266 path=path.name, 267 from_dcolonqmark=True, 268 ), 269 } 270 COLUMN_OPERATORS.pop(TokenType.ARROW) 271 COLUMN_OPERATORS.pop(TokenType.DARROW) 272 COLUMN_OPERATORS.pop(TokenType.HASH_ARROW) 273 COLUMN_OPERATORS.pop(TokenType.DHASH_ARROW) 274 COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER) 275 276 SHOW_PARSERS = { 277 **MySQL.Parser.SHOW_PARSERS, 278 "AGGREGATES": _show_parser("AGGREGATES"), 279 "CDC EXTRACTOR POOL": _show_parser("CDC EXTRACTOR POOL"), 280 "CREATE AGGREGATE": _show_parser("CREATE AGGREGATE", target=True), 281 "CREATE PIPELINE": _show_parser("CREATE PIPELINE", target=True), 282 "CREATE PROJECTION": _show_parser("CREATE PROJECTION", target=True), 283 "DATABASE STATUS": _show_parser("DATABASE STATUS"), 284 "DISTRIBUTED_PLANCACHE STATUS": _show_parser("DISTRIBUTED_PLANCACHE STATUS"), 285 "FULLTEXT SERVICE METRICS LOCAL": _show_parser("FULLTEXT SERVICE METRICS LOCAL"), 286 "FULLTEXT SERVICE METRICS FOR NODE": _show_parser( 287 "FULLTEXT SERVICE METRICS FOR NODE", target=True 288 ), 289 "FULLTEXT SERVICE STATUS": _show_parser("FULLTEXT SERVICE STATUS"), 290 "FUNCTIONS": _show_parser("FUNCTIONS"), 291 "GROUPS": _show_parser("GROUPS"), 292 "GROUPS FOR ROLE": _show_parser("GROUPS FOR ROLE", target=True), 293 "GROUPS FOR USER": _show_parser("GROUPS FOR USER", target=True), 294 "INDEXES": _show_parser("INDEX", target="FROM"), 295 "KEYS": _show_parser("INDEX", target="FROM"), 296 "LINKS": _show_parser("LINKS", target="ON"), 297 "LOAD ERRORS": _show_parser("LOAD ERRORS"), 298 "LOAD WARNINGS": _show_parser("LOAD WARNINGS"), 299 "PARTITIONS": _show_parser("PARTITIONS", target="ON"), 300 "PIPELINES": _show_parser("PIPELINES"), 301 "PLAN": _show_parser("PLAN", target=True), 302 "PLANCACHE": _show_parser("PLANCACHE"), 303 "PROCEDURES": _show_parser("PROCEDURES"), 304 "PROJECTIONS": _show_parser("PROJECTIONS", target="ON TABLE"), 305 "REPLICATION STATUS": _show_parser("REPLICATION STATUS"), 306 "REPRODUCTION": _show_parser("REPRODUCTION"), 307 "RESOURCE POOLS": _show_parser("RESOURCE POOLS"), 308 "ROLES": _show_parser("ROLES"), 309 "ROLES FOR USER": _show_parser("ROLES FOR USER", target=True), 310 "ROLES FOR GROUP": _show_parser("ROLES FOR GROUP", target=True), 311 "STATUS EXTENDED": _show_parser("STATUS EXTENDED"), 312 "USERS": _show_parser("USERS"), 313 "USERS FOR ROLE": _show_parser("USERS FOR ROLE", target=True), 314 "USERS FOR GROUP": _show_parser("USERS FOR GROUP", target=True), 315 } 316 317 ALTER_PARSERS = { 318 **MySQL.Parser.ALTER_PARSERS, 319 "CHANGE": lambda self: self.expression( 320 exp.RenameColumn, this=self._parse_column(), to=self._parse_column() 321 ), 322 } 323 324 def _parse_vector_expressions( 325 self, expressions: t.List[exp.Expression] 326 ) -> t.List[exp.Expression]: 327 type_name = expressions[1].name.upper() 328 if type_name in self.dialect.VECTOR_TYPE_ALIASES: 329 type_name = self.dialect.VECTOR_TYPE_ALIASES[type_name] 330 331 return [exp.DataType.build(type_name, dialect=self.dialect), expressions[0]] 332 333 class Generator(MySQL.Generator): 334 SUPPORTS_UESCAPE = False 335 NULL_ORDERING_SUPPORTED = True 336 MATCH_AGAINST_TABLE_PREFIX = "TABLE " 337 STRUCT_DELIMITER = ("(", ")") 338 339 @staticmethod 340 def _unicode_substitute(m: re.Match[str]) -> str: 341 # Interpret the number as hex and convert it to the Unicode string 342 return chr(int(m.group(1), 16)) 343 344 UNICODE_SUBSTITUTE: t.Optional[t.Callable[[re.Match[str]], str]] = _unicode_substitute 345 346 SUPPORTED_JSON_PATH_PARTS = { 347 exp.JSONPathKey, 348 exp.JSONPathRoot, 349 exp.JSONPathSubscript, 350 } 351 352 TRANSFORMS = { 353 **MySQL.Generator.TRANSFORMS, 354 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)) 355 if e.args.get("format") 356 else self.func("DATE", e.this), 357 exp.StrToTime: lambda self, e: self.func("TO_TIMESTAMP", e.this, self.format_time(e)), 358 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 359 exp.StrToDate: lambda self, e: self.func( 360 "STR_TO_DATE", 361 e.this, 362 self.format_time( 363 e, 364 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 365 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 366 ), 367 ), 368 exp.TimeToStr: lambda self, e: self.func( 369 "DATE_FORMAT", 370 e.this, 371 self.format_time( 372 e, 373 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 374 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 375 ), 376 ), 377 exp.Date: unsupported_args("zone", "expressions")(rename_func("DATE")), 378 exp.Cast: unsupported_args("format", "action", "default")( 379 lambda self, e: f"{self.sql(e, 'this')} :> {self.sql(e, 'to')}" 380 ), 381 exp.TryCast: unsupported_args("format", "action", "default")( 382 lambda self, e: f"{self.sql(e, 'this')} !:> {self.sql(e, 'to')}" 383 ), 384 exp.CastToStrType: lambda self, e: self.sql( 385 exp.cast(e.this, DataType.build(e.args["to"].name)) 386 ), 387 exp.StrToUnix: unsupported_args("format")(rename_func("UNIX_TIMESTAMP")), 388 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 389 exp.TimeStrToUnix: rename_func("UNIX_TIMESTAMP"), 390 exp.UnixSeconds: rename_func("UNIX_TIMESTAMP"), 391 exp.UnixToStr: lambda self, e: self.func( 392 "FROM_UNIXTIME", 393 e.this, 394 self.format_time( 395 e, 396 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 397 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 398 ), 399 ), 400 exp.UnixToTime: unsupported_args("scale", "zone", "hours", "minutes")( 401 lambda self, e: self.func( 402 "FROM_UNIXTIME", 403 e.this, 404 self.format_time( 405 e, 406 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 407 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 408 ), 409 ), 410 ), 411 exp.UnixToTimeStr: lambda self, e: f"FROM_UNIXTIME({self.sql(e, 'this')}) :> TEXT", 412 exp.DateBin: unsupported_args("unit", "zone")( 413 lambda self, e: self.func("TIME_BUCKET", e.this, e.expression, e.args.get("origin")) 414 ), 415 exp.TimeStrToDate: lambda self, e: self.sql(exp.cast(e.this, exp.DataType.Type.DATE)), 416 exp.FromTimeZone: lambda self, e: self.func( 417 "CONVERT_TZ", e.this, e.args.get("zone"), "'UTC'" 418 ), 419 exp.DiToDate: lambda self, 420 e: f"STR_TO_DATE({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT})", 421 exp.DateToDi: lambda self, 422 e: f"(DATE_FORMAT({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT}) :> INT)", 423 exp.TsOrDiToDi: lambda self, 424 e: f"(DATE_FORMAT({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT}) :> INT)", 425 exp.Time: unsupported_args("zone")(lambda self, e: f"{self.sql(e, 'this')} :> TIME"), 426 exp.DatetimeAdd: _remove_ts_or_ds_to_date(date_add_sql("ADD")), 427 exp.DatetimeTrunc: unsupported_args("zone")(timestamptrunc_sql()), 428 exp.DatetimeSub: date_add_interval_sql("DATE", "SUB"), 429 exp.DatetimeDiff: timestampdiff_sql, 430 exp.DateTrunc: unsupported_args("zone")(timestamptrunc_sql()), 431 exp.DateDiff: unsupported_args("zone")( 432 lambda self, e: timestampdiff_sql(self, e) 433 if e.unit is not None 434 else self.func("DATEDIFF", e.this, e.expression) 435 ), 436 exp.TsOrDsDiff: lambda self, e: timestampdiff_sql(self, e) 437 if e.unit is not None 438 else self.func("DATEDIFF", e.this, e.expression), 439 exp.TimestampTrunc: unsupported_args("zone")(timestamptrunc_sql()), 440 exp.CurrentDatetime: lambda self, e: self.sql( 441 cast_to_time6( 442 exp.CurrentTimestamp(this=exp.Literal.number(6)), exp.DataType.Type.DATETIME 443 ) 444 ), 445 exp.JSONExtract: unsupported_args( 446 "only_json_types", 447 "expressions", 448 "variant_extract", 449 "json_query", 450 "option", 451 "quote", 452 "on_condition", 453 "requires_json", 454 )(json_extract_segments("JSON_EXTRACT_JSON")), 455 exp.JSONBExtract: json_extract_segments("BSON_EXTRACT_BSON"), 456 exp.JSONPathKey: json_path_key_only_name, 457 exp.JSONPathSubscript: lambda self, e: self.json_path_part(e.this), 458 exp.JSONPathRoot: lambda *_: "", 459 exp.JSONFormat: unsupported_args("options", "is_json")(rename_func("JSON_PRETTY")), 460 exp.JSONArrayAgg: unsupported_args("null_handling", "return_type", "strict")( 461 lambda self, e: self.func("JSON_AGG", e.this, suffix=f"{self.sql(e, 'order')})") 462 ), 463 exp.JSONArray: unsupported_args("null_handling", "return_type", "strict")( 464 rename_func("JSON_BUILD_ARRAY") 465 ), 466 exp.JSONBExists: lambda self, e: self.func( 467 "BSON_MATCH_ANY_EXISTS", e.this, e.args.get("path") 468 ), 469 exp.JSONExists: lambda self, e: ( 470 f"{self.sql(e.this)}::?{self.sql(e.args.get('path'))}" 471 if e.args.get("from_dcolonqmark") 472 else self.func("JSON_MATCH_ANY_EXISTS", e.this, e.args.get("path")) 473 ), 474 exp.JSONObject: unsupported_args( 475 "null_handling", "unique_keys", "return_type", "encoding" 476 )(rename_func("JSON_BUILD_OBJECT")), 477 exp.DayOfWeekIso: lambda self, e: f"(({self.func('DAYOFWEEK', e.this)} % 7) + 1)", 478 exp.DayOfMonth: rename_func("DAY"), 479 exp.Hll: rename_func("APPROX_COUNT_DISTINCT"), 480 exp.ApproxDistinct: rename_func("APPROX_COUNT_DISTINCT"), 481 exp.CountIf: count_if_to_sum, 482 exp.LogicalOr: lambda self, e: f"MAX(ABS({self.sql(e, 'this')}))", 483 exp.LogicalAnd: lambda self, e: f"MIN(ABS({self.sql(e, 'this')}))", 484 exp.ApproxQuantile: unsupported_args("accuracy", "weight")( 485 lambda self, e: self.func( 486 "APPROX_PERCENTILE", 487 e.this, 488 e.args.get("quantile"), 489 e.args.get("error_tolerance"), 490 ) 491 ), 492 exp.Variance: rename_func("VAR_SAMP"), 493 exp.VariancePop: rename_func("VAR_POP"), 494 exp.Xor: bool_xor_sql, 495 exp.Cbrt: lambda self, e: self.sql( 496 exp.Pow(this=e.this, expression=exp.Literal.number(1) / exp.Literal.number(3)) 497 ), 498 exp.RegexpLike: lambda self, e: self.binary(e, "RLIKE"), 499 exp.Repeat: lambda self, e: self.func( 500 "LPAD", 501 exp.Literal.string(""), 502 exp.Mul(this=self.func("LENGTH", e.this), expression=e.args.get("times")), 503 e.this, 504 ), 505 exp.IsAscii: lambda self, e: f"({self.sql(e, 'this')} RLIKE '^[\x00-\x7f]*$')", 506 exp.MD5Digest: lambda self, e: self.func("UNHEX", self.func("MD5", e.this)), 507 exp.Contains: rename_func("INSTR"), 508 exp.RegexpExtractAll: unsupported_args("position", "occurrence", "group")( 509 lambda self, e: self.func( 510 "REGEXP_MATCH", 511 e.this, 512 e.expression, 513 e.args.get("parameters"), 514 ) 515 ), 516 exp.RegexpExtract: unsupported_args("group")( 517 lambda self, e: self.func( 518 "REGEXP_SUBSTR", 519 e.this, 520 e.expression, 521 e.args.get("position"), 522 e.args.get("occurrence"), 523 e.args.get("parameters"), 524 ) 525 ), 526 exp.StartsWith: lambda self, e: self.func( 527 "REGEXP_INSTR", e.this, self.func("CONCAT", exp.Literal.string("^"), e.expression) 528 ), 529 exp.FromBase: lambda self, e: self.func( 530 "CONV", e.this, e.expression, exp.Literal.number(10) 531 ), 532 exp.RegexpILike: lambda self, e: self.binary( 533 exp.RegexpLike( 534 this=exp.Lower(this=e.this), 535 expression=exp.Lower(this=e.expression), 536 ), 537 "RLIKE", 538 ), 539 exp.Stuff: lambda self, e: self.func( 540 "CONCAT", 541 self.func("SUBSTRING", e.this, exp.Literal.number(1), e.args.get("start") - 1), 542 e.expression, 543 self.func("SUBSTRING", e.this, e.args.get("start") + e.args.get("length")), 544 ), 545 exp.National: lambda self, e: self.national_sql(e, prefix=""), 546 exp.Reduce: unsupported_args("finish")( 547 lambda self, e: self.func( 548 "REDUCE", e.args.get("initial"), e.this, e.args.get("merge") 549 ) 550 ), 551 exp.MatchAgainst: unsupported_args("modifier")( 552 lambda self, e: super().matchagainst_sql(e) 553 ), 554 exp.Show: unsupported_args( 555 "history", 556 "terse", 557 "offset", 558 "starts_with", 559 "limit", 560 "from_", 561 "scope", 562 "scope_kind", 563 "mutex", 564 "query", 565 "channel", 566 "log", 567 "types", 568 "privileges", 569 )(lambda self, e: super().show_sql(e)), 570 exp.Describe: unsupported_args( 571 "style", 572 "kind", 573 "expressions", 574 "partition", 575 "format", 576 )(lambda self, e: super().describe_sql(e)), 577 } 578 TRANSFORMS.pop(exp.JSONExtractScalar) 579 TRANSFORMS.pop(exp.CurrentDate) 580 581 UNSUPPORTED_TYPES = { 582 exp.DataType.Type.ARRAY, 583 exp.DataType.Type.AGGREGATEFUNCTION, 584 exp.DataType.Type.SIMPLEAGGREGATEFUNCTION, 585 exp.DataType.Type.BIGSERIAL, 586 exp.DataType.Type.BPCHAR, 587 exp.DataType.Type.DATEMULTIRANGE, 588 exp.DataType.Type.DATERANGE, 589 exp.DataType.Type.DYNAMIC, 590 exp.DataType.Type.HLLSKETCH, 591 exp.DataType.Type.HSTORE, 592 exp.DataType.Type.IMAGE, 593 exp.DataType.Type.INET, 594 exp.DataType.Type.INT128, 595 exp.DataType.Type.INT256, 596 exp.DataType.Type.INT4MULTIRANGE, 597 exp.DataType.Type.INT4RANGE, 598 exp.DataType.Type.INT8MULTIRANGE, 599 exp.DataType.Type.INT8RANGE, 600 exp.DataType.Type.INTERVAL, 601 exp.DataType.Type.IPADDRESS, 602 exp.DataType.Type.IPPREFIX, 603 exp.DataType.Type.IPV4, 604 exp.DataType.Type.IPV6, 605 exp.DataType.Type.LIST, 606 exp.DataType.Type.MAP, 607 exp.DataType.Type.LOWCARDINALITY, 608 exp.DataType.Type.MONEY, 609 exp.DataType.Type.MULTILINESTRING, 610 exp.DataType.Type.NAME, 611 exp.DataType.Type.NESTED, 612 exp.DataType.Type.NOTHING, 613 exp.DataType.Type.NULL, 614 exp.DataType.Type.NUMMULTIRANGE, 615 exp.DataType.Type.NUMRANGE, 616 exp.DataType.Type.OBJECT, 617 exp.DataType.Type.RANGE, 618 exp.DataType.Type.ROWVERSION, 619 exp.DataType.Type.SERIAL, 620 exp.DataType.Type.SMALLSERIAL, 621 exp.DataType.Type.SMALLMONEY, 622 exp.DataType.Type.SUPER, 623 exp.DataType.Type.TIMETZ, 624 exp.DataType.Type.TIMESTAMPNTZ, 625 exp.DataType.Type.TIMESTAMPLTZ, 626 exp.DataType.Type.TIMESTAMPTZ, 627 exp.DataType.Type.TIMESTAMP_NS, 628 exp.DataType.Type.TSMULTIRANGE, 629 exp.DataType.Type.TSRANGE, 630 exp.DataType.Type.TSTZMULTIRANGE, 631 exp.DataType.Type.TSTZRANGE, 632 exp.DataType.Type.UINT128, 633 exp.DataType.Type.UINT256, 634 exp.DataType.Type.UNION, 635 exp.DataType.Type.UNKNOWN, 636 exp.DataType.Type.USERDEFINED, 637 exp.DataType.Type.UUID, 638 exp.DataType.Type.VARIANT, 639 exp.DataType.Type.XML, 640 exp.DataType.Type.TDIGEST, 641 } 642 643 TYPE_MAPPING = { 644 **MySQL.Generator.TYPE_MAPPING, 645 exp.DataType.Type.BIGDECIMAL: "DECIMAL", 646 exp.DataType.Type.BIT: "BOOLEAN", 647 exp.DataType.Type.DATE32: "DATE", 648 exp.DataType.Type.DATETIME64: "DATETIME", 649 exp.DataType.Type.DECIMAL32: "DECIMAL", 650 exp.DataType.Type.DECIMAL64: "DECIMAL", 651 exp.DataType.Type.DECIMAL128: "DECIMAL", 652 exp.DataType.Type.DECIMAL256: "DECIMAL", 653 exp.DataType.Type.ENUM8: "ENUM", 654 exp.DataType.Type.ENUM16: "ENUM", 655 exp.DataType.Type.FIXEDSTRING: "TEXT", 656 exp.DataType.Type.GEOMETRY: "GEOGRAPHY", 657 exp.DataType.Type.POINT: "GEOGRAPHYPOINT", 658 exp.DataType.Type.RING: "GEOGRAPHY", 659 exp.DataType.Type.LINESTRING: "GEOGRAPHY", 660 exp.DataType.Type.POLYGON: "GEOGRAPHY", 661 exp.DataType.Type.MULTIPOLYGON: "GEOGRAPHY", 662 exp.DataType.Type.STRUCT: "RECORD", 663 exp.DataType.Type.JSONB: "BSON", 664 exp.DataType.Type.TIMESTAMP: "TIMESTAMP", 665 exp.DataType.Type.TIMESTAMP_S: "TIMESTAMP", 666 exp.DataType.Type.TIMESTAMP_MS: "TIMESTAMP(6)", 667 } 668 669 # https://docs.singlestore.com/cloud/reference/sql-reference/restricted-keywords/list-of-restricted-keywords/ 670 RESERVED_KEYWORDS = { 671 "abs", 672 "absolute", 673 "access", 674 "account", 675 "acos", 676 "action", 677 "add", 678 "adddate", 679 "addtime", 680 "admin", 681 "aes_decrypt", 682 "aes_encrypt", 683 "after", 684 "against", 685 "aggregate", 686 "aggregates", 687 "aggregator", 688 "aggregator_id", 689 "aggregator_plan_hash", 690 "aggregators", 691 "algorithm", 692 "all", 693 "also", 694 "alter", 695 "always", 696 "analyse", 697 "analyze", 698 "and", 699 "anti_join", 700 "any", 701 "any_value", 702 "approx_count_distinct", 703 "approx_count_distinct_accumulate", 704 "approx_count_distinct_combine", 705 "approx_count_distinct_estimate", 706 "approx_geography_intersects", 707 "approx_percentile", 708 "arghistory", 709 "arrange", 710 "arrangement", 711 "array", 712 "as", 713 "asc", 714 "ascii", 715 "asensitive", 716 "asin", 717 "asm", 718 "assertion", 719 "assignment", 720 "ast", 721 "asymmetric", 722 "async", 723 "at", 724 "atan", 725 "atan2", 726 "attach", 727 "attribute", 728 "authorization", 729 "auto", 730 "auto_increment", 731 "auto_reprovision", 732 "autostats", 733 "autostats_cardinality_mode", 734 "autostats_enabled", 735 "autostats_histogram_mode", 736 "autostats_sampling", 737 "availability", 738 "avg", 739 "avg_row_length", 740 "avro", 741 "azure", 742 "background", 743 "_background_threads_for_cleanup", 744 "backup", 745 "backup_history", 746 "backup_id", 747 "backward", 748 "batch", 749 "batches", 750 "batch_interval", 751 "_batch_size_limit", 752 "before", 753 "begin", 754 "between", 755 "bigint", 756 "bin", 757 "binary", 758 "_binary", 759 "bit", 760 "bit_and", 761 "bit_count", 762 "bit_or", 763 "bit_xor", 764 "blob", 765 "bool", 766 "boolean", 767 "bootstrap", 768 "both", 769 "_bt", 770 "btree", 771 "bucket_count", 772 "by", 773 "byte", 774 "byte_length", 775 "cache", 776 "call", 777 "call_for_pipeline", 778 "called", 779 "capture", 780 "cascade", 781 "cascaded", 782 "case", 783 "cast", 784 "catalog", 785 "ceil", 786 "ceiling", 787 "chain", 788 "change", 789 "char", 790 "character", 791 "characteristics", 792 "character_length", 793 "char_length", 794 "charset", 795 "check", 796 "checkpoint", 797 "_check_can_connect", 798 "_check_consistency", 799 "checksum", 800 "_checksum", 801 "class", 802 "clear", 803 "client", 804 "client_found_rows", 805 "close", 806 "cluster", 807 "clustered", 808 "cnf", 809 "coalesce", 810 "coercibility", 811 "collate", 812 "collation", 813 "collect", 814 "column", 815 "columnar", 816 "columns", 817 "columnstore", 818 "columnstore_segment_rows", 819 "comment", 820 "comments", 821 "commit", 822 "committed", 823 "_commit_log_tail", 824 "committed", 825 "compact", 826 "compile", 827 "compressed", 828 "compression", 829 "concat", 830 "concat_ws", 831 "concurrent", 832 "concurrently", 833 "condition", 834 "configuration", 835 "connection", 836 "connection_id", 837 "connections", 838 "config", 839 "constraint", 840 "constraints", 841 "content", 842 "continue", 843 "_continue_replay", 844 "conv", 845 "conversion", 846 "convert", 847 "convert_tz", 848 "copy", 849 "_core", 850 "cos", 851 "cost", 852 "cot", 853 "count", 854 "create", 855 "credentials", 856 "cross", 857 "cube", 858 "csv", 859 "cume_dist", 860 "curdate", 861 "current", 862 "current_catalog", 863 "current_date", 864 "current_role", 865 "current_schema", 866 "current_security_groups", 867 "current_security_roles", 868 "current_time", 869 "current_timestamp", 870 "current_user", 871 "cursor", 872 "curtime", 873 "cycle", 874 "data", 875 "database", 876 "databases", 877 "date", 878 "date_add", 879 "datediff", 880 "date_format", 881 "date_sub", 882 "date_trunc", 883 "datetime", 884 "day", 885 "day_hour", 886 "day_microsecond", 887 "day_minute", 888 "dayname", 889 "dayofmonth", 890 "dayofweek", 891 "dayofyear", 892 "day_second", 893 "deallocate", 894 "dec", 895 "decimal", 896 "declare", 897 "decode", 898 "default", 899 "defaults", 900 "deferrable", 901 "deferred", 902 "defined", 903 "definer", 904 "degrees", 905 "delayed", 906 "delay_key_write", 907 "delete", 908 "delimiter", 909 "delimiters", 910 "dense_rank", 911 "desc", 912 "describe", 913 "detach", 914 "deterministic", 915 "dictionary", 916 "differential", 917 "directory", 918 "disable", 919 "discard", 920 "_disconnect", 921 "disk", 922 "distinct", 923 "distinctrow", 924 "distributed_joins", 925 "div", 926 "do", 927 "document", 928 "domain", 929 "dot_product", 930 "double", 931 "drop", 932 "_drop_profile", 933 "dual", 934 "dump", 935 "duplicate", 936 "dynamic", 937 "earliest", 938 "each", 939 "echo", 940 "election", 941 "else", 942 "elseif", 943 "elt", 944 "enable", 945 "enclosed", 946 "encoding", 947 "encrypted", 948 "end", 949 "engine", 950 "engines", 951 "enum", 952 "errors", 953 "escape", 954 "escaped", 955 "estimate", 956 "euclidean_distance", 957 "event", 958 "events", 959 "except", 960 "exclude", 961 "excluding", 962 "exclusive", 963 "execute", 964 "exists", 965 "exit", 966 "exp", 967 "explain", 968 "extended", 969 "extension", 970 "external", 971 "external_host", 972 "external_port", 973 "extract", 974 "extractor", 975 "extractors", 976 "extra_join", 977 "_failover", 978 "failed_login_attempts", 979 "failure", 980 "false", 981 "family", 982 "fault", 983 "fetch", 984 "field", 985 "fields", 986 "file", 987 "files", 988 "fill", 989 "first", 990 "first_value", 991 "fix_alter", 992 "fixed", 993 "float", 994 "float4", 995 "float8", 996 "floor", 997 "flush", 998 "following", 999 "for", 1000 "force", 1001 "force_compiled_mode", 1002 "force_interpreter_mode", 1003 "foreground", 1004 "foreign", 1005 "format", 1006 "forward", 1007 "found_rows", 1008 "freeze", 1009 "from", 1010 "from_base64", 1011 "from_days", 1012 "from_unixtime", 1013 "fs", 1014 "_fsync", 1015 "full", 1016 "fulltext", 1017 "function", 1018 "functions", 1019 "gc", 1020 "gcs", 1021 "get_format", 1022 "_gc", 1023 "_gcx", 1024 "generate", 1025 "geography", 1026 "geography_area", 1027 "geography_contains", 1028 "geography_distance", 1029 "geography_intersects", 1030 "geography_latitude", 1031 "geography_length", 1032 "geography_longitude", 1033 "geographypoint", 1034 "geography_point", 1035 "geography_within_distance", 1036 "geometry", 1037 "geometry_area", 1038 "geometry_contains", 1039 "geometry_distance", 1040 "geometry_filter", 1041 "geometry_intersects", 1042 "geometry_length", 1043 "geometrypoint", 1044 "geometry_point", 1045 "geometry_within_distance", 1046 "geometry_x", 1047 "geometry_y", 1048 "global", 1049 "_global_version_timestamp", 1050 "grant", 1051 "granted", 1052 "grants", 1053 "greatest", 1054 "group", 1055 "grouping", 1056 "groups", 1057 "group_concat", 1058 "gzip", 1059 "handle", 1060 "handler", 1061 "hard_cpu_limit_percentage", 1062 "hash", 1063 "has_temp_tables", 1064 "having", 1065 "hdfs", 1066 "header", 1067 "heartbeat_no_logging", 1068 "hex", 1069 "highlight", 1070 "high_priority", 1071 "hold", 1072 "holding", 1073 "host", 1074 "hosts", 1075 "hour", 1076 "hour_microsecond", 1077 "hour_minute", 1078 "hour_second", 1079 "identified", 1080 "identity", 1081 "if", 1082 "ifnull", 1083 "ignore", 1084 "ilike", 1085 "immediate", 1086 "immutable", 1087 "implicit", 1088 "import", 1089 "in", 1090 "including", 1091 "increment", 1092 "incremental", 1093 "index", 1094 "indexes", 1095 "inet_aton", 1096 "inet_ntoa", 1097 "inet6_aton", 1098 "inet6_ntoa", 1099 "infile", 1100 "inherit", 1101 "inherits", 1102 "_init_profile", 1103 "init", 1104 "initcap", 1105 "initialize", 1106 "initially", 1107 "inject", 1108 "inline", 1109 "inner", 1110 "inout", 1111 "input", 1112 "insensitive", 1113 "insert", 1114 "insert_method", 1115 "instance", 1116 "instead", 1117 "instr", 1118 "int", 1119 "int1", 1120 "int2", 1121 "int3", 1122 "int4", 1123 "int8", 1124 "integer", 1125 "_internal_dynamic_typecast", 1126 "interpreter_mode", 1127 "intersect", 1128 "interval", 1129 "into", 1130 "invoker", 1131 "is", 1132 "isnull", 1133 "isolation", 1134 "iterate", 1135 "join", 1136 "json", 1137 "json_agg", 1138 "json_array_contains_double", 1139 "json_array_contains_json", 1140 "json_array_contains_string", 1141 "json_array_push_double", 1142 "json_array_push_json", 1143 "json_array_push_string", 1144 "json_delete_key", 1145 "json_extract_double", 1146 "json_extract_json", 1147 "json_extract_string", 1148 "json_extract_bigint", 1149 "json_get_type", 1150 "json_length", 1151 "json_set_double", 1152 "json_set_json", 1153 "json_set_string", 1154 "json_splice_double", 1155 "json_splice_json", 1156 "json_splice_string", 1157 "kafka", 1158 "key", 1159 "key_block_size", 1160 "keys", 1161 "kill", 1162 "killall", 1163 "label", 1164 "lag", 1165 "language", 1166 "large", 1167 "last", 1168 "last_day", 1169 "last_insert_id", 1170 "last_value", 1171 "lateral", 1172 "latest", 1173 "lc_collate", 1174 "lc_ctype", 1175 "lcase", 1176 "lead", 1177 "leading", 1178 "leaf", 1179 "leakproof", 1180 "least", 1181 "leave", 1182 "leaves", 1183 "left", 1184 "length", 1185 "level", 1186 "license", 1187 "like", 1188 "limit", 1189 "lines", 1190 "listen", 1191 "llvm", 1192 "ln", 1193 "load", 1194 "loaddata_where", 1195 "_load", 1196 "local", 1197 "localtime", 1198 "localtimestamp", 1199 "locate", 1200 "location", 1201 "lock", 1202 "log", 1203 "log10", 1204 "log2", 1205 "long", 1206 "longblob", 1207 "longtext", 1208 "loop", 1209 "lower", 1210 "low_priority", 1211 "lpad", 1212 "_ls", 1213 "ltrim", 1214 "lz4", 1215 "management", 1216 "_management_thread", 1217 "mapping", 1218 "master", 1219 "match", 1220 "materialized", 1221 "max", 1222 "maxvalue", 1223 "max_concurrency", 1224 "max_errors", 1225 "max_partitions_per_batch", 1226 "max_queue_depth", 1227 "max_retries_per_batch_partition", 1228 "max_rows", 1229 "mbc", 1230 "md5", 1231 "mpl", 1232 "median", 1233 "mediumblob", 1234 "mediumint", 1235 "mediumtext", 1236 "member", 1237 "memory", 1238 "memory_percentage", 1239 "_memsql_table_id_lookup", 1240 "memsql", 1241 "memsql_deserialize", 1242 "memsql_imitating_kafka", 1243 "memsql_serialize", 1244 "merge", 1245 "metadata", 1246 "microsecond", 1247 "middleint", 1248 "min", 1249 "min_rows", 1250 "minus", 1251 "minute", 1252 "minute_microsecond", 1253 "minute_second", 1254 "minvalue", 1255 "mod", 1256 "mode", 1257 "model", 1258 "modifies", 1259 "modify", 1260 "month", 1261 "monthname", 1262 "months_between", 1263 "move", 1264 "mpl", 1265 "names", 1266 "named", 1267 "namespace", 1268 "national", 1269 "natural", 1270 "nchar", 1271 "next", 1272 "no", 1273 "node", 1274 "none", 1275 "no_query_rewrite", 1276 "noparam", 1277 "not", 1278 "nothing", 1279 "notify", 1280 "now", 1281 "nowait", 1282 "no_write_to_binlog", 1283 "no_query_rewrite", 1284 "norely", 1285 "nth_value", 1286 "ntile", 1287 "null", 1288 "nullcols", 1289 "nullif", 1290 "nulls", 1291 "numeric", 1292 "nvarchar", 1293 "object", 1294 "octet_length", 1295 "of", 1296 "off", 1297 "offline", 1298 "offset", 1299 "offsets", 1300 "oids", 1301 "on", 1302 "online", 1303 "only", 1304 "open", 1305 "operator", 1306 "optimization", 1307 "optimize", 1308 "optimizer", 1309 "optimizer_state", 1310 "option", 1311 "options", 1312 "optionally", 1313 "or", 1314 "order", 1315 "ordered_serialize", 1316 "orphan", 1317 "out", 1318 "out_of_order", 1319 "outer", 1320 "outfile", 1321 "over", 1322 "overlaps", 1323 "overlay", 1324 "owned", 1325 "owner", 1326 "pack_keys", 1327 "paired", 1328 "parser", 1329 "parquet", 1330 "partial", 1331 "partition", 1332 "partition_id", 1333 "partitioning", 1334 "partitions", 1335 "passing", 1336 "password", 1337 "password_lock_time", 1338 "parser", 1339 "pause", 1340 "_pause_replay", 1341 "percent_rank", 1342 "percentile_cont", 1343 "percentile_disc", 1344 "periodic", 1345 "persisted", 1346 "pi", 1347 "pipeline", 1348 "pipelines", 1349 "pivot", 1350 "placing", 1351 "plan", 1352 "plans", 1353 "plancache", 1354 "plugins", 1355 "pool", 1356 "pools", 1357 "port", 1358 "position", 1359 "pow", 1360 "power", 1361 "preceding", 1362 "precision", 1363 "prepare", 1364 "prepared", 1365 "preserve", 1366 "primary", 1367 "prior", 1368 "privileges", 1369 "procedural", 1370 "procedure", 1371 "procedures", 1372 "process", 1373 "processlist", 1374 "profile", 1375 "profiles", 1376 "program", 1377 "promote", 1378 "proxy", 1379 "purge", 1380 "quarter", 1381 "queries", 1382 "query", 1383 "query_timeout", 1384 "queue", 1385 "quote", 1386 "radians", 1387 "rand", 1388 "range", 1389 "rank", 1390 "read", 1391 "_read", 1392 "reads", 1393 "real", 1394 "reassign", 1395 "rebalance", 1396 "recheck", 1397 "record", 1398 "recursive", 1399 "redundancy", 1400 "redundant", 1401 "ref", 1402 "reference", 1403 "references", 1404 "refresh", 1405 "regexp", 1406 "reindex", 1407 "relative", 1408 "release", 1409 "reload", 1410 "rely", 1411 "remote", 1412 "remove", 1413 "rename", 1414 "repair", 1415 "_repair_table", 1416 "repeat", 1417 "repeatable", 1418 "_repl", 1419 "_reprovisioning", 1420 "replace", 1421 "replica", 1422 "replicate", 1423 "replicating", 1424 "replication", 1425 "durability", 1426 "require", 1427 "resource", 1428 "resource_pool", 1429 "reset", 1430 "restart", 1431 "restore", 1432 "restrict", 1433 "result", 1434 "_resurrect", 1435 "retry", 1436 "return", 1437 "returning", 1438 "returns", 1439 "reverse", 1440 "revoke", 1441 "rg_pool", 1442 "right", 1443 "right_anti_join", 1444 "right_semi_join", 1445 "right_straight_join", 1446 "rlike", 1447 "role", 1448 "roles", 1449 "rollback", 1450 "rollup", 1451 "round", 1452 "routine", 1453 "row", 1454 "row_count", 1455 "row_format", 1456 "row_number", 1457 "rows", 1458 "rowstore", 1459 "rule", 1460 "rpad", 1461 "_rpc", 1462 "rtrim", 1463 "running", 1464 "s3", 1465 "safe", 1466 "save", 1467 "savepoint", 1468 "scalar", 1469 "schema", 1470 "schemas", 1471 "schema_binding", 1472 "scroll", 1473 "search", 1474 "second", 1475 "second_microsecond", 1476 "sec_to_time", 1477 "security", 1478 "select", 1479 "semi_join", 1480 "_send_threads", 1481 "sensitive", 1482 "separator", 1483 "sequence", 1484 "sequences", 1485 "serial", 1486 "serializable", 1487 "series", 1488 "service_user", 1489 "server", 1490 "session", 1491 "session_user", 1492 "set", 1493 "setof", 1494 "security_lists_intersect", 1495 "sha", 1496 "sha1", 1497 "sha2", 1498 "shard", 1499 "sharded", 1500 "sharded_id", 1501 "share", 1502 "show", 1503 "shutdown", 1504 "sigmoid", 1505 "sign", 1506 "signal", 1507 "similar", 1508 "simple", 1509 "site", 1510 "signed", 1511 "sin", 1512 "skip", 1513 "skipped_batches", 1514 "sleep", 1515 "_sleep", 1516 "smallint", 1517 "snapshot", 1518 "_snapshot", 1519 "_snapshots", 1520 "soft_cpu_limit_percentage", 1521 "some", 1522 "soname", 1523 "sparse", 1524 "spatial", 1525 "spatial_check_index", 1526 "specific", 1527 "split", 1528 "sql", 1529 "sql_big_result", 1530 "sql_buffer_result", 1531 "sql_cache", 1532 "sql_calc_found_rows", 1533 "sqlexception", 1534 "sql_mode", 1535 "sql_no_cache", 1536 "sql_no_logging", 1537 "sql_small_result", 1538 "sqlstate", 1539 "sqlwarning", 1540 "sqrt", 1541 "ssl", 1542 "stable", 1543 "standalone", 1544 "start", 1545 "starting", 1546 "state", 1547 "statement", 1548 "statistics", 1549 "stats", 1550 "status", 1551 "std", 1552 "stddev", 1553 "stddev_pop", 1554 "stddev_samp", 1555 "stdin", 1556 "stdout", 1557 "stop", 1558 "storage", 1559 "str_to_date", 1560 "straight_join", 1561 "strict", 1562 "string", 1563 "strip", 1564 "subdate", 1565 "substr", 1566 "substring", 1567 "substring_index", 1568 "success", 1569 "sum", 1570 "super", 1571 "symmetric", 1572 "sync_snapshot", 1573 "sync", 1574 "_sync", 1575 "_sync2", 1576 "_sync_partitions", 1577 "_sync_snapshot", 1578 "synchronize", 1579 "sysid", 1580 "system", 1581 "table", 1582 "table_checksum", 1583 "tables", 1584 "tablespace", 1585 "tags", 1586 "tan", 1587 "target_size", 1588 "task", 1589 "temp", 1590 "template", 1591 "temporary", 1592 "temptable", 1593 "_term_bump", 1594 "terminate", 1595 "terminated", 1596 "test", 1597 "text", 1598 "then", 1599 "time", 1600 "timediff", 1601 "time_bucket", 1602 "time_format", 1603 "timeout", 1604 "timestamp", 1605 "timestampadd", 1606 "timestampdiff", 1607 "timezone", 1608 "time_to_sec", 1609 "tinyblob", 1610 "tinyint", 1611 "tinytext", 1612 "to", 1613 "to_base64", 1614 "to_char", 1615 "to_date", 1616 "to_days", 1617 "to_json", 1618 "to_number", 1619 "to_seconds", 1620 "to_timestamp", 1621 "tracelogs", 1622 "traditional", 1623 "trailing", 1624 "transform", 1625 "transaction", 1626 "_transactions_experimental", 1627 "treat", 1628 "trigger", 1629 "triggers", 1630 "trim", 1631 "true", 1632 "trunc", 1633 "truncate", 1634 "trusted", 1635 "two_phase", 1636 "_twopcid", 1637 "type", 1638 "types", 1639 "ucase", 1640 "unbounded", 1641 "uncommitted", 1642 "undefined", 1643 "undo", 1644 "unencrypted", 1645 "unenforced", 1646 "unhex", 1647 "unhold", 1648 "unicode", 1649 "union", 1650 "unique", 1651 "_unittest", 1652 "unix_timestamp", 1653 "unknown", 1654 "unlisten", 1655 "_unload", 1656 "unlock", 1657 "unlogged", 1658 "unpivot", 1659 "unsigned", 1660 "until", 1661 "update", 1662 "upgrade", 1663 "upper", 1664 "usage", 1665 "use", 1666 "user", 1667 "users", 1668 "using", 1669 "utc_date", 1670 "utc_time", 1671 "utc_timestamp", 1672 "_utf8", 1673 "vacuum", 1674 "valid", 1675 "validate", 1676 "validator", 1677 "value", 1678 "values", 1679 "varbinary", 1680 "varchar", 1681 "varcharacter", 1682 "variables", 1683 "variadic", 1684 "variance", 1685 "var_pop", 1686 "var_samp", 1687 "varying", 1688 "vector_sub", 1689 "verbose", 1690 "version", 1691 "view", 1692 "void", 1693 "volatile", 1694 "voting", 1695 "wait", 1696 "_wake", 1697 "warnings", 1698 "week", 1699 "weekday", 1700 "weekofyear", 1701 "when", 1702 "where", 1703 "while", 1704 "whitespace", 1705 "window", 1706 "with", 1707 "without", 1708 "within", 1709 "_wm_heartbeat", 1710 "work", 1711 "workload", 1712 "wrapper", 1713 "write", 1714 "xact_id", 1715 "xor", 1716 "year", 1717 "year_month", 1718 "yes", 1719 "zerofill", 1720 "zone", 1721 } 1722 1723 def jsonextractscalar_sql(self, expression: exp.JSONExtractScalar) -> str: 1724 json_type = expression.args.get("json_type") 1725 func_name = "JSON_EXTRACT_JSON" if json_type is None else f"JSON_EXTRACT_{json_type}" 1726 return json_extract_segments(func_name)(self, expression) 1727 1728 def jsonbextractscalar_sql(self, expression: exp.JSONBExtractScalar) -> str: 1729 json_type = expression.args.get("json_type") 1730 func_name = "BSON_EXTRACT_BSON" if json_type is None else f"BSON_EXTRACT_{json_type}" 1731 return json_extract_segments(func_name)(self, expression) 1732 1733 def jsonextractarray_sql(self, expression: exp.JSONExtractArray) -> str: 1734 self.unsupported("Arrays are not supported in SingleStore") 1735 return self.function_fallback_sql(expression) 1736 1737 @unsupported_args("on_condition") 1738 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1739 res: exp.Expression = exp.JSONExtractScalar( 1740 this=expression.this, 1741 expression=expression.args.get("path"), 1742 json_type="STRING", 1743 ) 1744 1745 returning = expression.args.get("returning") 1746 if returning is not None: 1747 res = exp.Cast(this=res, to=returning) 1748 1749 return self.sql(res) 1750 1751 def all_sql(self, expression: exp.All) -> str: 1752 self.unsupported("ALL subquery predicate is not supported in SingleStore") 1753 return super().all_sql(expression) 1754 1755 def jsonarraycontains_sql(self, expression: exp.JSONArrayContains) -> str: 1756 json_type = expression.text("json_type").upper() 1757 1758 if json_type: 1759 return self.func( 1760 f"JSON_ARRAY_CONTAINS_{json_type}", expression.expression, expression.this 1761 ) 1762 1763 return self.func( 1764 "JSON_ARRAY_CONTAINS_JSON", 1765 expression.expression, 1766 self.func("TO_JSON", expression.this), 1767 ) 1768 1769 @unsupported_args("kind", "values") 1770 def datatype_sql(self, expression: exp.DataType) -> str: 1771 if expression.args.get("nested") and not expression.is_type(exp.DataType.Type.STRUCT): 1772 self.unsupported( 1773 f"Argument 'nested' is not supported for representation of '{expression.this.value}' in SingleStore" 1774 ) 1775 1776 if expression.is_type(exp.DataType.Type.VARBINARY) and not expression.expressions: 1777 # `VARBINARY` must always have a size - if it doesn't, we always generate `BLOB` 1778 return "BLOB" 1779 if expression.is_type( 1780 exp.DataType.Type.DECIMAL32, 1781 exp.DataType.Type.DECIMAL64, 1782 exp.DataType.Type.DECIMAL128, 1783 exp.DataType.Type.DECIMAL256, 1784 ): 1785 scale = self.expressions(expression, flat=True) 1786 1787 if expression.is_type(exp.DataType.Type.DECIMAL32): 1788 precision = "9" 1789 elif expression.is_type(exp.DataType.Type.DECIMAL64): 1790 precision = "18" 1791 elif expression.is_type(exp.DataType.Type.DECIMAL128): 1792 precision = "38" 1793 else: 1794 # 65 is a maximum precision supported in SingleStore 1795 precision = "65" 1796 if scale is not None: 1797 return f"DECIMAL({precision}, {scale[0]})" 1798 else: 1799 return f"DECIMAL({precision})" 1800 if expression.is_type(exp.DataType.Type.VECTOR): 1801 expressions = expression.expressions 1802 if len(expressions) == 2: 1803 type_name = self.sql(expressions[0]) 1804 if type_name in self.dialect.INVERSE_VECTOR_TYPE_ALIASES: 1805 type_name = self.dialect.INVERSE_VECTOR_TYPE_ALIASES[type_name] 1806 1807 return f"VECTOR({self.sql(expressions[1])}, {type_name})" 1808 1809 return super().datatype_sql(expression) 1810 1811 def collate_sql(self, expression: exp.Collate) -> str: 1812 # SingleStore does not support setting a collation for column in the SELECT query, 1813 # so we cast column to a LONGTEXT type with specific collation 1814 return self.binary(expression, ":> LONGTEXT COLLATE") 1815 1816 def currentdate_sql(self, expression: exp.CurrentDate) -> str: 1817 timezone = expression.this 1818 if timezone: 1819 if isinstance(timezone, exp.Literal) and timezone.name.lower() == "utc": 1820 return self.func("UTC_DATE") 1821 self.unsupported("CurrentDate with timezone is not supported in SingleStore") 1822 1823 return self.func("CURRENT_DATE") 1824 1825 def currenttime_sql(self, expression: exp.CurrentTime) -> str: 1826 arg = expression.this 1827 if arg: 1828 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1829 return self.func("UTC_TIME") 1830 if isinstance(arg, exp.Literal) and arg.is_number: 1831 return self.func("CURRENT_TIME", arg) 1832 self.unsupported("CurrentTime with timezone is not supported in SingleStore") 1833 1834 return self.func("CURRENT_TIME") 1835 1836 def currenttimestamp_sql(self, expression: exp.CurrentTimestamp) -> str: 1837 arg = expression.this 1838 if arg: 1839 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1840 return self.func("UTC_TIMESTAMP") 1841 if isinstance(arg, exp.Literal) and arg.is_number: 1842 return self.func("CURRENT_TIMESTAMP", arg) 1843 self.unsupported("CurrentTimestamp with timezone is not supported in SingleStore") 1844 1845 return self.func("CURRENT_TIMESTAMP") 1846 1847 def standardhash_sql(self, expression: exp.StandardHash) -> str: 1848 hash_function = expression.expression 1849 if hash_function is None: 1850 return self.func("SHA", expression.this) 1851 if isinstance(hash_function, exp.Literal): 1852 if hash_function.name.lower() == "sha": 1853 return self.func("SHA", expression.this) 1854 if hash_function.name.lower() == "md5": 1855 return self.func("MD5", expression.this) 1856 1857 self.unsupported( 1858 f"{hash_function.this} hash method is not supported in SingleStore" 1859 ) 1860 return self.func("SHA", expression.this) 1861 1862 self.unsupported("STANDARD_HASH function is not supported in SingleStore") 1863 return self.func("SHA", expression.this) 1864 1865 @unsupported_args("is_database", "exists", "cluster", "identity", "option", "partition") 1866 def truncatetable_sql(self, expression: exp.TruncateTable) -> str: 1867 statements = [] 1868 for expression in expression.expressions: 1869 statements.append(f"TRUNCATE {self.sql(expression)}") 1870 1871 return "; ".join(statements) 1872 1873 @unsupported_args("exists") 1874 def renamecolumn_sql(self, expression: exp.RenameColumn) -> str: 1875 old_column = self.sql(expression, "this") 1876 new_column = self.sql(expression, "to") 1877 return f"CHANGE {old_column} {new_column}" 1878 1879 @unsupported_args("drop", "comment", "allow_null", "visible", "using") 1880 def altercolumn_sql(self, expression: exp.AlterColumn) -> str: 1881 alter = super().altercolumn_sql(expression) 1882 1883 collate = self.sql(expression, "collate") 1884 collate = f" COLLATE {collate}" if collate else "" 1885 return f"{alter}{collate}" 1886 1887 def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint) -> str: 1888 this = self.sql(expression, "this") 1889 not_null = " NOT NULL" if expression.args.get("not_null") else "" 1890 type = self.sql(expression, "data_type") or "AUTO" 1891 return f"AS {this} PERSISTED {type}{not_null}"
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.
VECTOR_TYPE_ALIASES =
{'I8': 'TINYINT', 'I16': 'SMALLINT', 'I32': 'INT', 'I64': 'BIGINT', 'F32': 'FLOAT', 'F64': 'DOUBLE'}
INVERSE_VECTOR_TYPE_ALIASES =
{'TINYINT': 'I8', 'SMALLINT': 'I16', 'INT': 'I32', 'BIGINT': 'I64', 'FLOAT': 'F32', 'DOUBLE': 'F64'}
VALID_INTERVAL_UNITS: Set[str] =
{'MONTH', 'NSEC', 'MICROSEC', 'DAY OF YEAR', 'QTR', 'MSECONDS', 'WK', 'SECONDS', 'EPOCH', 'MINUTE', 'USECS', 'EPOCH_NANOSECONDS', 'NSECONDS', 'YEARS', 'MILLISECOND', 'MILLISECON', 'Y', 'HH', 'EPOCH_MICROSECONDS', 'HOUR_MINUTE', 'MICROSECOND', 'TIMEZONE_HOUR', 'CENTURY', 'HOUR_MICROSECOND', 'CENT', 'WY', 'M', 'MICROSECONDS', 'H', 'MM', 'YR', 'QUARTER', 'YY', 'CENTS', 'YEAR', 'WOY', 'DECADE', 'DOW', 'DAY_SECOND', 'W', 'DOY', 'WEEKDAY', 'DAYS', 'US', 'SEC', 'EPOCH_SECONDS', 'DOW_ISO', 'NS', 'YYYY', 'Q', 'MI', 'MINUTES', 'WEEKOFYEAR', 'NANOSEC', 'DAYOFMONTH', 'S', 'MILLISECS', 'DD', 'HOUR', 'MINUTE_MICROSECOND', 'MINS', 'DEC', 'SECOND', 'YRS', 'MS', 'YEAR_MONTH', 'MILLISECONDS', 'MILLISEC', 'WEEKOFYEARISO', 'SECS', 'MIN', 'WEEK_ISO', 'MONS', 'DY', 'DAYOFWEEKISO', 'EPOCH_NANOSECOND', 'DAYOFWEEK', 'EPOCH_SECOND', 'DAY_MINUTE', 'WEEKISO', 'MIL', 'TIMEZONE_MINUTE', 'MILLENIA', 'NANOSECOND', 'HOUR_SECOND', 'DW', 'DECADES', 'DW_ISO', 'NSECOND', 'DAY', 'DAY OF WEEK', 'MICROSECS', 'QUARTERS', 'MILS', 'USECOND', 'DAY_MICROSECOND', 'HR', 'D', 'MSECOND', 'USEC', 'USECONDS', 'CENTURIES', 'DECS', 'HRS', 'WEEK', 'MONTHS', 'C', 'MILLENNIUM', 'NANOSECS', 'WEEKOFYEAR_ISO', 'MINUTE_SECOND', 'TZH', 'SECOND_MICROSECOND', 'TZM', 'YYY', 'WEEKDAY_ISO', 'EPOCH_MICROSECOND', 'DAYOFWEEK_ISO', 'MSEC', 'DAYOFYEAR', 'HOURS', 'MSECS', 'MON', 'QTRS', 'EPOCH_MILLISECOND', 'EPOCH_MILLISECONDS', 'DAY_HOUR'}
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}}}
ESCAPED_SEQUENCES: Dict[str, str] =
{'\x07': '\\a', '\x08': '\\b', '\x0c': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\x0b': '\\v', '\\': '\\\\'}
Inherited Members
- sqlglot.dialects.mysql.MySQL
- PROMOTE_TO_INFERRED_DATETIME_TYPE
- IDENTIFIERS_CAN_START_WITH_DIGIT
- NORMALIZATION_STRATEGY
- TIME_FORMAT
- DPIPE_IS_STRING_CONCAT
- SUPPORTS_USER_DEFINED_TYPES
- SUPPORTS_SEMI_ANTI_JOIN
- SAFE_DIVISION
- SAFE_TO_ELIMINATE_DOUBLE_NEGATION
- LEAST_GREATEST_IGNORES_NULLS
- EXPRESSION_METADATA
70 class Tokenizer(MySQL.Tokenizer): 71 BYTE_STRINGS = [("e'", "'"), ("E'", "'")] 72 73 KEYWORDS = { 74 **MySQL.Tokenizer.KEYWORDS, 75 "BSON": TokenType.JSONB, 76 "GEOGRAPHYPOINT": TokenType.GEOGRAPHYPOINT, 77 "TIMESTAMP": TokenType.TIMESTAMP, 78 "UTC_DATE": TokenType.UTC_DATE, 79 "UTC_TIME": TokenType.UTC_TIME, 80 "UTC_TIMESTAMP": TokenType.UTC_TIMESTAMP, 81 ":>": TokenType.COLON_GT, 82 "!:>": TokenType.NCOLON_GT, 83 "::$": TokenType.DCOLONDOLLAR, 84 "::%": TokenType.DCOLONPERCENT, 85 "::?": TokenType.DCOLONQMARK, 86 "RECORD": TokenType.STRUCT, 87 }
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.AMP_LT: 'AMP_LT'>, '&>': <TokenType.AMP_GT: 'AMP_GT'>, '==': <TokenType.EQ: 'EQ'>, '::': <TokenType.DCOLON: 'DCOLON'>, '?::': <TokenType.QDCOLON: 'QDCOLON'>, '||': <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'>, '-|-': <TokenType.ADJACENT: 'ADJACENT'>, 'ALL': <TokenType.ALL: 'ALL'>, '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'>, 'CURRENT_CATALOG': <TokenType.CURRENT_CATALOG: 'CURRENT_CATALOG'>, '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'>, 'FILE': <TokenType.FILE: 'FILE'>, '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'>, 'LOCALTIME': <TokenType.LOCALTIME: 'LOCALTIME'>, 'LOCALTIMESTAMP': <TokenType.LOCALTIMESTAMP: 'LOCALTIMESTAMP'>, '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'>, 'OUT': <TokenType.OUT: 'OUT'>, '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'>, 'OPERATOR': <TokenType.OPERATOR: 'OPERATOR'>, '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'>, 'SESSION': <TokenType.SESSION: 'SESSION'>, 'SESSION_USER': <TokenType.SESSION_USER: 'SESSION_USER'>, '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'>, 'DECFLOAT': <TokenType.DECFLOAT: 'DECFLOAT'>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, 'BIGNUM': <TokenType.BIGNUM: 'BIGNUM'>, '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'>, 'TIME_NS': <TokenType.TIME_NS: 'TIME_NS'>, 'TIMESTAMP': <TokenType.TIMESTAMP: 'TIMESTAMP'>, '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'>, 'REVOKE': <TokenType.REVOKE: 'REVOKE'>, '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'>, 'MOD': <TokenType.MOD: 'MOD'>, 'SEPARATOR': <TokenType.SEPARATOR: 'SEPARATOR'>, 'SERIAL': <TokenType.SERIAL: 'SERIAL'>, 'SIGNED': <TokenType.BIGINT: 'BIGINT'>, 'SIGNED INTEGER': <TokenType.BIGINT: 'BIGINT'>, 'SOUNDS LIKE': <TokenType.SOUNDS_LIKE: 'SOUNDS_LIKE'>, 'START': <TokenType.BEGIN: 'BEGIN'>, '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'>, 'UTC_DATE': <TokenType.UTC_DATE: 'UTC_DATE'>, 'UTC_TIME': <TokenType.UTC_TIME: 'UTC_TIME'>, 'UTC_TIMESTAMP': <TokenType.UTC_TIMESTAMP: 'UTC_TIMESTAMP'>, ':>': <TokenType.COLON_GT: 'COLON_GT'>, '!:>': <TokenType.NCOLON_GT: 'NCOLON_GT'>, '::$': <TokenType.DCOLONDOLLAR: 'DCOLONDOLLAR'>, '::%': <TokenType.DCOLONPERCENT: 'DCOLONPERCENT'>, '::?': <TokenType.DCOLONQMARK: 'DCOLONQMARK'>, 'RECORD': <TokenType.STRUCT: 'STRUCT'>}
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
89 class Parser(MySQL.Parser): 90 FUNCTIONS = { 91 **MySQL.Parser.FUNCTIONS, 92 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "singlestore"), 93 "TO_TIMESTAMP": build_formatted_time(exp.StrToTime, "singlestore"), 94 "TO_CHAR": build_formatted_time(exp.ToChar, "singlestore"), 95 "STR_TO_DATE": build_formatted_time(exp.StrToDate, "mysql"), 96 "DATE_FORMAT": build_formatted_time(exp.TimeToStr, "mysql"), 97 # The first argument of following functions is converted to TIME(6) 98 # This is needed because exp.TimeToStr is converted to DATE_FORMAT 99 # which interprets the first argument as DATETIME and fails to parse 100 # string literals like '12:05:47' without a date part. 101 "TIME_FORMAT": lambda args: exp.TimeToStr( 102 this=cast_to_time6(seq_get(args, 0)), 103 format=MySQL.format_time(seq_get(args, 1)), 104 ), 105 "HOUR": lambda args: exp.cast( 106 exp.TimeToStr( 107 this=cast_to_time6(seq_get(args, 0)), 108 format=MySQL.format_time(exp.Literal.string("%k")), 109 ), 110 DataType.Type.INT, 111 ), 112 "MICROSECOND": lambda args: exp.cast( 113 exp.TimeToStr( 114 this=cast_to_time6(seq_get(args, 0)), 115 format=MySQL.format_time(exp.Literal.string("%f")), 116 ), 117 DataType.Type.INT, 118 ), 119 "SECOND": lambda args: exp.cast( 120 exp.TimeToStr( 121 this=cast_to_time6(seq_get(args, 0)), 122 format=MySQL.format_time(exp.Literal.string("%s")), 123 ), 124 DataType.Type.INT, 125 ), 126 "MINUTE": lambda args: exp.cast( 127 exp.TimeToStr( 128 this=cast_to_time6(seq_get(args, 0)), 129 format=MySQL.format_time(exp.Literal.string("%i")), 130 ), 131 DataType.Type.INT, 132 ), 133 "MONTHNAME": lambda args: exp.TimeToStr( 134 this=seq_get(args, 0), 135 format=MySQL.format_time(exp.Literal.string("%M")), 136 ), 137 "WEEKDAY": lambda args: exp.paren(exp.DayOfWeek(this=seq_get(args, 0)) + 5, copy=False) 138 % 7, 139 "UNIX_TIMESTAMP": exp.StrToUnix.from_arg_list, 140 "FROM_UNIXTIME": build_formatted_time(exp.UnixToTime, "mysql"), 141 "TIME_BUCKET": lambda args: exp.DateBin( 142 this=seq_get(args, 0), 143 expression=seq_get(args, 1), 144 origin=seq_get(args, 2), 145 ), 146 "BSON_EXTRACT_BSON": build_json_extract_path(exp.JSONBExtract), 147 "BSON_EXTRACT_STRING": build_json_extract_path( 148 exp.JSONBExtractScalar, json_type="STRING" 149 ), 150 "BSON_EXTRACT_DOUBLE": build_json_extract_path( 151 exp.JSONBExtractScalar, json_type="DOUBLE" 152 ), 153 "BSON_EXTRACT_BIGINT": build_json_extract_path( 154 exp.JSONBExtractScalar, json_type="BIGINT" 155 ), 156 "JSON_EXTRACT_JSON": build_json_extract_path(exp.JSONExtract), 157 "JSON_EXTRACT_STRING": build_json_extract_path( 158 exp.JSONExtractScalar, json_type="STRING" 159 ), 160 "JSON_EXTRACT_DOUBLE": build_json_extract_path( 161 exp.JSONExtractScalar, json_type="DOUBLE" 162 ), 163 "JSON_EXTRACT_BIGINT": build_json_extract_path( 164 exp.JSONExtractScalar, json_type="BIGINT" 165 ), 166 "JSON_ARRAY_CONTAINS_STRING": lambda args: exp.JSONArrayContains( 167 this=seq_get(args, 1), 168 expression=seq_get(args, 0), 169 json_type="STRING", 170 ), 171 "JSON_ARRAY_CONTAINS_DOUBLE": lambda args: exp.JSONArrayContains( 172 this=seq_get(args, 1), 173 expression=seq_get(args, 0), 174 json_type="DOUBLE", 175 ), 176 "JSON_ARRAY_CONTAINS_JSON": lambda args: exp.JSONArrayContains( 177 this=seq_get(args, 1), 178 expression=seq_get(args, 0), 179 json_type="JSON", 180 ), 181 "JSON_KEYS": lambda args: exp.JSONKeys( 182 this=seq_get(args, 0), 183 expressions=args[1:], 184 ), 185 "JSON_PRETTY": exp.JSONFormat.from_arg_list, 186 "JSON_BUILD_ARRAY": lambda args: exp.JSONArray(expressions=args), 187 "JSON_BUILD_OBJECT": lambda args: exp.JSONObject(expressions=args), 188 "DATE": exp.Date.from_arg_list, 189 "DAYNAME": lambda args: exp.TimeToStr( 190 this=seq_get(args, 0), 191 format=MySQL.format_time(exp.Literal.string("%W")), 192 ), 193 "TIMESTAMPDIFF": lambda args: exp.TimestampDiff( 194 this=seq_get(args, 2), 195 expression=seq_get(args, 1), 196 unit=seq_get(args, 0), 197 ), 198 "APPROX_COUNT_DISTINCT": exp.Hll.from_arg_list, 199 "APPROX_PERCENTILE": lambda args, dialect: exp.ApproxQuantile( 200 this=seq_get(args, 0), 201 quantile=seq_get(args, 1), 202 error_tolerance=seq_get(args, 2), 203 ), 204 "VARIANCE": exp.VariancePop.from_arg_list, 205 "INSTR": exp.Contains.from_arg_list, 206 "REGEXP_MATCH": lambda args: exp.RegexpExtractAll( 207 this=seq_get(args, 0), 208 expression=seq_get(args, 1), 209 parameters=seq_get(args, 2), 210 ), 211 "REGEXP_SUBSTR": lambda args: exp.RegexpExtract( 212 this=seq_get(args, 0), 213 expression=seq_get(args, 1), 214 position=seq_get(args, 2), 215 occurrence=seq_get(args, 3), 216 parameters=seq_get(args, 4), 217 ), 218 "REDUCE": lambda args: exp.Reduce( 219 initial=seq_get(args, 0), 220 this=seq_get(args, 1), 221 merge=seq_get(args, 2), 222 ), 223 } 224 225 FUNCTION_PARSERS: t.Dict[str, t.Callable] = { 226 **MySQL.Parser.FUNCTION_PARSERS, 227 "JSON_AGG": lambda self: exp.JSONArrayAgg( 228 this=self._parse_term(), 229 order=self._parse_order(), 230 ), 231 } 232 233 NO_PAREN_FUNCTIONS = { 234 **MySQL.Parser.NO_PAREN_FUNCTIONS, 235 TokenType.UTC_DATE: exp.UtcDate, 236 TokenType.UTC_TIME: exp.UtcTime, 237 TokenType.UTC_TIMESTAMP: exp.UtcTimestamp, 238 } 239 240 CAST_COLUMN_OPERATORS = {TokenType.COLON_GT, TokenType.NCOLON_GT} 241 242 COLUMN_OPERATORS = { 243 **MySQL.Parser.COLUMN_OPERATORS, 244 TokenType.COLON_GT: lambda self, this, to: self.expression( 245 exp.Cast, 246 this=this, 247 to=to, 248 ), 249 TokenType.NCOLON_GT: lambda self, this, to: self.expression( 250 exp.TryCast, 251 this=this, 252 to=to, 253 ), 254 TokenType.DCOLON: lambda self, this, path: build_json_extract_path(exp.JSONExtract)( 255 [this, exp.Literal.string(path.name)] 256 ), 257 TokenType.DCOLONDOLLAR: lambda self, this, path: build_json_extract_path( 258 exp.JSONExtractScalar, json_type="STRING" 259 )([this, exp.Literal.string(path.name)]), 260 TokenType.DCOLONPERCENT: lambda self, this, path: build_json_extract_path( 261 exp.JSONExtractScalar, json_type="DOUBLE" 262 )([this, exp.Literal.string(path.name)]), 263 TokenType.DCOLONQMARK: lambda self, this, path: self.expression( 264 exp.JSONExists, 265 this=this, 266 path=path.name, 267 from_dcolonqmark=True, 268 ), 269 } 270 COLUMN_OPERATORS.pop(TokenType.ARROW) 271 COLUMN_OPERATORS.pop(TokenType.DARROW) 272 COLUMN_OPERATORS.pop(TokenType.HASH_ARROW) 273 COLUMN_OPERATORS.pop(TokenType.DHASH_ARROW) 274 COLUMN_OPERATORS.pop(TokenType.PLACEHOLDER) 275 276 SHOW_PARSERS = { 277 **MySQL.Parser.SHOW_PARSERS, 278 "AGGREGATES": _show_parser("AGGREGATES"), 279 "CDC EXTRACTOR POOL": _show_parser("CDC EXTRACTOR POOL"), 280 "CREATE AGGREGATE": _show_parser("CREATE AGGREGATE", target=True), 281 "CREATE PIPELINE": _show_parser("CREATE PIPELINE", target=True), 282 "CREATE PROJECTION": _show_parser("CREATE PROJECTION", target=True), 283 "DATABASE STATUS": _show_parser("DATABASE STATUS"), 284 "DISTRIBUTED_PLANCACHE STATUS": _show_parser("DISTRIBUTED_PLANCACHE STATUS"), 285 "FULLTEXT SERVICE METRICS LOCAL": _show_parser("FULLTEXT SERVICE METRICS LOCAL"), 286 "FULLTEXT SERVICE METRICS FOR NODE": _show_parser( 287 "FULLTEXT SERVICE METRICS FOR NODE", target=True 288 ), 289 "FULLTEXT SERVICE STATUS": _show_parser("FULLTEXT SERVICE STATUS"), 290 "FUNCTIONS": _show_parser("FUNCTIONS"), 291 "GROUPS": _show_parser("GROUPS"), 292 "GROUPS FOR ROLE": _show_parser("GROUPS FOR ROLE", target=True), 293 "GROUPS FOR USER": _show_parser("GROUPS FOR USER", target=True), 294 "INDEXES": _show_parser("INDEX", target="FROM"), 295 "KEYS": _show_parser("INDEX", target="FROM"), 296 "LINKS": _show_parser("LINKS", target="ON"), 297 "LOAD ERRORS": _show_parser("LOAD ERRORS"), 298 "LOAD WARNINGS": _show_parser("LOAD WARNINGS"), 299 "PARTITIONS": _show_parser("PARTITIONS", target="ON"), 300 "PIPELINES": _show_parser("PIPELINES"), 301 "PLAN": _show_parser("PLAN", target=True), 302 "PLANCACHE": _show_parser("PLANCACHE"), 303 "PROCEDURES": _show_parser("PROCEDURES"), 304 "PROJECTIONS": _show_parser("PROJECTIONS", target="ON TABLE"), 305 "REPLICATION STATUS": _show_parser("REPLICATION STATUS"), 306 "REPRODUCTION": _show_parser("REPRODUCTION"), 307 "RESOURCE POOLS": _show_parser("RESOURCE POOLS"), 308 "ROLES": _show_parser("ROLES"), 309 "ROLES FOR USER": _show_parser("ROLES FOR USER", target=True), 310 "ROLES FOR GROUP": _show_parser("ROLES FOR GROUP", target=True), 311 "STATUS EXTENDED": _show_parser("STATUS EXTENDED"), 312 "USERS": _show_parser("USERS"), 313 "USERS FOR ROLE": _show_parser("USERS FOR ROLE", target=True), 314 "USERS FOR GROUP": _show_parser("USERS FOR GROUP", target=True), 315 } 316 317 ALTER_PARSERS = { 318 **MySQL.Parser.ALTER_PARSERS, 319 "CHANGE": lambda self: self.expression( 320 exp.RenameColumn, this=self._parse_column(), to=self._parse_column() 321 ), 322 } 323 324 def _parse_vector_expressions( 325 self, expressions: t.List[exp.Expression] 326 ) -> t.List[exp.Expression]: 327 type_name = expressions[1].name.upper() 328 if type_name in self.dialect.VECTOR_TYPE_ALIASES: 329 type_name = self.dialect.VECTOR_TYPE_ALIASES[type_name] 330 331 return [exp.DataType.build(type_name, dialect=self.dialect), expressions[0]]
Parser consumes a list of tokens produced by the Tokenizer and produces a parsed syntax tree.
Arguments:
- error_level: The desired error level. Default: ErrorLevel.IMMEDIATE
- error_message_context: The amount of context to capture from a query string when displaying the error message (in number of characters). Default: 100
- max_errors: Maximum number of error messages to include in a raised ParseError. This is only relevant if error_level is ErrorLevel.RAISE. Default: 3
FUNCTIONS =
{'AI_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AIAgg'>>, 'AI_CLASSIFY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AIClassify'>>, 'AI_SUMMARIZE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AISummarizeAgg'>>, 'ABS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Abs'>>, 'ACOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Acos'>>, 'ACOSH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Acosh'>>, 'ADD_MONTHS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AddMonths'>>, 'AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.And'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnonymousAggFunc'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'APPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Apply'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'APPROX_PERCENTILE_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileAccumulate'>>, 'APPROX_PERCENTILE_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileCombine'>>, 'APPROX_PERCENTILE_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileEstimate'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantile'>>, 'APPROX_QUANTILES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantiles'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopK'>>, 'APPROX_TOP_K_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKAccumulate'>>, 'APPROX_TOP_K_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKCombine'>>, 'APPROX_TOP_K_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKEstimate'>>, 'APPROX_TOP_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopSum'>>, 'APPROXIMATE_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, 'APPROXIMATE_JACCARD_INDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARGMAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'MAX_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARGMIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'MIN_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARRAY': <function Parser.<lambda>>, 'ARRAY_AGG': <function Parser.<lambda>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAll'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAny'>>, 'ARRAY_APPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAppend'>>, '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_PREPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayPrepend'>>, 'ARRAY_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayRemove'>>, 'ARRAY_REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayReverse'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySlice'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ascii'>>, 'ASIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asin'>>, 'ASINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asinh'>>, 'ATAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan'>>, 'ATAN2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan2'>>, 'ATANH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atanh'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeBinary'>>, 'BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeString'>>, 'BASE64_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64Encode'>>, 'BIT_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitLength'>>, 'BITMAP_BIT_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBitPosition'>>, 'BITMAP_BUCKET_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBucketNumber'>>, 'BITMAP_CONSTRUCT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapConstructAgg'>>, 'BITMAP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapCount'>>, 'BITMAP_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapOrAgg'>>, 'BITWISE_AND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BITWISE_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCount'>>, 'BITWISE_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseOrAgg'>>, 'BITWISE_XOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseXorAgg'>>, 'BOOLAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Booland'>>, 'BOOLNOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolnot'>>, 'BOOLOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolor'>>, 'BOOLXOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BoolxorAgg'>>, 'BYTE_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ByteLength'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHECK_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckJson'>>, 'CHECK_XML': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckXml'>>, 'CHR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'COALESCE': <function build_coalesce>, 'IFNULL': <function build_coalesce>, 'NVL': <function build_coalesce>, 'CODE_POINTS_TO_BYTES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToBytes'>>, 'CODE_POINTS_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToString'>>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COLLATION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collation'>>, 'COLUMNS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Columns'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedAggFunc'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedParameterizedAgg'>>, 'COMPRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Compress'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConnectByRoot'>>, 'CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, 'CONVERT_TO_CHARSET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConvertToCharset'>>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cos'>>, 'COSH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cosh'>>, 'COSINE_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CosineDistance'>>, 'COT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cot'>>, 'COTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coth'>>, 'COUNT': <function Parser.<lambda>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COVAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarPop'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarSamp'>>, 'CSC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csc'>>, 'CSCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csch'>>, 'CUME_DIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CumeDist'>>, 'CURRENT_ACCOUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccount'>>, 'CURRENT_ACCOUNT_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccountName'>>, 'CURRENT_AVAILABLE_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAvailableRoles'>>, 'CURRENT_CATALOG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentCatalog'>>, 'CURRENT_CLIENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentClient'>>, 'CURRENT_DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatabase'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_IP_ADDRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentIpAddress'>>, 'CURRENT_ORGANIZATION_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationName'>>, 'CURRENT_ORGANIZATION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationUser'>>, 'CURRENT_REGION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRegion'>>, 'CURRENT_ROLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRole'>>, 'CURRENT_ROLE_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRoleType'>>, 'CURRENT_SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'CURRENT_SCHEMAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchemas'>>, 'CURRENT_SECONDARY_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSecondaryRoles'>>, 'CURRENT_SESSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSession'>>, 'CURRENT_STATEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentStatement'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTime'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'CURRENT_TIMESTAMP_L_T_Z': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestampLTZ'>>, 'CURRENT_TIMEZONE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimezone'>>, 'CURRENT_TRANSACTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTransaction'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'CURRENT_VERSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentVersion'>>, 'CURRENT_WAREHOUSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentWarehouse'>>, 'DATE': <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>>, 'DAYNAME': <function SingleStore.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'>>, 'DECOMPRESS_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressBinary'>>, 'DECOMPRESS_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressString'>>, 'DECRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decrypt'>>, 'DECRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecryptRaw'>>, 'DEGREES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Degrees'>>, 'DENSE_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DenseRank'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DiToDate'>>, 'DOT_PRODUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DotProduct'>>, 'ELT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Elt'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'ENCRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encrypt'>>, 'ENCRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EncryptRaw'>>, 'ENDS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'ENDSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'EQUAL_NULL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EqualNull'>>, 'EUCLIDEAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EuclideanDistance'>>, 'EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exists'>>, 'EXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exp'>>, 'EXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Explode'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodeOuter'>>, 'EXPLODING_GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodingGenerateSeries'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, 'FACTORIAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Factorial'>>, 'FARM_FINGERPRINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FARMFINGERPRINT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FEATURES_AT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FeaturesAtTime'>>, 'FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.First'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FirstValue'>>, 'FLATTEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Flatten'>>, 'FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Float64'>>, 'FLOOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Floor'>>, 'FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase'>>, 'FROM_BASE32': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase32'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase64'>>, 'FROM_ISO8601_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromISO8601Timestamp'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <function Parser.<lambda>>, 'GENERATE_EMBEDDING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateEmbedding'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, 'GET_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GetExtract'>>, 'GETBIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GET_BIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GREATEST': <function Parser.<lambda>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'GROUPING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Grouping'>>, 'GROUPING_ID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupingId'>>, 'HASH_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HashAgg'>>, 'HEX': <function build_hex>, 'HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexDecodeString'>>, 'HEX_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexEncode'>>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'HOUR': <function SingleStore.Parser.<lambda>>, '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'>>, 'IS_NULL_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNullValue'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArray'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAgg'>>, 'JSON_ARRAY_APPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAppend'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayContains'>>, 'JSON_ARRAY_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayInsert'>>, 'JSONB_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContains'>>, 'J_S_O_N_B_CONTAINS_ALL_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>>, 'J_S_O_N_B_CONTAINS_ANY_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAnyTopKeys'>>, 'J_S_O_N_B_DELETE_AT_PATH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBDeleteAtPath'>>, 'JSONB_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExists'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtract'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtractScalar'>>, 'J_S_O_N_B_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBObjectAgg'>>, 'J_S_O_N_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBool'>>, 'J_S_O_N_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONCast'>>, 'J_S_O_N_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExists'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExtractArray'>>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONFormat'>>, 'JSON_KEYS': <function SingleStore.Parser.<lambda>>, 'J_S_O_N_KEYS_AT_DEPTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONKeysAtDepth'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObject'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObjectAgg'>>, 'JSON_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONRemove'>>, 'JSON_SET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONSet'>>, 'JSON_STRIP_NULLS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONStripNulls'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONTable'>>, 'JSON_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONType'>>, 'J_S_O_N_VALUE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONValueArray'>>, 'JAROWINKLER_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JarowinklerSimilarity'>>, 'JUSTIFY_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyDays'>>, 'JUSTIFY_HOURS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyHours'>>, 'JUSTIFY_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyInterval'>>, 'KURTOSIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Kurtosis'>>, 'LAG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lag'>>, 'LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Last'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastValue'>>, 'LAX_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxBool'>>, 'LAX_FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxFloat64'>>, 'LAX_INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxInt64'>>, 'LAX_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxString'>>, 'LEAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lead'>>, 'LEAST': <function Parser.<lambda>>, 'LEFT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Left'>>, 'LENGTH': <function MySQL.Parser.<lambda>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHAR_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHARACTER_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.List'>>, 'LN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ln'>>, 'LOCALTIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtime'>>, 'LOCALTIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtimestamp'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LowerHex'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'M_D5_NUMBER_LOWER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberLower64'>>, 'M_D5_NUMBER_UPPER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberUpper64'>>, 'M_L_FORECAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLForecast'>>, 'M_L_TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLTranslate'>>, 'MAKE_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MakeInterval'>>, 'MANHATTAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ManhattanDistance'>>, 'MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Map'>>, 'MAP_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapCat'>>, 'MAP_CONTAINS_KEY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapContainsKey'>>, 'MAP_DELETE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapDelete'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MAP_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapInsert'>>, 'MAP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapKeys'>>, 'MAP_PICK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapPick'>>, 'MAP_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapSize'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MatchAgainst'>>, 'MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Max'>>, 'MEDIAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Median'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MINHASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Minhash'>>, 'MINHASH_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MinhashCombine'>>, 'MINUTE': <function SingleStore.Parser.<lambda>>, 'MODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Mode'>>, 'MONTH': <function MySQL.Parser.<lambda>>, 'MONTHNAME': <function SingleStore.Parser.<lambda>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MonthsBetween'>>, 'NET.HOST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NetHost'>>, 'NEXT_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextDay'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normal'>>, 'NORMALIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normalize'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ntile'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, 'OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectAgg'>>, 'OBJECT_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectInsert'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Or'>>, 'OVERLAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Overlay'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_BIGNUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseBignumeric'>>, 'PARSE_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseDatetime'>>, 'PARSE_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseIp'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PARSE_NUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseNumeric'>>, 'PARSE_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseTime'>>, 'PARSE_URL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseUrl'>>, 'PERCENT_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentRank'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'PI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pi'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'PREVIOUS_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PreviousDay'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RADIANS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Radians'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANDSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randstr'>>, 'RANGE_BUCKET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeBucket'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rank'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'READ_PARQUET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadParquet'>>, 'REDUCE': <function SingleStore.Parser.<lambda>>, 'REGEXP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpCount'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_EXTRACT_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtractAll'>>, 'REGEXP_FULL_MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpFullMatch'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpILike'>>, 'REGEXP_INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpInstr'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'REGEXP_REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpReplace'>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpSplit'>>, 'REGR_AVGX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgx'>>, 'REGR_AVGY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgy'>>, 'REGR_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrCount'>>, 'REGR_INTERCEPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrIntercept'>>, 'REGR_R2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrR2'>>, 'REGR_SLOPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSlope'>>, 'REGR_SXX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxx'>>, 'REGR_SXY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxy'>>, 'REGR_SYY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSyy'>>, 'REGR_VALX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValx'>>, 'REGR_VALY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValy'>>, 'REPEAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Repeat'>>, 'REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Replace'>>, 'REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reverse'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'RTRIMMED_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RtrimmedLength'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'S_H_A1_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA1Digest'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'S_H_A2_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2Digest'>>, 'SAFE_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeAdd'>>, 'SAFE_CONVERT_BYTES_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeConvertBytesToString'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SAFE_MULTIPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeMultiply'>>, 'SAFE_NEGATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeNegate'>>, 'SAFE_SUBTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeSubtract'>>, 'SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Search'>>, 'SEARCH_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SearchIp'>>, 'SEC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sec'>>, 'SECH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sech'>>, 'SECOND': <function SingleStore.Parser.<lambda>>, 'SESSION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SessionUser'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sin'>>, 'SINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sinh'>>, 'SKEWNESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Skewness'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SOUNDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Soundex'>>, 'SOUNDEX_P123': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SoundexP123'>>, 'SPACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Space'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SPLIT_PART': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SplitPart'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'ST_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StDistance'>>, 'ST_POINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'ST_MAKEPOINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <function 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'>>, 'SYSTIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Systimestamp'>>, 'TAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Tan'>>, 'TANH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Tanh'>>, 'TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Time'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeAdd'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeDiff'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'TIME_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSlice'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToDate'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToTime'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeStrToUnix'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeSub'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToStr'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeToUnix'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeTrunc'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Timestamp'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampAdd'>>, 'TIMESTAMPDIFF': <function SingleStore.Parser.<lambda>>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampFromParts'>>, 'TIMESTAMP_LTZ_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampLtzFromParts'>>, 'TIMESTAMPLTZFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampLtzFromParts'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampSub'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTrunc'>>, 'TIMESTAMP_TZ_FROM_PARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTzFromParts'>>, 'TIMESTAMPTZFROMPARTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampTzFromParts'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToArray'>>, 'TO_BASE32': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase32'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBase64'>>, 'TO_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBinary'>>, 'TO_BOOLEAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToBoolean'>>, 'TO_CHAR': <function build_formatted_time.<locals>._builder>, 'TO_CODE_POINTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToCodePoints'>>, 'TO_DAYS': <function MySQL.Parser.<lambda>>, 'TO_DECFLOAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDecfloat'>>, 'TO_DOUBLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDouble'>>, 'TO_FILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToFile'>>, 'TO_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToMap'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToNumber'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Transform'>>, 'TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Translate'>>, 'TRIM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Trim'>>, 'TRY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Try'>>, 'TRY_BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeBinary'>>, 'TRY_BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeString'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TRY_HEX_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeBinary'>>, 'TRY_HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeString'>>, 'TRY_TO_DECFLOAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryToDecfloat'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDiToDi'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsAdd'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsDiff'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDatetime'>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTime'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTimestamp'>>, 'TYPEOF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Typeof'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNICODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unicode'>>, 'UNIFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uniform'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_MICROS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMicros'>>, 'UNIX_MILLIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMillis'>>, 'UNIX_SECONDS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixSeconds'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToStr'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTime'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTimeStr'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UTC_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcDate'>>, 'UTC_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTime'>>, 'UTC_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTimestamp'>>, 'UUID': <function Parser.<lambda>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <function Parser.<lambda>>, 'UUID_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VECTOR_SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VectorSearch'>>, 'WEEK': <function MySQL.Parser.<lambda>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <function MySQL.Parser.<lambda>>, 'WIDTH_BUCKET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WidthBucket'>>, 'XMLELEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLElement'>>, 'XMLGET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLGet'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.XMLTable'>>, 'XOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Xor'>>, 'YEAR': <function MySQL.Parser.<lambda>>, 'YEAR_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAROFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAR_OF_WEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'YEAROFWEEKISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'ZIPF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Zipf'>>, 'ARRAYAGG': <function Parser.<lambda>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'STRPOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'CHARINDEX': <function Parser.<lambda>>, 'INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'LOCATE': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'BIT_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BIT_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseOrAgg'>>, 'BIT_XOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseXorAgg'>>, 'BIT_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCount'>>, 'CONVERT_TZ': <function MySQL.Parser.<lambda>>, 'CURDATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'DATE_FORMAT': <function build_formatted_time.<locals>._builder>, 'FROM_UNIXTIME': <function build_formatted_time.<locals>._builder>, 'ISNULL': <function isnull_to_is_null>, 'MAKETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimeFromParts'>>, 'SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'TO_DATE': <function build_formatted_time.<locals>._builder>, 'TO_TIMESTAMP': <function build_formatted_time.<locals>._builder>, 'TIME_FORMAT': <function SingleStore.Parser.<lambda>>, 'MICROSECOND': <function SingleStore.Parser.<lambda>>, 'WEEKDAY': <function SingleStore.Parser.<lambda>>, 'UNIX_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToUnix'>>, 'TIME_BUCKET': <function SingleStore.Parser.<lambda>>, '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>, 'JSON_ARRAY_CONTAINS_STRING': <function SingleStore.Parser.<lambda>>, 'JSON_ARRAY_CONTAINS_DOUBLE': <function SingleStore.Parser.<lambda>>, 'JSON_ARRAY_CONTAINS_JSON': <function SingleStore.Parser.<lambda>>, 'JSON_PRETTY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONFormat'>>, 'JSON_BUILD_ARRAY': <function SingleStore.Parser.<lambda>>, 'JSON_BUILD_OBJECT': <function SingleStore.Parser.<lambda>>, 'APPROX_PERCENTILE': <function SingleStore.Parser.<lambda>>, 'REGEXP_MATCH': <function SingleStore.Parser.<lambda>>, 'REGEXP_SUBSTR': <function SingleStore.Parser.<lambda>>}
FUNCTION_PARSERS: Dict[str, Callable] =
{'ARG_MAX': <function Parser.<dictcomp>.<lambda>>, 'ARGMAX': <function Parser.<dictcomp>.<lambda>>, 'MAX_BY': <function Parser.<dictcomp>.<lambda>>, 'ARG_MIN': <function Parser.<dictcomp>.<lambda>>, 'ARGMIN': <function Parser.<dictcomp>.<lambda>>, 'MIN_BY': <function Parser.<dictcomp>.<lambda>>, 'CAST': <function Parser.<lambda>>, 'CEIL': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'CHAR': <function Parser.<lambda>>, 'CHR': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'INITCAP': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'MATCH': <function Parser.<lambda>>, 'NORMALIZE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'OVERLAY': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'XMLELEMENT': <function Parser.<lambda>>, 'XMLTABLE': <function Parser.<lambda>>, 'GROUP_CONCAT': <function MySQL.Parser.<lambda>>, 'VALUES': <function MySQL.Parser.<lambda>>, 'JSON_VALUE': <function MySQL.Parser.<lambda>>, 'SUBSTR': <function MySQL.Parser.<lambda>>, 'JSON_AGG': <function SingleStore.Parser.<lambda>>}
NO_PAREN_FUNCTIONS =
{<TokenType.CURRENT_DATE: 'CURRENT_DATE'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>: <class 'sqlglot.expressions.CurrentTime'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>: <class 'sqlglot.expressions.CurrentTimestamp'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>: <class 'sqlglot.expressions.CurrentUser'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>: <class 'sqlglot.expressions.CurrentRole'>, <TokenType.UTC_DATE: 'UTC_DATE'>: <class 'sqlglot.expressions.UtcDate'>, <TokenType.UTC_TIME: 'UTC_TIME'>: <class 'sqlglot.expressions.UtcTime'>, <TokenType.UTC_TIMESTAMP: 'UTC_TIMESTAMP'>: <class 'sqlglot.expressions.UtcTimestamp'>}
COLUMN_OPERATORS =
{<TokenType.DOT: 'DOT'>: None, <TokenType.DOTCOLON: 'DOTCOLON'>: <function Parser.<lambda>>, <TokenType.DCOLON: 'DCOLON'>: <function SingleStore.Parser.<lambda>>, <TokenType.COLON_GT: 'COLON_GT'>: <function SingleStore.Parser.<lambda>>, <TokenType.NCOLON_GT: 'NCOLON_GT'>: <function SingleStore.Parser.<lambda>>, <TokenType.DCOLONDOLLAR: 'DCOLONDOLLAR'>: <function SingleStore.Parser.<lambda>>, <TokenType.DCOLONPERCENT: 'DCOLONPERCENT'>: <function SingleStore.Parser.<lambda>>, <TokenType.DCOLONQMARK: 'DCOLONQMARK'>: <function SingleStore.Parser.<lambda>>}
SHOW_PARSERS =
{'BINARY LOGS': <function _show_parser.<locals>._parse>, 'MASTER LOGS': <function _show_parser.<locals>._parse>, 'BINLOG EVENTS': <function _show_parser.<locals>._parse>, 'CHARACTER SET': <function _show_parser.<locals>._parse>, 'CHARSET': <function _show_parser.<locals>._parse>, 'COLLATION': <function _show_parser.<locals>._parse>, 'FULL COLUMNS': <function _show_parser.<locals>._parse>, 'COLUMNS': <function _show_parser.<locals>._parse>, 'CREATE DATABASE': <function _show_parser.<locals>._parse>, 'CREATE EVENT': <function _show_parser.<locals>._parse>, 'CREATE FUNCTION': <function _show_parser.<locals>._parse>, 'CREATE PROCEDURE': <function _show_parser.<locals>._parse>, 'CREATE TABLE': <function _show_parser.<locals>._parse>, 'CREATE TRIGGER': <function _show_parser.<locals>._parse>, 'CREATE VIEW': <function _show_parser.<locals>._parse>, 'DATABASES': <function _show_parser.<locals>._parse>, 'SCHEMAS': <function _show_parser.<locals>._parse>, 'ENGINE': <function _show_parser.<locals>._parse>, 'STORAGE ENGINES': <function _show_parser.<locals>._parse>, 'ENGINES': <function _show_parser.<locals>._parse>, 'ERRORS': <function _show_parser.<locals>._parse>, 'EVENTS': <function _show_parser.<locals>._parse>, 'FUNCTION CODE': <function _show_parser.<locals>._parse>, 'FUNCTION STATUS': <function _show_parser.<locals>._parse>, 'GRANTS': <function _show_parser.<locals>._parse>, 'INDEX': <function _show_parser.<locals>._parse>, 'MASTER STATUS': <function _show_parser.<locals>._parse>, 'OPEN TABLES': <function _show_parser.<locals>._parse>, 'PLUGINS': <function _show_parser.<locals>._parse>, 'PROCEDURE CODE': <function _show_parser.<locals>._parse>, 'PROCEDURE STATUS': <function _show_parser.<locals>._parse>, 'PRIVILEGES': <function _show_parser.<locals>._parse>, 'FULL PROCESSLIST': <function _show_parser.<locals>._parse>, 'PROCESSLIST': <function _show_parser.<locals>._parse>, 'PROFILE': <function _show_parser.<locals>._parse>, 'PROFILES': <function _show_parser.<locals>._parse>, 'RELAYLOG EVENTS': <function _show_parser.<locals>._parse>, 'REPLICAS': <function _show_parser.<locals>._parse>, 'SLAVE HOSTS': <function _show_parser.<locals>._parse>, 'REPLICA STATUS': <function _show_parser.<locals>._parse>, 'SLAVE STATUS': <function _show_parser.<locals>._parse>, 'GLOBAL STATUS': <function _show_parser.<locals>._parse>, 'SESSION STATUS': <function _show_parser.<locals>._parse>, 'STATUS': <function _show_parser.<locals>._parse>, 'TABLE STATUS': <function _show_parser.<locals>._parse>, 'FULL TABLES': <function _show_parser.<locals>._parse>, 'TABLES': <function _show_parser.<locals>._parse>, 'TRIGGERS': <function _show_parser.<locals>._parse>, 'GLOBAL VARIABLES': <function _show_parser.<locals>._parse>, 'SESSION VARIABLES': <function _show_parser.<locals>._parse>, 'VARIABLES': <function _show_parser.<locals>._parse>, 'WARNINGS': <function _show_parser.<locals>._parse>, 'AGGREGATES': <function _show_parser.<locals>._parse>, 'CDC EXTRACTOR POOL': <function _show_parser.<locals>._parse>, 'CREATE AGGREGATE': <function _show_parser.<locals>._parse>, 'CREATE PIPELINE': <function _show_parser.<locals>._parse>, 'CREATE PROJECTION': <function _show_parser.<locals>._parse>, 'DATABASE STATUS': <function _show_parser.<locals>._parse>, 'DISTRIBUTED_PLANCACHE STATUS': <function _show_parser.<locals>._parse>, 'FULLTEXT SERVICE METRICS LOCAL': <function _show_parser.<locals>._parse>, 'FULLTEXT SERVICE METRICS FOR NODE': <function _show_parser.<locals>._parse>, 'FULLTEXT SERVICE STATUS': <function _show_parser.<locals>._parse>, 'FUNCTIONS': <function _show_parser.<locals>._parse>, 'GROUPS': <function _show_parser.<locals>._parse>, 'GROUPS FOR ROLE': <function _show_parser.<locals>._parse>, 'GROUPS FOR USER': <function _show_parser.<locals>._parse>, 'INDEXES': <function _show_parser.<locals>._parse>, 'KEYS': <function _show_parser.<locals>._parse>, 'LINKS': <function _show_parser.<locals>._parse>, 'LOAD ERRORS': <function _show_parser.<locals>._parse>, 'LOAD WARNINGS': <function _show_parser.<locals>._parse>, 'PARTITIONS': <function _show_parser.<locals>._parse>, 'PIPELINES': <function _show_parser.<locals>._parse>, 'PLAN': <function _show_parser.<locals>._parse>, 'PLANCACHE': <function _show_parser.<locals>._parse>, 'PROCEDURES': <function _show_parser.<locals>._parse>, 'PROJECTIONS': <function _show_parser.<locals>._parse>, 'REPLICATION STATUS': <function _show_parser.<locals>._parse>, 'REPRODUCTION': <function _show_parser.<locals>._parse>, 'RESOURCE POOLS': <function _show_parser.<locals>._parse>, 'ROLES': <function _show_parser.<locals>._parse>, 'ROLES FOR USER': <function _show_parser.<locals>._parse>, 'ROLES FOR GROUP': <function _show_parser.<locals>._parse>, 'STATUS EXTENDED': <function _show_parser.<locals>._parse>, 'USERS': <function _show_parser.<locals>._parse>, 'USERS FOR ROLE': <function _show_parser.<locals>._parse>, 'USERS FOR GROUP': <function _show_parser.<locals>._parse>}
ALTER_PARSERS =
{'ADD': <function Parser.<lambda>>, 'AS': <function Parser.<lambda>>, 'ALTER': <function Parser.<lambda>>, 'CLUSTER BY': <function Parser.<lambda>>, 'DELETE': <function Parser.<lambda>>, 'DROP': <function Parser.<lambda>>, 'RENAME': <function Parser.<lambda>>, 'SET': <function Parser.<lambda>>, 'SWAP': <function Parser.<lambda>>, 'MODIFY': <function MySQL.Parser.<lambda>>, 'CHANGE': <function SingleStore.Parser.<lambda>>}
TABLE_ALIAS_TOKENS =
{<TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.FILTER: 'FILTER'>, <TokenType.ANTI: 'ANTI'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.ROWS: 'ROWS'>, <TokenType.ANALYZE: 'ANALYZE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NEXT: 'NEXT'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.TOP: 'TOP'>, <TokenType.YEAR: 'YEAR'>, <TokenType.GET: 'GET'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.SUPER: 'SUPER'>, <TokenType.BLOB: 'BLOB'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.SINK: 'SINK'>, <TokenType.INT: 'INT'>, <TokenType.TIME: 'TIME'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.NULL: 'NULL'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.PUT: 'PUT'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.XML: 'XML'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.CACHE: 'CACHE'>, <TokenType.KEEP: 'KEEP'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.BIGNUM: 'BIGNUM'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.SET: 'SET'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INT128: 'INT128'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.DATE: 'DATE'>, <TokenType.MATCH: 'MATCH'>, <TokenType.CUBE: 'CUBE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.KILL: 'KILL'>, <TokenType.ENUM: 'ENUM'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.CASE: 'CASE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NAME: 'NAME'>, <TokenType.OVER: 'OVER'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.DECFLOAT: 'DECFLOAT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.SEMI: 'SEMI'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.SESSION: 'SESSION'>, <TokenType.LOAD: 'LOAD'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.DIV: 'DIV'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ANY: 'ANY'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.JSON: 'JSON'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.INT256: 'INT256'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.POINT: 'POINT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UINT: 'UINT'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.INET: 'INET'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.FIRST: 'FIRST'>, <TokenType.NESTED: 'NESTED'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.ALL: 'ALL'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DESC: 'DESC'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.STAGE: 'STAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.ASC: 'ASC'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROW: 'ROW'>, <TokenType.MONEY: 'MONEY'>, <TokenType.UUID: 'UUID'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.MODEL: 'MODEL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TAG: 'TAG'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.TIME_NS: 'TIME_NS'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.LOCALTIME: 'LOCALTIME'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.COPY: 'COPY'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.RENAME: 'RENAME'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.END: 'END'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FILE: 'FILE'>, <TokenType.VAR: 'VAR'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FINAL: 'FINAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.VIEW: 'VIEW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.LIST: 'LIST'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.JSONB: 'JSONB'>, <TokenType.BIT: 'BIT'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.LOCALTIMESTAMP: 'LOCALTIMESTAMP'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.IS: 'IS'>, <TokenType.UINT128: 'UINT128'>, <TokenType.IPV4: 'IPV4'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.RING: 'RING'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.VOID: 'VOID'>, <TokenType.INDEX: 'INDEX'>}
ID_VAR_TOKENS =
{<TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ANTI: 'ANTI'>, <TokenType.FILTER: 'FILTER'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.DATETIME2: 'DATETIME2'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.ROWS: 'ROWS'>, <TokenType.CURRENT_CATALOG: 'CURRENT_CATALOG'>, <TokenType.ANALYZE: 'ANALYZE'>, <TokenType.UINT256: 'UINT256'>, <TokenType.NEXT: 'NEXT'>, <TokenType.EXPORT: 'EXPORT'>, <TokenType.GEOGRAPHYPOINT: 'GEOGRAPHYPOINT'>, <TokenType.SEMANTIC_VIEW: 'SEMANTIC_VIEW'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.MAP: 'MAP'>, <TokenType.TOP: 'TOP'>, <TokenType.YEAR: 'YEAR'>, <TokenType.GET: 'GET'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.FULL: 'FULL'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.SEQUENCE: 'SEQUENCE'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.RANGE: 'RANGE'>, <TokenType.WINDOW: 'WINDOW'>, <TokenType.SUPER: 'SUPER'>, <TokenType.BLOB: 'BLOB'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.SINK: 'SINK'>, <TokenType.INT: 'INT'>, <TokenType.TIME: 'TIME'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.NULL: 'NULL'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.SESSION_USER: 'SESSION_USER'>, <TokenType.PUT: 'PUT'>, <TokenType.VECTOR: 'VECTOR'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.XML: 'XML'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.CACHE: 'CACHE'>, <TokenType.KEEP: 'KEEP'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.ROLLUP: 'ROLLUP'>, <TokenType.TRUNCATE: 'TRUNCATE'>, <TokenType.NAMESPACE: 'NAMESPACE'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.BIGNUM: 'BIGNUM'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.SET: 'SET'>, <TokenType.CHAR: 'CHAR'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.INT128: 'INT128'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.DATE: 'DATE'>, <TokenType.MATCH: 'MATCH'>, <TokenType.CUBE: 'CUBE'>, <TokenType.ATTACH: 'ATTACH'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.KILL: 'KILL'>, <TokenType.ENUM: 'ENUM'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.CASE: 'CASE'>, <TokenType.UNNEST: 'UNNEST'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.NAME: 'NAME'>, <TokenType.OVER: 'OVER'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DECIMAL64: 'DECIMAL64'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DECFLOAT: 'DECFLOAT'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.IDENTIFIER: 'IDENTIFIER'>, <TokenType.LIMIT: 'LIMIT'>, <TokenType.SESSION: 'SESSION'>, <TokenType.LOAD: 'LOAD'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.DIV: 'DIV'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.ANY: 'ANY'>, <TokenType.TDIGEST: 'TDIGEST'>, <TokenType.JSON: 'JSON'>, <TokenType.DECIMAL128: 'DECIMAL128'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.WAREHOUSE: 'WAREHOUSE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.INT256: 'INT256'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.RIGHT: 'RIGHT'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.LINESTRING: 'LINESTRING'>, <TokenType.POINT: 'POINT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UINT: 'UINT'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.CURRENT_ROLE: 'CURRENT_ROLE'>, <TokenType.APPLY: 'APPLY'>, <TokenType.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <TokenType.INET: 'INET'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.FIRST: 'FIRST'>, <TokenType.NESTED: 'NESTED'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.ASOF: 'ASOF'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.ALL: 'ALL'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.TEXT: 'TEXT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.DESC: 'DESC'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.STAGE: 'STAGE'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.ASC: 'ASC'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.ROW: 'ROW'>, <TokenType.MONEY: 'MONEY'>, <TokenType.UUID: 'UUID'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.MODEL: 'MODEL'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TAG: 'TAG'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.SOURCE: 'SOURCE'>, <TokenType.TIME_NS: 'TIME_NS'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.DECIMAL256: 'DECIMAL256'>, <TokenType.LOCK: 'LOCK'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.BPCHAR: 'BPCHAR'>, <TokenType.LOCALTIME: 'LOCALTIME'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.MERGE: 'MERGE'>, <TokenType.DYNAMIC: 'DYNAMIC'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.COPY: 'COPY'>, <TokenType.TRUE: 'TRUE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.RENAME: 'RENAME'>, <TokenType.LEFT: 'LEFT'>, <TokenType.OFFSET: 'OFFSET'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.MULTILINESTRING: 'MULTILINESTRING'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.SMALLDATETIME: 'SMALLDATETIME'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.END: 'END'>, <TokenType.NATURAL: 'NATURAL'>, <TokenType.NOTHING: 'NOTHING'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.FILE: 'FILE'>, <TokenType.VAR: 'VAR'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FINAL: 'FINAL'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.TABLE: 'TABLE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.STORAGE_INTEGRATION: 'STORAGE_INTEGRATION'>, <TokenType.VIEW: 'VIEW'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.SOME: 'SOME'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.POLYGON: 'POLYGON'>, <TokenType.CURRENT_SCHEMA: 'CURRENT_SCHEMA'>, <TokenType.LIST: 'LIST'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.DECIMAL32: 'DECIMAL32'>, <TokenType.MULTIPOLYGON: 'MULTIPOLYGON'>, <TokenType.JSONB: 'JSONB'>, <TokenType.BIT: 'BIT'>, <TokenType.STRAIGHT_JOIN: 'STRAIGHT_JOIN'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.LOCALTIMESTAMP: 'LOCALTIMESTAMP'>, <TokenType.FILE_FORMAT: 'FILE_FORMAT'>, <TokenType.DETACH: 'DETACH'>, <TokenType.IS: 'IS'>, <TokenType.UINT128: 'UINT128'>, <TokenType.IPV4: 'IPV4'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.UDOUBLE: 'UDOUBLE'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.DATE32: 'DATE32'>, <TokenType.RING: 'RING'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.USE: 'USE'>, <TokenType.STREAMLIT: 'STREAMLIT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.VOID: 'VOID'>, <TokenType.INDEX: 'INDEX'>}
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}, 'AGGREGATE': {0: True}, 'PIPELINE': {0: True}, 'PROJECTION': {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, 'EXTENDED': {0: True}}, 'TABLE': {'STATUS': {0: True}}, 'TABLES': {0: True}, 'TRIGGERS': {0: True}, 'VARIABLES': {0: True}, 'WARNINGS': {0: True}, 'AGGREGATES': {0: True}, 'CDC': {'EXTRACTOR': {'POOL': {0: True}}}, 'DATABASE': {'STATUS': {0: True}}, 'DISTRIBUTED_PLANCACHE': {'STATUS': {0: True}}, 'FULLTEXT': {'SERVICE': {'METRICS': {'LOCAL': {0: True}, 'FOR': {'NODE': {0: True}}}, 'STATUS': {0: True}}}, 'FUNCTIONS': {0: True}, 'GROUPS': {0: True, 'FOR': {'ROLE': {0: True}, 'USER': {0: True}}}, 'INDEXES': {0: True}, 'KEYS': {0: True}, 'LINKS': {0: True}, 'LOAD': {'ERRORS': {0: True}, 'WARNINGS': {0: True}}, 'PARTITIONS': {0: True}, 'PIPELINES': {0: True}, 'PLAN': {0: True}, 'PLANCACHE': {0: True}, 'PROCEDURES': {0: True}, 'PROJECTIONS': {0: True}, 'REPLICATION': {'STATUS': {0: True}}, 'REPRODUCTION': {0: True}, 'RESOURCE': {'POOLS': {0: True}}, 'ROLES': {0: True, 'FOR': {'USER': {0: True}, 'GROUP': {0: True}}}, 'USERS': {0: True, 'FOR': {'ROLE': {0: True}, 'GROUP': {0: True}}}}
SET_TRIE: Dict =
{'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}, 'PERSIST': {0: True}, 'PERSIST_ONLY': {0: True}, 'CHARACTER': {'SET': {0: True}}, 'CHARSET': {0: True}, 'NAMES': {0: True}}
Inherited Members
- sqlglot.parser.Parser
- Parser
- STRUCT_TYPE_TOKENS
- NESTED_TYPE_TOKENS
- AGGREGATE_TYPE_TOKENS
- SIGNED_TO_UNSIGNED_TYPE_TOKEN
- SUBQUERY_PREDICATES
- RESERVED_TOKENS
- DB_CREATABLES
- CREATABLES
- ALTERABLES
- ALIAS_TOKENS
- COLON_PLACEHOLDER_TOKENS
- ARRAY_CONSTRUCTORS
- COMMENT_TABLE_ALIAS_TOKENS
- UPDATE_ALIAS_TOKENS
- TRIM_TYPES
- ASSIGNMENT
- EQUALITY
- COMPARISON
- BITWISE
- TERM
- FACTOR
- EXPONENT
- TIMES
- TIMESTAMPS
- SET_OPERATIONS
- JOIN_METHODS
- JOIN_SIDES
- JOIN_KINDS
- JOIN_HINTS
- LAMBDAS
- EXPRESSION_PARSERS
- UNARY_PARSERS
- STRING_PARSERS
- NUMERIC_PARSERS
- PRIMARY_PARSERS
- PLACEHOLDER_PARSERS
- PIPE_SYNTAX_TRANSFORM_PARSERS
- NO_PAREN_FUNCTION_PARSERS
- INVALID_FUNC_NAME_TOKENS
- FUNCTIONS_WITH_ALIASED_ARGS
- KEY_VALUE_DEFINITIONS
- QUERY_MODIFIER_PARSERS
- QUERY_MODIFIER_TOKENS
- TYPE_LITERAL_PARSERS
- TYPE_CONVERTERS
- DDL_SELECT_TOKENS
- PRE_VOLATILE_TOKENS
- TRANSACTION_KIND
- TRANSACTION_CHARACTERISTICS
- CONFLICT_ACTIONS
- CREATE_SEQUENCE
- ISOLATED_LOADING_OPTIONS
- USABLES
- CAST_ACTIONS
- SCHEMA_BINDING_OPTIONS
- PROCEDURE_OPTIONS
- EXECUTE_AS_OPTIONS
- KEY_CONSTRAINT_OPTIONS
- WINDOW_EXCLUDE_OPTIONS
- INSERT_ALTERNATIVES
- CLONE_KEYWORDS
- HISTORICAL_DATA_PREFIX
- HISTORICAL_DATA_KIND
- OPCLASS_FOLLOW_KEYWORDS
- OPTYPE_FOLLOW_TOKENS
- TABLE_INDEX_HINT_TOKENS
- VIEW_ATTRIBUTES
- WINDOW_ALIAS_TOKENS
- WINDOW_BEFORE_PAREN_TOKENS
- WINDOW_SIDES
- JSON_KEY_VALUE_SEPARATOR_TOKENS
- FETCH_TOKENS
- ADD_CONSTRAINT_TOKENS
- DISTINCT_TOKENS
- UNNEST_OFFSET_ALIAS_TOKENS
- SELECT_START_TOKENS
- COPY_INTO_VARLEN_OPTIONS
- IS_JSON_PREDICATE_KIND
- ODBC_DATETIME_LITERALS
- ON_CONDITION_TOKENS
- PRIVILEGE_FOLLOW_TOKENS
- DESCRIBE_STYLES
- SET_ASSIGNMENT_DELIMITERS
- ANALYZE_STYLES
- ANALYZE_EXPRESSION_PARSERS
- PARTITION_KEYWORDS
- AMBIGUOUS_ALIAS_TOKENS
- RECURSIVE_CTE_SEARCH_KIND
- MODIFIABLES
- STRICT_CAST
- PREFIXED_PIVOT_COLUMNS
- IDENTIFY_PIVOT_STRINGS
- TABLESAMPLE_CSV
- DEFAULT_SAMPLING_METHOD
- SET_REQUIRES_ASSIGNMENT_DELIMITER
- TRIM_PATTERN_FIRST
- MODIFIERS_ATTACHED_TO_SET_OP
- SET_OP_MODIFIERS
- NO_PAREN_IF_COMMANDS
- JSON_ARROWS_REQUIRE_JSON_TYPE
- COLON_IS_VARIANT_EXTRACT
- SUPPORTS_IMPLICIT_UNNEST
- INTERVAL_SPANS
- WRAPPED_TRANSFORM_COLUMN_CONSTRAINT
- OPTIONAL_ALIAS_TOKEN_CTE
- ALTER_RENAME_REQUIRES_COLUMN
- ALTER_TABLE_PARTITIONS
- JOINS_HAVE_EQUAL_PRECEDENCE
- ZONE_AWARE_TIMESTAMP_CONSTRUCTOR
- MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS
- JSON_EXTRACT_REQUIRES_JSON_EXPRESSION
- ADD_JOIN_ON_TRUE
- SUPPORTS_OMITTED_INTERVAL_SPAN_UNIT
- error_level
- error_message_context
- max_errors
- dialect
- reset
- parse
- parse_into
- check_errors
- raise_error
- expression
- validate_expression
- parse_set_operation
- build_cast
- errors
- sql
- sqlglot.dialects.mysql.MySQL.Parser
- FUNC_TOKENS
- CONJUNCTION
- DISJUNCTION
- RANGE_PARSERS
- STATEMENT_PARSERS
- PROPERTY_PARSERS
- SET_PARSERS
- CONSTRAINT_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
333 class Generator(MySQL.Generator): 334 SUPPORTS_UESCAPE = False 335 NULL_ORDERING_SUPPORTED = True 336 MATCH_AGAINST_TABLE_PREFIX = "TABLE " 337 STRUCT_DELIMITER = ("(", ")") 338 339 @staticmethod 340 def _unicode_substitute(m: re.Match[str]) -> str: 341 # Interpret the number as hex and convert it to the Unicode string 342 return chr(int(m.group(1), 16)) 343 344 UNICODE_SUBSTITUTE: t.Optional[t.Callable[[re.Match[str]], str]] = _unicode_substitute 345 346 SUPPORTED_JSON_PATH_PARTS = { 347 exp.JSONPathKey, 348 exp.JSONPathRoot, 349 exp.JSONPathSubscript, 350 } 351 352 TRANSFORMS = { 353 **MySQL.Generator.TRANSFORMS, 354 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)) 355 if e.args.get("format") 356 else self.func("DATE", e.this), 357 exp.StrToTime: lambda self, e: self.func("TO_TIMESTAMP", e.this, self.format_time(e)), 358 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 359 exp.StrToDate: lambda self, e: self.func( 360 "STR_TO_DATE", 361 e.this, 362 self.format_time( 363 e, 364 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 365 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 366 ), 367 ), 368 exp.TimeToStr: lambda self, e: self.func( 369 "DATE_FORMAT", 370 e.this, 371 self.format_time( 372 e, 373 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 374 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 375 ), 376 ), 377 exp.Date: unsupported_args("zone", "expressions")(rename_func("DATE")), 378 exp.Cast: unsupported_args("format", "action", "default")( 379 lambda self, e: f"{self.sql(e, 'this')} :> {self.sql(e, 'to')}" 380 ), 381 exp.TryCast: unsupported_args("format", "action", "default")( 382 lambda self, e: f"{self.sql(e, 'this')} !:> {self.sql(e, 'to')}" 383 ), 384 exp.CastToStrType: lambda self, e: self.sql( 385 exp.cast(e.this, DataType.build(e.args["to"].name)) 386 ), 387 exp.StrToUnix: unsupported_args("format")(rename_func("UNIX_TIMESTAMP")), 388 exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), 389 exp.TimeStrToUnix: rename_func("UNIX_TIMESTAMP"), 390 exp.UnixSeconds: rename_func("UNIX_TIMESTAMP"), 391 exp.UnixToStr: lambda self, e: self.func( 392 "FROM_UNIXTIME", 393 e.this, 394 self.format_time( 395 e, 396 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 397 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 398 ), 399 ), 400 exp.UnixToTime: unsupported_args("scale", "zone", "hours", "minutes")( 401 lambda self, e: self.func( 402 "FROM_UNIXTIME", 403 e.this, 404 self.format_time( 405 e, 406 inverse_time_mapping=MySQL.INVERSE_TIME_MAPPING, 407 inverse_time_trie=MySQL.INVERSE_TIME_TRIE, 408 ), 409 ), 410 ), 411 exp.UnixToTimeStr: lambda self, e: f"FROM_UNIXTIME({self.sql(e, 'this')}) :> TEXT", 412 exp.DateBin: unsupported_args("unit", "zone")( 413 lambda self, e: self.func("TIME_BUCKET", e.this, e.expression, e.args.get("origin")) 414 ), 415 exp.TimeStrToDate: lambda self, e: self.sql(exp.cast(e.this, exp.DataType.Type.DATE)), 416 exp.FromTimeZone: lambda self, e: self.func( 417 "CONVERT_TZ", e.this, e.args.get("zone"), "'UTC'" 418 ), 419 exp.DiToDate: lambda self, 420 e: f"STR_TO_DATE({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT})", 421 exp.DateToDi: lambda self, 422 e: f"(DATE_FORMAT({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT}) :> INT)", 423 exp.TsOrDiToDi: lambda self, 424 e: f"(DATE_FORMAT({self.sql(e, 'this')}, {SingleStore.DATEINT_FORMAT}) :> INT)", 425 exp.Time: unsupported_args("zone")(lambda self, e: f"{self.sql(e, 'this')} :> TIME"), 426 exp.DatetimeAdd: _remove_ts_or_ds_to_date(date_add_sql("ADD")), 427 exp.DatetimeTrunc: unsupported_args("zone")(timestamptrunc_sql()), 428 exp.DatetimeSub: date_add_interval_sql("DATE", "SUB"), 429 exp.DatetimeDiff: timestampdiff_sql, 430 exp.DateTrunc: unsupported_args("zone")(timestamptrunc_sql()), 431 exp.DateDiff: unsupported_args("zone")( 432 lambda self, e: timestampdiff_sql(self, e) 433 if e.unit is not None 434 else self.func("DATEDIFF", e.this, e.expression) 435 ), 436 exp.TsOrDsDiff: lambda self, e: timestampdiff_sql(self, e) 437 if e.unit is not None 438 else self.func("DATEDIFF", e.this, e.expression), 439 exp.TimestampTrunc: unsupported_args("zone")(timestamptrunc_sql()), 440 exp.CurrentDatetime: lambda self, e: self.sql( 441 cast_to_time6( 442 exp.CurrentTimestamp(this=exp.Literal.number(6)), exp.DataType.Type.DATETIME 443 ) 444 ), 445 exp.JSONExtract: unsupported_args( 446 "only_json_types", 447 "expressions", 448 "variant_extract", 449 "json_query", 450 "option", 451 "quote", 452 "on_condition", 453 "requires_json", 454 )(json_extract_segments("JSON_EXTRACT_JSON")), 455 exp.JSONBExtract: json_extract_segments("BSON_EXTRACT_BSON"), 456 exp.JSONPathKey: json_path_key_only_name, 457 exp.JSONPathSubscript: lambda self, e: self.json_path_part(e.this), 458 exp.JSONPathRoot: lambda *_: "", 459 exp.JSONFormat: unsupported_args("options", "is_json")(rename_func("JSON_PRETTY")), 460 exp.JSONArrayAgg: unsupported_args("null_handling", "return_type", "strict")( 461 lambda self, e: self.func("JSON_AGG", e.this, suffix=f"{self.sql(e, 'order')})") 462 ), 463 exp.JSONArray: unsupported_args("null_handling", "return_type", "strict")( 464 rename_func("JSON_BUILD_ARRAY") 465 ), 466 exp.JSONBExists: lambda self, e: self.func( 467 "BSON_MATCH_ANY_EXISTS", e.this, e.args.get("path") 468 ), 469 exp.JSONExists: lambda self, e: ( 470 f"{self.sql(e.this)}::?{self.sql(e.args.get('path'))}" 471 if e.args.get("from_dcolonqmark") 472 else self.func("JSON_MATCH_ANY_EXISTS", e.this, e.args.get("path")) 473 ), 474 exp.JSONObject: unsupported_args( 475 "null_handling", "unique_keys", "return_type", "encoding" 476 )(rename_func("JSON_BUILD_OBJECT")), 477 exp.DayOfWeekIso: lambda self, e: f"(({self.func('DAYOFWEEK', e.this)} % 7) + 1)", 478 exp.DayOfMonth: rename_func("DAY"), 479 exp.Hll: rename_func("APPROX_COUNT_DISTINCT"), 480 exp.ApproxDistinct: rename_func("APPROX_COUNT_DISTINCT"), 481 exp.CountIf: count_if_to_sum, 482 exp.LogicalOr: lambda self, e: f"MAX(ABS({self.sql(e, 'this')}))", 483 exp.LogicalAnd: lambda self, e: f"MIN(ABS({self.sql(e, 'this')}))", 484 exp.ApproxQuantile: unsupported_args("accuracy", "weight")( 485 lambda self, e: self.func( 486 "APPROX_PERCENTILE", 487 e.this, 488 e.args.get("quantile"), 489 e.args.get("error_tolerance"), 490 ) 491 ), 492 exp.Variance: rename_func("VAR_SAMP"), 493 exp.VariancePop: rename_func("VAR_POP"), 494 exp.Xor: bool_xor_sql, 495 exp.Cbrt: lambda self, e: self.sql( 496 exp.Pow(this=e.this, expression=exp.Literal.number(1) / exp.Literal.number(3)) 497 ), 498 exp.RegexpLike: lambda self, e: self.binary(e, "RLIKE"), 499 exp.Repeat: lambda self, e: self.func( 500 "LPAD", 501 exp.Literal.string(""), 502 exp.Mul(this=self.func("LENGTH", e.this), expression=e.args.get("times")), 503 e.this, 504 ), 505 exp.IsAscii: lambda self, e: f"({self.sql(e, 'this')} RLIKE '^[\x00-\x7f]*$')", 506 exp.MD5Digest: lambda self, e: self.func("UNHEX", self.func("MD5", e.this)), 507 exp.Contains: rename_func("INSTR"), 508 exp.RegexpExtractAll: unsupported_args("position", "occurrence", "group")( 509 lambda self, e: self.func( 510 "REGEXP_MATCH", 511 e.this, 512 e.expression, 513 e.args.get("parameters"), 514 ) 515 ), 516 exp.RegexpExtract: unsupported_args("group")( 517 lambda self, e: self.func( 518 "REGEXP_SUBSTR", 519 e.this, 520 e.expression, 521 e.args.get("position"), 522 e.args.get("occurrence"), 523 e.args.get("parameters"), 524 ) 525 ), 526 exp.StartsWith: lambda self, e: self.func( 527 "REGEXP_INSTR", e.this, self.func("CONCAT", exp.Literal.string("^"), e.expression) 528 ), 529 exp.FromBase: lambda self, e: self.func( 530 "CONV", e.this, e.expression, exp.Literal.number(10) 531 ), 532 exp.RegexpILike: lambda self, e: self.binary( 533 exp.RegexpLike( 534 this=exp.Lower(this=e.this), 535 expression=exp.Lower(this=e.expression), 536 ), 537 "RLIKE", 538 ), 539 exp.Stuff: lambda self, e: self.func( 540 "CONCAT", 541 self.func("SUBSTRING", e.this, exp.Literal.number(1), e.args.get("start") - 1), 542 e.expression, 543 self.func("SUBSTRING", e.this, e.args.get("start") + e.args.get("length")), 544 ), 545 exp.National: lambda self, e: self.national_sql(e, prefix=""), 546 exp.Reduce: unsupported_args("finish")( 547 lambda self, e: self.func( 548 "REDUCE", e.args.get("initial"), e.this, e.args.get("merge") 549 ) 550 ), 551 exp.MatchAgainst: unsupported_args("modifier")( 552 lambda self, e: super().matchagainst_sql(e) 553 ), 554 exp.Show: unsupported_args( 555 "history", 556 "terse", 557 "offset", 558 "starts_with", 559 "limit", 560 "from_", 561 "scope", 562 "scope_kind", 563 "mutex", 564 "query", 565 "channel", 566 "log", 567 "types", 568 "privileges", 569 )(lambda self, e: super().show_sql(e)), 570 exp.Describe: unsupported_args( 571 "style", 572 "kind", 573 "expressions", 574 "partition", 575 "format", 576 )(lambda self, e: super().describe_sql(e)), 577 } 578 TRANSFORMS.pop(exp.JSONExtractScalar) 579 TRANSFORMS.pop(exp.CurrentDate) 580 581 UNSUPPORTED_TYPES = { 582 exp.DataType.Type.ARRAY, 583 exp.DataType.Type.AGGREGATEFUNCTION, 584 exp.DataType.Type.SIMPLEAGGREGATEFUNCTION, 585 exp.DataType.Type.BIGSERIAL, 586 exp.DataType.Type.BPCHAR, 587 exp.DataType.Type.DATEMULTIRANGE, 588 exp.DataType.Type.DATERANGE, 589 exp.DataType.Type.DYNAMIC, 590 exp.DataType.Type.HLLSKETCH, 591 exp.DataType.Type.HSTORE, 592 exp.DataType.Type.IMAGE, 593 exp.DataType.Type.INET, 594 exp.DataType.Type.INT128, 595 exp.DataType.Type.INT256, 596 exp.DataType.Type.INT4MULTIRANGE, 597 exp.DataType.Type.INT4RANGE, 598 exp.DataType.Type.INT8MULTIRANGE, 599 exp.DataType.Type.INT8RANGE, 600 exp.DataType.Type.INTERVAL, 601 exp.DataType.Type.IPADDRESS, 602 exp.DataType.Type.IPPREFIX, 603 exp.DataType.Type.IPV4, 604 exp.DataType.Type.IPV6, 605 exp.DataType.Type.LIST, 606 exp.DataType.Type.MAP, 607 exp.DataType.Type.LOWCARDINALITY, 608 exp.DataType.Type.MONEY, 609 exp.DataType.Type.MULTILINESTRING, 610 exp.DataType.Type.NAME, 611 exp.DataType.Type.NESTED, 612 exp.DataType.Type.NOTHING, 613 exp.DataType.Type.NULL, 614 exp.DataType.Type.NUMMULTIRANGE, 615 exp.DataType.Type.NUMRANGE, 616 exp.DataType.Type.OBJECT, 617 exp.DataType.Type.RANGE, 618 exp.DataType.Type.ROWVERSION, 619 exp.DataType.Type.SERIAL, 620 exp.DataType.Type.SMALLSERIAL, 621 exp.DataType.Type.SMALLMONEY, 622 exp.DataType.Type.SUPER, 623 exp.DataType.Type.TIMETZ, 624 exp.DataType.Type.TIMESTAMPNTZ, 625 exp.DataType.Type.TIMESTAMPLTZ, 626 exp.DataType.Type.TIMESTAMPTZ, 627 exp.DataType.Type.TIMESTAMP_NS, 628 exp.DataType.Type.TSMULTIRANGE, 629 exp.DataType.Type.TSRANGE, 630 exp.DataType.Type.TSTZMULTIRANGE, 631 exp.DataType.Type.TSTZRANGE, 632 exp.DataType.Type.UINT128, 633 exp.DataType.Type.UINT256, 634 exp.DataType.Type.UNION, 635 exp.DataType.Type.UNKNOWN, 636 exp.DataType.Type.USERDEFINED, 637 exp.DataType.Type.UUID, 638 exp.DataType.Type.VARIANT, 639 exp.DataType.Type.XML, 640 exp.DataType.Type.TDIGEST, 641 } 642 643 TYPE_MAPPING = { 644 **MySQL.Generator.TYPE_MAPPING, 645 exp.DataType.Type.BIGDECIMAL: "DECIMAL", 646 exp.DataType.Type.BIT: "BOOLEAN", 647 exp.DataType.Type.DATE32: "DATE", 648 exp.DataType.Type.DATETIME64: "DATETIME", 649 exp.DataType.Type.DECIMAL32: "DECIMAL", 650 exp.DataType.Type.DECIMAL64: "DECIMAL", 651 exp.DataType.Type.DECIMAL128: "DECIMAL", 652 exp.DataType.Type.DECIMAL256: "DECIMAL", 653 exp.DataType.Type.ENUM8: "ENUM", 654 exp.DataType.Type.ENUM16: "ENUM", 655 exp.DataType.Type.FIXEDSTRING: "TEXT", 656 exp.DataType.Type.GEOMETRY: "GEOGRAPHY", 657 exp.DataType.Type.POINT: "GEOGRAPHYPOINT", 658 exp.DataType.Type.RING: "GEOGRAPHY", 659 exp.DataType.Type.LINESTRING: "GEOGRAPHY", 660 exp.DataType.Type.POLYGON: "GEOGRAPHY", 661 exp.DataType.Type.MULTIPOLYGON: "GEOGRAPHY", 662 exp.DataType.Type.STRUCT: "RECORD", 663 exp.DataType.Type.JSONB: "BSON", 664 exp.DataType.Type.TIMESTAMP: "TIMESTAMP", 665 exp.DataType.Type.TIMESTAMP_S: "TIMESTAMP", 666 exp.DataType.Type.TIMESTAMP_MS: "TIMESTAMP(6)", 667 } 668 669 # https://docs.singlestore.com/cloud/reference/sql-reference/restricted-keywords/list-of-restricted-keywords/ 670 RESERVED_KEYWORDS = { 671 "abs", 672 "absolute", 673 "access", 674 "account", 675 "acos", 676 "action", 677 "add", 678 "adddate", 679 "addtime", 680 "admin", 681 "aes_decrypt", 682 "aes_encrypt", 683 "after", 684 "against", 685 "aggregate", 686 "aggregates", 687 "aggregator", 688 "aggregator_id", 689 "aggregator_plan_hash", 690 "aggregators", 691 "algorithm", 692 "all", 693 "also", 694 "alter", 695 "always", 696 "analyse", 697 "analyze", 698 "and", 699 "anti_join", 700 "any", 701 "any_value", 702 "approx_count_distinct", 703 "approx_count_distinct_accumulate", 704 "approx_count_distinct_combine", 705 "approx_count_distinct_estimate", 706 "approx_geography_intersects", 707 "approx_percentile", 708 "arghistory", 709 "arrange", 710 "arrangement", 711 "array", 712 "as", 713 "asc", 714 "ascii", 715 "asensitive", 716 "asin", 717 "asm", 718 "assertion", 719 "assignment", 720 "ast", 721 "asymmetric", 722 "async", 723 "at", 724 "atan", 725 "atan2", 726 "attach", 727 "attribute", 728 "authorization", 729 "auto", 730 "auto_increment", 731 "auto_reprovision", 732 "autostats", 733 "autostats_cardinality_mode", 734 "autostats_enabled", 735 "autostats_histogram_mode", 736 "autostats_sampling", 737 "availability", 738 "avg", 739 "avg_row_length", 740 "avro", 741 "azure", 742 "background", 743 "_background_threads_for_cleanup", 744 "backup", 745 "backup_history", 746 "backup_id", 747 "backward", 748 "batch", 749 "batches", 750 "batch_interval", 751 "_batch_size_limit", 752 "before", 753 "begin", 754 "between", 755 "bigint", 756 "bin", 757 "binary", 758 "_binary", 759 "bit", 760 "bit_and", 761 "bit_count", 762 "bit_or", 763 "bit_xor", 764 "blob", 765 "bool", 766 "boolean", 767 "bootstrap", 768 "both", 769 "_bt", 770 "btree", 771 "bucket_count", 772 "by", 773 "byte", 774 "byte_length", 775 "cache", 776 "call", 777 "call_for_pipeline", 778 "called", 779 "capture", 780 "cascade", 781 "cascaded", 782 "case", 783 "cast", 784 "catalog", 785 "ceil", 786 "ceiling", 787 "chain", 788 "change", 789 "char", 790 "character", 791 "characteristics", 792 "character_length", 793 "char_length", 794 "charset", 795 "check", 796 "checkpoint", 797 "_check_can_connect", 798 "_check_consistency", 799 "checksum", 800 "_checksum", 801 "class", 802 "clear", 803 "client", 804 "client_found_rows", 805 "close", 806 "cluster", 807 "clustered", 808 "cnf", 809 "coalesce", 810 "coercibility", 811 "collate", 812 "collation", 813 "collect", 814 "column", 815 "columnar", 816 "columns", 817 "columnstore", 818 "columnstore_segment_rows", 819 "comment", 820 "comments", 821 "commit", 822 "committed", 823 "_commit_log_tail", 824 "committed", 825 "compact", 826 "compile", 827 "compressed", 828 "compression", 829 "concat", 830 "concat_ws", 831 "concurrent", 832 "concurrently", 833 "condition", 834 "configuration", 835 "connection", 836 "connection_id", 837 "connections", 838 "config", 839 "constraint", 840 "constraints", 841 "content", 842 "continue", 843 "_continue_replay", 844 "conv", 845 "conversion", 846 "convert", 847 "convert_tz", 848 "copy", 849 "_core", 850 "cos", 851 "cost", 852 "cot", 853 "count", 854 "create", 855 "credentials", 856 "cross", 857 "cube", 858 "csv", 859 "cume_dist", 860 "curdate", 861 "current", 862 "current_catalog", 863 "current_date", 864 "current_role", 865 "current_schema", 866 "current_security_groups", 867 "current_security_roles", 868 "current_time", 869 "current_timestamp", 870 "current_user", 871 "cursor", 872 "curtime", 873 "cycle", 874 "data", 875 "database", 876 "databases", 877 "date", 878 "date_add", 879 "datediff", 880 "date_format", 881 "date_sub", 882 "date_trunc", 883 "datetime", 884 "day", 885 "day_hour", 886 "day_microsecond", 887 "day_minute", 888 "dayname", 889 "dayofmonth", 890 "dayofweek", 891 "dayofyear", 892 "day_second", 893 "deallocate", 894 "dec", 895 "decimal", 896 "declare", 897 "decode", 898 "default", 899 "defaults", 900 "deferrable", 901 "deferred", 902 "defined", 903 "definer", 904 "degrees", 905 "delayed", 906 "delay_key_write", 907 "delete", 908 "delimiter", 909 "delimiters", 910 "dense_rank", 911 "desc", 912 "describe", 913 "detach", 914 "deterministic", 915 "dictionary", 916 "differential", 917 "directory", 918 "disable", 919 "discard", 920 "_disconnect", 921 "disk", 922 "distinct", 923 "distinctrow", 924 "distributed_joins", 925 "div", 926 "do", 927 "document", 928 "domain", 929 "dot_product", 930 "double", 931 "drop", 932 "_drop_profile", 933 "dual", 934 "dump", 935 "duplicate", 936 "dynamic", 937 "earliest", 938 "each", 939 "echo", 940 "election", 941 "else", 942 "elseif", 943 "elt", 944 "enable", 945 "enclosed", 946 "encoding", 947 "encrypted", 948 "end", 949 "engine", 950 "engines", 951 "enum", 952 "errors", 953 "escape", 954 "escaped", 955 "estimate", 956 "euclidean_distance", 957 "event", 958 "events", 959 "except", 960 "exclude", 961 "excluding", 962 "exclusive", 963 "execute", 964 "exists", 965 "exit", 966 "exp", 967 "explain", 968 "extended", 969 "extension", 970 "external", 971 "external_host", 972 "external_port", 973 "extract", 974 "extractor", 975 "extractors", 976 "extra_join", 977 "_failover", 978 "failed_login_attempts", 979 "failure", 980 "false", 981 "family", 982 "fault", 983 "fetch", 984 "field", 985 "fields", 986 "file", 987 "files", 988 "fill", 989 "first", 990 "first_value", 991 "fix_alter", 992 "fixed", 993 "float", 994 "float4", 995 "float8", 996 "floor", 997 "flush", 998 "following", 999 "for", 1000 "force", 1001 "force_compiled_mode", 1002 "force_interpreter_mode", 1003 "foreground", 1004 "foreign", 1005 "format", 1006 "forward", 1007 "found_rows", 1008 "freeze", 1009 "from", 1010 "from_base64", 1011 "from_days", 1012 "from_unixtime", 1013 "fs", 1014 "_fsync", 1015 "full", 1016 "fulltext", 1017 "function", 1018 "functions", 1019 "gc", 1020 "gcs", 1021 "get_format", 1022 "_gc", 1023 "_gcx", 1024 "generate", 1025 "geography", 1026 "geography_area", 1027 "geography_contains", 1028 "geography_distance", 1029 "geography_intersects", 1030 "geography_latitude", 1031 "geography_length", 1032 "geography_longitude", 1033 "geographypoint", 1034 "geography_point", 1035 "geography_within_distance", 1036 "geometry", 1037 "geometry_area", 1038 "geometry_contains", 1039 "geometry_distance", 1040 "geometry_filter", 1041 "geometry_intersects", 1042 "geometry_length", 1043 "geometrypoint", 1044 "geometry_point", 1045 "geometry_within_distance", 1046 "geometry_x", 1047 "geometry_y", 1048 "global", 1049 "_global_version_timestamp", 1050 "grant", 1051 "granted", 1052 "grants", 1053 "greatest", 1054 "group", 1055 "grouping", 1056 "groups", 1057 "group_concat", 1058 "gzip", 1059 "handle", 1060 "handler", 1061 "hard_cpu_limit_percentage", 1062 "hash", 1063 "has_temp_tables", 1064 "having", 1065 "hdfs", 1066 "header", 1067 "heartbeat_no_logging", 1068 "hex", 1069 "highlight", 1070 "high_priority", 1071 "hold", 1072 "holding", 1073 "host", 1074 "hosts", 1075 "hour", 1076 "hour_microsecond", 1077 "hour_minute", 1078 "hour_second", 1079 "identified", 1080 "identity", 1081 "if", 1082 "ifnull", 1083 "ignore", 1084 "ilike", 1085 "immediate", 1086 "immutable", 1087 "implicit", 1088 "import", 1089 "in", 1090 "including", 1091 "increment", 1092 "incremental", 1093 "index", 1094 "indexes", 1095 "inet_aton", 1096 "inet_ntoa", 1097 "inet6_aton", 1098 "inet6_ntoa", 1099 "infile", 1100 "inherit", 1101 "inherits", 1102 "_init_profile", 1103 "init", 1104 "initcap", 1105 "initialize", 1106 "initially", 1107 "inject", 1108 "inline", 1109 "inner", 1110 "inout", 1111 "input", 1112 "insensitive", 1113 "insert", 1114 "insert_method", 1115 "instance", 1116 "instead", 1117 "instr", 1118 "int", 1119 "int1", 1120 "int2", 1121 "int3", 1122 "int4", 1123 "int8", 1124 "integer", 1125 "_internal_dynamic_typecast", 1126 "interpreter_mode", 1127 "intersect", 1128 "interval", 1129 "into", 1130 "invoker", 1131 "is", 1132 "isnull", 1133 "isolation", 1134 "iterate", 1135 "join", 1136 "json", 1137 "json_agg", 1138 "json_array_contains_double", 1139 "json_array_contains_json", 1140 "json_array_contains_string", 1141 "json_array_push_double", 1142 "json_array_push_json", 1143 "json_array_push_string", 1144 "json_delete_key", 1145 "json_extract_double", 1146 "json_extract_json", 1147 "json_extract_string", 1148 "json_extract_bigint", 1149 "json_get_type", 1150 "json_length", 1151 "json_set_double", 1152 "json_set_json", 1153 "json_set_string", 1154 "json_splice_double", 1155 "json_splice_json", 1156 "json_splice_string", 1157 "kafka", 1158 "key", 1159 "key_block_size", 1160 "keys", 1161 "kill", 1162 "killall", 1163 "label", 1164 "lag", 1165 "language", 1166 "large", 1167 "last", 1168 "last_day", 1169 "last_insert_id", 1170 "last_value", 1171 "lateral", 1172 "latest", 1173 "lc_collate", 1174 "lc_ctype", 1175 "lcase", 1176 "lead", 1177 "leading", 1178 "leaf", 1179 "leakproof", 1180 "least", 1181 "leave", 1182 "leaves", 1183 "left", 1184 "length", 1185 "level", 1186 "license", 1187 "like", 1188 "limit", 1189 "lines", 1190 "listen", 1191 "llvm", 1192 "ln", 1193 "load", 1194 "loaddata_where", 1195 "_load", 1196 "local", 1197 "localtime", 1198 "localtimestamp", 1199 "locate", 1200 "location", 1201 "lock", 1202 "log", 1203 "log10", 1204 "log2", 1205 "long", 1206 "longblob", 1207 "longtext", 1208 "loop", 1209 "lower", 1210 "low_priority", 1211 "lpad", 1212 "_ls", 1213 "ltrim", 1214 "lz4", 1215 "management", 1216 "_management_thread", 1217 "mapping", 1218 "master", 1219 "match", 1220 "materialized", 1221 "max", 1222 "maxvalue", 1223 "max_concurrency", 1224 "max_errors", 1225 "max_partitions_per_batch", 1226 "max_queue_depth", 1227 "max_retries_per_batch_partition", 1228 "max_rows", 1229 "mbc", 1230 "md5", 1231 "mpl", 1232 "median", 1233 "mediumblob", 1234 "mediumint", 1235 "mediumtext", 1236 "member", 1237 "memory", 1238 "memory_percentage", 1239 "_memsql_table_id_lookup", 1240 "memsql", 1241 "memsql_deserialize", 1242 "memsql_imitating_kafka", 1243 "memsql_serialize", 1244 "merge", 1245 "metadata", 1246 "microsecond", 1247 "middleint", 1248 "min", 1249 "min_rows", 1250 "minus", 1251 "minute", 1252 "minute_microsecond", 1253 "minute_second", 1254 "minvalue", 1255 "mod", 1256 "mode", 1257 "model", 1258 "modifies", 1259 "modify", 1260 "month", 1261 "monthname", 1262 "months_between", 1263 "move", 1264 "mpl", 1265 "names", 1266 "named", 1267 "namespace", 1268 "national", 1269 "natural", 1270 "nchar", 1271 "next", 1272 "no", 1273 "node", 1274 "none", 1275 "no_query_rewrite", 1276 "noparam", 1277 "not", 1278 "nothing", 1279 "notify", 1280 "now", 1281 "nowait", 1282 "no_write_to_binlog", 1283 "no_query_rewrite", 1284 "norely", 1285 "nth_value", 1286 "ntile", 1287 "null", 1288 "nullcols", 1289 "nullif", 1290 "nulls", 1291 "numeric", 1292 "nvarchar", 1293 "object", 1294 "octet_length", 1295 "of", 1296 "off", 1297 "offline", 1298 "offset", 1299 "offsets", 1300 "oids", 1301 "on", 1302 "online", 1303 "only", 1304 "open", 1305 "operator", 1306 "optimization", 1307 "optimize", 1308 "optimizer", 1309 "optimizer_state", 1310 "option", 1311 "options", 1312 "optionally", 1313 "or", 1314 "order", 1315 "ordered_serialize", 1316 "orphan", 1317 "out", 1318 "out_of_order", 1319 "outer", 1320 "outfile", 1321 "over", 1322 "overlaps", 1323 "overlay", 1324 "owned", 1325 "owner", 1326 "pack_keys", 1327 "paired", 1328 "parser", 1329 "parquet", 1330 "partial", 1331 "partition", 1332 "partition_id", 1333 "partitioning", 1334 "partitions", 1335 "passing", 1336 "password", 1337 "password_lock_time", 1338 "parser", 1339 "pause", 1340 "_pause_replay", 1341 "percent_rank", 1342 "percentile_cont", 1343 "percentile_disc", 1344 "periodic", 1345 "persisted", 1346 "pi", 1347 "pipeline", 1348 "pipelines", 1349 "pivot", 1350 "placing", 1351 "plan", 1352 "plans", 1353 "plancache", 1354 "plugins", 1355 "pool", 1356 "pools", 1357 "port", 1358 "position", 1359 "pow", 1360 "power", 1361 "preceding", 1362 "precision", 1363 "prepare", 1364 "prepared", 1365 "preserve", 1366 "primary", 1367 "prior", 1368 "privileges", 1369 "procedural", 1370 "procedure", 1371 "procedures", 1372 "process", 1373 "processlist", 1374 "profile", 1375 "profiles", 1376 "program", 1377 "promote", 1378 "proxy", 1379 "purge", 1380 "quarter", 1381 "queries", 1382 "query", 1383 "query_timeout", 1384 "queue", 1385 "quote", 1386 "radians", 1387 "rand", 1388 "range", 1389 "rank", 1390 "read", 1391 "_read", 1392 "reads", 1393 "real", 1394 "reassign", 1395 "rebalance", 1396 "recheck", 1397 "record", 1398 "recursive", 1399 "redundancy", 1400 "redundant", 1401 "ref", 1402 "reference", 1403 "references", 1404 "refresh", 1405 "regexp", 1406 "reindex", 1407 "relative", 1408 "release", 1409 "reload", 1410 "rely", 1411 "remote", 1412 "remove", 1413 "rename", 1414 "repair", 1415 "_repair_table", 1416 "repeat", 1417 "repeatable", 1418 "_repl", 1419 "_reprovisioning", 1420 "replace", 1421 "replica", 1422 "replicate", 1423 "replicating", 1424 "replication", 1425 "durability", 1426 "require", 1427 "resource", 1428 "resource_pool", 1429 "reset", 1430 "restart", 1431 "restore", 1432 "restrict", 1433 "result", 1434 "_resurrect", 1435 "retry", 1436 "return", 1437 "returning", 1438 "returns", 1439 "reverse", 1440 "revoke", 1441 "rg_pool", 1442 "right", 1443 "right_anti_join", 1444 "right_semi_join", 1445 "right_straight_join", 1446 "rlike", 1447 "role", 1448 "roles", 1449 "rollback", 1450 "rollup", 1451 "round", 1452 "routine", 1453 "row", 1454 "row_count", 1455 "row_format", 1456 "row_number", 1457 "rows", 1458 "rowstore", 1459 "rule", 1460 "rpad", 1461 "_rpc", 1462 "rtrim", 1463 "running", 1464 "s3", 1465 "safe", 1466 "save", 1467 "savepoint", 1468 "scalar", 1469 "schema", 1470 "schemas", 1471 "schema_binding", 1472 "scroll", 1473 "search", 1474 "second", 1475 "second_microsecond", 1476 "sec_to_time", 1477 "security", 1478 "select", 1479 "semi_join", 1480 "_send_threads", 1481 "sensitive", 1482 "separator", 1483 "sequence", 1484 "sequences", 1485 "serial", 1486 "serializable", 1487 "series", 1488 "service_user", 1489 "server", 1490 "session", 1491 "session_user", 1492 "set", 1493 "setof", 1494 "security_lists_intersect", 1495 "sha", 1496 "sha1", 1497 "sha2", 1498 "shard", 1499 "sharded", 1500 "sharded_id", 1501 "share", 1502 "show", 1503 "shutdown", 1504 "sigmoid", 1505 "sign", 1506 "signal", 1507 "similar", 1508 "simple", 1509 "site", 1510 "signed", 1511 "sin", 1512 "skip", 1513 "skipped_batches", 1514 "sleep", 1515 "_sleep", 1516 "smallint", 1517 "snapshot", 1518 "_snapshot", 1519 "_snapshots", 1520 "soft_cpu_limit_percentage", 1521 "some", 1522 "soname", 1523 "sparse", 1524 "spatial", 1525 "spatial_check_index", 1526 "specific", 1527 "split", 1528 "sql", 1529 "sql_big_result", 1530 "sql_buffer_result", 1531 "sql_cache", 1532 "sql_calc_found_rows", 1533 "sqlexception", 1534 "sql_mode", 1535 "sql_no_cache", 1536 "sql_no_logging", 1537 "sql_small_result", 1538 "sqlstate", 1539 "sqlwarning", 1540 "sqrt", 1541 "ssl", 1542 "stable", 1543 "standalone", 1544 "start", 1545 "starting", 1546 "state", 1547 "statement", 1548 "statistics", 1549 "stats", 1550 "status", 1551 "std", 1552 "stddev", 1553 "stddev_pop", 1554 "stddev_samp", 1555 "stdin", 1556 "stdout", 1557 "stop", 1558 "storage", 1559 "str_to_date", 1560 "straight_join", 1561 "strict", 1562 "string", 1563 "strip", 1564 "subdate", 1565 "substr", 1566 "substring", 1567 "substring_index", 1568 "success", 1569 "sum", 1570 "super", 1571 "symmetric", 1572 "sync_snapshot", 1573 "sync", 1574 "_sync", 1575 "_sync2", 1576 "_sync_partitions", 1577 "_sync_snapshot", 1578 "synchronize", 1579 "sysid", 1580 "system", 1581 "table", 1582 "table_checksum", 1583 "tables", 1584 "tablespace", 1585 "tags", 1586 "tan", 1587 "target_size", 1588 "task", 1589 "temp", 1590 "template", 1591 "temporary", 1592 "temptable", 1593 "_term_bump", 1594 "terminate", 1595 "terminated", 1596 "test", 1597 "text", 1598 "then", 1599 "time", 1600 "timediff", 1601 "time_bucket", 1602 "time_format", 1603 "timeout", 1604 "timestamp", 1605 "timestampadd", 1606 "timestampdiff", 1607 "timezone", 1608 "time_to_sec", 1609 "tinyblob", 1610 "tinyint", 1611 "tinytext", 1612 "to", 1613 "to_base64", 1614 "to_char", 1615 "to_date", 1616 "to_days", 1617 "to_json", 1618 "to_number", 1619 "to_seconds", 1620 "to_timestamp", 1621 "tracelogs", 1622 "traditional", 1623 "trailing", 1624 "transform", 1625 "transaction", 1626 "_transactions_experimental", 1627 "treat", 1628 "trigger", 1629 "triggers", 1630 "trim", 1631 "true", 1632 "trunc", 1633 "truncate", 1634 "trusted", 1635 "two_phase", 1636 "_twopcid", 1637 "type", 1638 "types", 1639 "ucase", 1640 "unbounded", 1641 "uncommitted", 1642 "undefined", 1643 "undo", 1644 "unencrypted", 1645 "unenforced", 1646 "unhex", 1647 "unhold", 1648 "unicode", 1649 "union", 1650 "unique", 1651 "_unittest", 1652 "unix_timestamp", 1653 "unknown", 1654 "unlisten", 1655 "_unload", 1656 "unlock", 1657 "unlogged", 1658 "unpivot", 1659 "unsigned", 1660 "until", 1661 "update", 1662 "upgrade", 1663 "upper", 1664 "usage", 1665 "use", 1666 "user", 1667 "users", 1668 "using", 1669 "utc_date", 1670 "utc_time", 1671 "utc_timestamp", 1672 "_utf8", 1673 "vacuum", 1674 "valid", 1675 "validate", 1676 "validator", 1677 "value", 1678 "values", 1679 "varbinary", 1680 "varchar", 1681 "varcharacter", 1682 "variables", 1683 "variadic", 1684 "variance", 1685 "var_pop", 1686 "var_samp", 1687 "varying", 1688 "vector_sub", 1689 "verbose", 1690 "version", 1691 "view", 1692 "void", 1693 "volatile", 1694 "voting", 1695 "wait", 1696 "_wake", 1697 "warnings", 1698 "week", 1699 "weekday", 1700 "weekofyear", 1701 "when", 1702 "where", 1703 "while", 1704 "whitespace", 1705 "window", 1706 "with", 1707 "without", 1708 "within", 1709 "_wm_heartbeat", 1710 "work", 1711 "workload", 1712 "wrapper", 1713 "write", 1714 "xact_id", 1715 "xor", 1716 "year", 1717 "year_month", 1718 "yes", 1719 "zerofill", 1720 "zone", 1721 } 1722 1723 def jsonextractscalar_sql(self, expression: exp.JSONExtractScalar) -> str: 1724 json_type = expression.args.get("json_type") 1725 func_name = "JSON_EXTRACT_JSON" if json_type is None else f"JSON_EXTRACT_{json_type}" 1726 return json_extract_segments(func_name)(self, expression) 1727 1728 def jsonbextractscalar_sql(self, expression: exp.JSONBExtractScalar) -> str: 1729 json_type = expression.args.get("json_type") 1730 func_name = "BSON_EXTRACT_BSON" if json_type is None else f"BSON_EXTRACT_{json_type}" 1731 return json_extract_segments(func_name)(self, expression) 1732 1733 def jsonextractarray_sql(self, expression: exp.JSONExtractArray) -> str: 1734 self.unsupported("Arrays are not supported in SingleStore") 1735 return self.function_fallback_sql(expression) 1736 1737 @unsupported_args("on_condition") 1738 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1739 res: exp.Expression = exp.JSONExtractScalar( 1740 this=expression.this, 1741 expression=expression.args.get("path"), 1742 json_type="STRING", 1743 ) 1744 1745 returning = expression.args.get("returning") 1746 if returning is not None: 1747 res = exp.Cast(this=res, to=returning) 1748 1749 return self.sql(res) 1750 1751 def all_sql(self, expression: exp.All) -> str: 1752 self.unsupported("ALL subquery predicate is not supported in SingleStore") 1753 return super().all_sql(expression) 1754 1755 def jsonarraycontains_sql(self, expression: exp.JSONArrayContains) -> str: 1756 json_type = expression.text("json_type").upper() 1757 1758 if json_type: 1759 return self.func( 1760 f"JSON_ARRAY_CONTAINS_{json_type}", expression.expression, expression.this 1761 ) 1762 1763 return self.func( 1764 "JSON_ARRAY_CONTAINS_JSON", 1765 expression.expression, 1766 self.func("TO_JSON", expression.this), 1767 ) 1768 1769 @unsupported_args("kind", "values") 1770 def datatype_sql(self, expression: exp.DataType) -> str: 1771 if expression.args.get("nested") and not expression.is_type(exp.DataType.Type.STRUCT): 1772 self.unsupported( 1773 f"Argument 'nested' is not supported for representation of '{expression.this.value}' in SingleStore" 1774 ) 1775 1776 if expression.is_type(exp.DataType.Type.VARBINARY) and not expression.expressions: 1777 # `VARBINARY` must always have a size - if it doesn't, we always generate `BLOB` 1778 return "BLOB" 1779 if expression.is_type( 1780 exp.DataType.Type.DECIMAL32, 1781 exp.DataType.Type.DECIMAL64, 1782 exp.DataType.Type.DECIMAL128, 1783 exp.DataType.Type.DECIMAL256, 1784 ): 1785 scale = self.expressions(expression, flat=True) 1786 1787 if expression.is_type(exp.DataType.Type.DECIMAL32): 1788 precision = "9" 1789 elif expression.is_type(exp.DataType.Type.DECIMAL64): 1790 precision = "18" 1791 elif expression.is_type(exp.DataType.Type.DECIMAL128): 1792 precision = "38" 1793 else: 1794 # 65 is a maximum precision supported in SingleStore 1795 precision = "65" 1796 if scale is not None: 1797 return f"DECIMAL({precision}, {scale[0]})" 1798 else: 1799 return f"DECIMAL({precision})" 1800 if expression.is_type(exp.DataType.Type.VECTOR): 1801 expressions = expression.expressions 1802 if len(expressions) == 2: 1803 type_name = self.sql(expressions[0]) 1804 if type_name in self.dialect.INVERSE_VECTOR_TYPE_ALIASES: 1805 type_name = self.dialect.INVERSE_VECTOR_TYPE_ALIASES[type_name] 1806 1807 return f"VECTOR({self.sql(expressions[1])}, {type_name})" 1808 1809 return super().datatype_sql(expression) 1810 1811 def collate_sql(self, expression: exp.Collate) -> str: 1812 # SingleStore does not support setting a collation for column in the SELECT query, 1813 # so we cast column to a LONGTEXT type with specific collation 1814 return self.binary(expression, ":> LONGTEXT COLLATE") 1815 1816 def currentdate_sql(self, expression: exp.CurrentDate) -> str: 1817 timezone = expression.this 1818 if timezone: 1819 if isinstance(timezone, exp.Literal) and timezone.name.lower() == "utc": 1820 return self.func("UTC_DATE") 1821 self.unsupported("CurrentDate with timezone is not supported in SingleStore") 1822 1823 return self.func("CURRENT_DATE") 1824 1825 def currenttime_sql(self, expression: exp.CurrentTime) -> str: 1826 arg = expression.this 1827 if arg: 1828 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1829 return self.func("UTC_TIME") 1830 if isinstance(arg, exp.Literal) and arg.is_number: 1831 return self.func("CURRENT_TIME", arg) 1832 self.unsupported("CurrentTime with timezone is not supported in SingleStore") 1833 1834 return self.func("CURRENT_TIME") 1835 1836 def currenttimestamp_sql(self, expression: exp.CurrentTimestamp) -> str: 1837 arg = expression.this 1838 if arg: 1839 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1840 return self.func("UTC_TIMESTAMP") 1841 if isinstance(arg, exp.Literal) and arg.is_number: 1842 return self.func("CURRENT_TIMESTAMP", arg) 1843 self.unsupported("CurrentTimestamp with timezone is not supported in SingleStore") 1844 1845 return self.func("CURRENT_TIMESTAMP") 1846 1847 def standardhash_sql(self, expression: exp.StandardHash) -> str: 1848 hash_function = expression.expression 1849 if hash_function is None: 1850 return self.func("SHA", expression.this) 1851 if isinstance(hash_function, exp.Literal): 1852 if hash_function.name.lower() == "sha": 1853 return self.func("SHA", expression.this) 1854 if hash_function.name.lower() == "md5": 1855 return self.func("MD5", expression.this) 1856 1857 self.unsupported( 1858 f"{hash_function.this} hash method is not supported in SingleStore" 1859 ) 1860 return self.func("SHA", expression.this) 1861 1862 self.unsupported("STANDARD_HASH function is not supported in SingleStore") 1863 return self.func("SHA", expression.this) 1864 1865 @unsupported_args("is_database", "exists", "cluster", "identity", "option", "partition") 1866 def truncatetable_sql(self, expression: exp.TruncateTable) -> str: 1867 statements = [] 1868 for expression in expression.expressions: 1869 statements.append(f"TRUNCATE {self.sql(expression)}") 1870 1871 return "; ".join(statements) 1872 1873 @unsupported_args("exists") 1874 def renamecolumn_sql(self, expression: exp.RenameColumn) -> str: 1875 old_column = self.sql(expression, "this") 1876 new_column = self.sql(expression, "to") 1877 return f"CHANGE {old_column} {new_column}" 1878 1879 @unsupported_args("drop", "comment", "allow_null", "visible", "using") 1880 def altercolumn_sql(self, expression: exp.AlterColumn) -> str: 1881 alter = super().altercolumn_sql(expression) 1882 1883 collate = self.sql(expression, "collate") 1884 collate = f" COLLATE {collate}" if collate else "" 1885 return f"{alter}{collate}" 1886 1887 def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint) -> str: 1888 this = self.sql(expression, "this") 1889 not_null = " NOT NULL" if expression.args.get("not_null") else "" 1890 type = self.sql(expression, "data_type") or "AUTO" 1891 return f"AS {this} PERSISTED {type}{not_null}"
Generator converts a given syntax tree to the corresponding SQL string.
Arguments:
- pretty: Whether to format the produced SQL string. Default: False.
- identify: Determines when an identifier should be quoted. Possible values are: False (default): Never quote, except in cases where it's mandatory by the dialect. True: Always quote except for specials cases. 'safe': Only quote identifiers that are case insensitive.
- normalize: Whether to normalize identifiers to lowercase. Default: False.
- pad: The pad size in a formatted string. For example, this affects the indentation of a projection in a query, relative to its nesting level. Default: 2.
- indent: The indentation size in a formatted string. For example, this affects the
indentation of subqueries and filters under a
WHEREclause. Default: 2. - normalize_functions: How to normalize function names. Possible values are: "upper" or True (default): Convert names to uppercase. "lower": Convert names to lowercase. False: Disables function name normalization.
- unsupported_level: Determines the generator's behavior when it encounters unsupported expressions. Default ErrorLevel.WARN.
- max_unsupported: Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3
- leading_comma: Whether the comma is leading or trailing in select expressions. This is only relevant when generating in pretty mode. Default: False
- max_text_width: The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true line length. Default: 80
- comments: Whether to preserve comments in the output SQL code. Default: True
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.Adjacent'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeColumns'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeWith'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayContainsAll'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayOverlaps'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Ceil'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConnectByRoot'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ConvertToCharset'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CopyGrantsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CredentialsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CurrentCatalog'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SessionUser'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.DateFormatColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DefaultColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.DynamicProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EmptyProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EncodeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EnviromentProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Except'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Floor'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Get'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Intersect'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Int64'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContainsAnyTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBDeleteAtPath'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExtendsLeft'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExtendsRight'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionedByBucket'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionByTruncate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PositionalColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ZeroFillColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Put'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TableColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Union'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UnloggedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingTemplateProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UsingData'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UppercaseColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UtcDate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.UtcTime'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.UtcTimestamp'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseAndAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseOrAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseXorAgg'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseCount'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Chr'>: <function MySQL.Generator.<lambda>>, <class 'sqlglot.expressions.DateDiff'>: <function SingleStore.Generator.<lambda>>, <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 timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.Day'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DayOfMonth'>: <function rename_func.<locals>.<lambda>>, <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 SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.LogicalAnd'>: <function SingleStore.Generator.<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 SingleStore.Generator.<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 SingleStore.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.CastToStrType'>: <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.DateBin'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.TimeStrToDate'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.FromTimeZone'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.DiToDate'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.DateToDi'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDiToDi'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Time'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.DatetimeAdd'>: <function _remove_ts_or_ds_to_date.<locals>.func>, <class 'sqlglot.expressions.DatetimeTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.DatetimeSub'>: <function date_add_interval_sql.<locals>.func>, <class 'sqlglot.expressions.DatetimeDiff'>: <function timestampdiff_sql>, <class 'sqlglot.expressions.TimestampTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.CurrentDatetime'>: <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>, <class 'sqlglot.expressions.JSONFormat'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.JSONArrayAgg'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.JSONArray'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.JSONBExists'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.JSONExists'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.JSONObject'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.DayOfWeekIso'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Hll'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CountIf'>: <function count_if_to_sum>, <class 'sqlglot.expressions.ApproxQuantile'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Variance'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.VariancePop'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Xor'>: <function bool_xor_sql>, <class 'sqlglot.expressions.Cbrt'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.RegexpLike'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Repeat'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.IsAscii'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.MD5Digest'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Contains'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.RegexpExtractAll'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.RegexpExtract'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.StartsWith'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.FromBase'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.RegexpILike'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.National'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Reduce'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.MatchAgainst'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Show'>: <function SingleStore.Generator.<lambda>>, <class 'sqlglot.expressions.Describe'>: <function SingleStore.Generator.<lambda>>}
UNSUPPORTED_TYPES =
{<Type.UNKNOWN: 'UNKNOWN'>, <Type.DYNAMIC: 'DYNAMIC'>, <Type.SMALLMONEY: 'SMALLMONEY'>, <Type.TIMETZ: 'TIMETZ'>, <Type.BPCHAR: 'BPCHAR'>, <Type.INT128: 'INT128'>, <Type.HSTORE: 'HSTORE'>, <Type.INTERVAL: 'INTERVAL'>, <Type.USERDEFINED: 'USER-DEFINED'>, <Type.MULTILINESTRING: 'MULTILINESTRING'>, <Type.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>, <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <Type.INET: 'INET'>, <Type.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <Type.TSTZRANGE: 'TSTZRANGE'>, <Type.NOTHING: 'NOTHING'>, <Type.UINT256: 'UINT256'>, <Type.NUMRANGE: 'NUMRANGE'>, <Type.LOWCARDINALITY: 'LOWCARDINALITY'>, <Type.DATERANGE: 'DATERANGE'>, <Type.INT8RANGE: 'INT8RANGE'>, <Type.IPADDRESS: 'IPADDRESS'>, <Type.SMALLSERIAL: 'SMALLSERIAL'>, <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <Type.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <Type.IPV6: 'IPV6'>, <Type.NESTED: 'NESTED'>, <Type.IMAGE: 'IMAGE'>, <Type.MAP: 'MAP'>, <Type.HLLSKETCH: 'HLLSKETCH'>, <Type.NAME: 'NAME'>, <Type.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <Type.LIST: 'LIST'>, <Type.UNION: 'UNION'>, <Type.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <Type.ROWVERSION: 'ROWVERSION'>, <Type.RANGE: 'RANGE'>, <Type.SUPER: 'SUPER'>, <Type.INT4RANGE: 'INT4RANGE'>, <Type.VARIANT: 'VARIANT'>, <Type.SERIAL: 'SERIAL'>, <Type.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <Type.MONEY: 'MONEY'>, <Type.NULL: 'NULL'>, <Type.IPV4: 'IPV4'>, <Type.UINT128: 'UINT128'>, <Type.UUID: 'UUID'>, <Type.TDIGEST: 'TDIGEST'>, <Type.XML: 'XML'>, <Type.TSRANGE: 'TSRANGE'>, <Type.IPPREFIX: 'IPPREFIX'>, <Type.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <Type.OBJECT: 'OBJECT'>, <Type.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <Type.BIGSERIAL: 'BIGSERIAL'>, <Type.TSMULTIRANGE: 'TSMULTIRANGE'>, <Type.INT256: 'INT256'>, <Type.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <Type.ARRAY: 'ARRAY'>}
TYPE_MAPPING =
{<Type.DATETIME2: 'DATETIME2'>: 'DATETIME', <Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.SMALLDATETIME: 'SMALLDATETIME'>: 'DATETIME', <Type.UBIGINT: 'UBIGINT'>: 'BIGINT', <Type.UINT: 'UINT'>: 'INT', <Type.UMEDIUMINT: 'UMEDIUMINT'>: 'MEDIUMINT', <Type.USMALLINT: 'USMALLINT'>: 'SMALLINT', <Type.UTINYINT: 'UTINYINT'>: 'TINYINT', <Type.UDECIMAL: 'UDECIMAL'>: 'DECIMAL', <Type.UDOUBLE: 'UDOUBLE'>: 'DOUBLE', <Type.TIMESTAMP: 'TIMESTAMP'>: 'TIMESTAMP', <Type.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>: 'DATETIME', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'TIMESTAMP', <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>: 'TIMESTAMP', <Type.BIGDECIMAL: 'BIGDECIMAL'>: 'DECIMAL', <Type.BIT: 'BIT'>: 'BOOLEAN', <Type.DATE32: 'DATE32'>: 'DATE', <Type.DATETIME64: 'DATETIME64'>: 'DATETIME', <Type.DECIMAL32: 'DECIMAL32'>: 'DECIMAL', <Type.DECIMAL64: 'DECIMAL64'>: 'DECIMAL', <Type.DECIMAL128: 'DECIMAL128'>: 'DECIMAL', <Type.DECIMAL256: 'DECIMAL256'>: 'DECIMAL', <Type.ENUM8: 'ENUM8'>: 'ENUM', <Type.ENUM16: 'ENUM16'>: 'ENUM', <Type.FIXEDSTRING: 'FIXEDSTRING'>: 'TEXT', <Type.GEOMETRY: 'GEOMETRY'>: 'GEOGRAPHY', <Type.POINT: 'POINT'>: 'GEOGRAPHYPOINT', <Type.RING: 'RING'>: 'GEOGRAPHY', <Type.LINESTRING: 'LINESTRING'>: 'GEOGRAPHY', <Type.POLYGON: 'POLYGON'>: 'GEOGRAPHY', <Type.MULTIPOLYGON: 'MULTIPOLYGON'>: 'GEOGRAPHY', <Type.STRUCT: 'STRUCT'>: 'RECORD', <Type.JSONB: 'JSONB'>: 'BSON', <Type.TIMESTAMP_S: 'TIMESTAMP_S'>: 'TIMESTAMP', <Type.TIMESTAMP_MS: 'TIMESTAMP_MS'>: 'TIMESTAMP(6)'}
RESERVED_KEYWORDS =
{'_batch_size_limit', 'work', 'privileges', 'longtext', 'program', 'declare', 'date_sub', 'right_anti_join', 'aggregator_id', '_memsql_table_id_lookup', 'pause', 'sign', 'week', 'to_date', 'concat', 'plan', 'share', 'lateral', 'between', 'delimiters', 'constraints', 'json_splice_json', 'character', 'recheck', 'union', 'current_catalog', 'power', 'value', 'parquet', 'engine', 'ast', 'returning', 'notify', 'timestamp', 'sec_to_time', 'stop', 'timestampdiff', 'datediff', 'rule', 'bit_count', 'check', 'memsql_deserialize', 'resource', 'serializable', 'discard', 'storage', 'current_security_roles', 'values', 'roles', 'char', 'host', 'intersect', 'replicate', 'mpl', 'like', 'json_array_contains_json', 'valid', 'symmetric', 'asc', 'drop', 'ssl', 'lcase', 'nvarchar', 'bool', 'in', 'cos', 'durability', 'port', 'deferred', 'extract', 'anti_join', 'degrees', 'geometry_point', 'task', 'json_array_contains_double', 'connection_id', 'member', 'sync_snapshot', 'defaults', 'int', 'ascii', 'tinyint', 'columns', 'collate', 'nth_value', 'json_set_json', 'time', 'remove', 'extended', 'min', 'each', 'rollup', 'management', 'databases', '_repair_table', 'unenforced', 'length', 'setof', 'or', 'temporary', 'double', 'aes_decrypt', 'any', 'statement', 'cluster', 'freeze', 'compressed', '_checksum', 'concurrently', 'mode', 'stddev', 'some', 'orphan', 'bit_xor', 'left', 'asensitive', 'elseif', 'uncommitted', 'current', 'day_minute', 'std', 'admin', 'operator', 'current_security_groups', 'if', 'isolation', 'any_value', 'queue', 'high_priority', 'utc_timestamp', 'to_base64', 'unique', 'conv', 'safe', 'sql_no_logging', 'sqlwarning', 'json_splice_double', 'autostats_enabled', 'geography_within_distance', '_utf8', 'errors', 'arghistory', 'oids', 'write', 'bit_and', 'approx_percentile', 'reset', 'json_array_push_json', 'now', 'upgrade', 'numeric', 'timediff', 'first_value', 'inet6_ntoa', 'from_unixtime', 'initially', 'external_port', 'sha1', 'explain', 'restrict', 'delete', 'return', 'llvm', 'connections', 'level', 'hour_minute', 'geography_area', 'bucket_count', 'kafka', 'first', 'at', 'target_size', 'distributed_joins', 'transaction', 'utc_date', 'restart', 'dictionary', 'md5', 'repair', 'found_rows', 'failure', 'minus', 'promote', 'sqlexception', 'lc_ctype', 'stable', 'geometry_y', 'variadic', 'percentile_disc', 'optimizer_state', 'returns', 'online', 'geometry_distance', 'last', 'minute_second', 'autostats_sampling', 'when', 'conversion', 'compact', 'nothing', 'shutdown', 'offset', 'sequences', 'absolute', 'partition', 'backup', 'geometry_area', 'heartbeat_no_logging', 'routine', 'config', 'comments', 'background', 'gcs', 'options', 'to', '_commit_log_tail', 'truncate', '_transactions_experimental', 'restore', 'memory', 'flush', 'mapping', 'placing', 'exclude', 'iterate', 'owned', 'sigmoid', 'xact_id', 'microsecond', 'read', 'instance', 'optimize', 'else', 'unix_timestamp', 'security', 'desc', 'json_get_type', 'owner', '_read', 'procedural', 'no_query_rewrite', 'field', 'atan2', 'max_queue_depth', 'terminate', 'extractor', 'primary', '_background_threads_for_cleanup', 'grants', 'var_samp', 'time_bucket', 'key', 'insert_method', 'to_json', 'is', 'pi', 'algorithm', 'verbose', 'geography_length', '_gc', 'dump', 'exists', 'json_array_push_string', 'super', 'trusted', 'account', 'json_extract_bigint', 'commit', 'distinctrow', 'trim', 'traditional', 'string', 'comment', 'position', '_continue_replay', 'log10', 'mod', '_global_version_timestamp', 'int2', 'geography', 'enum', 'initialize', 'call_for_pipeline', 'license', 'substring', 'incremental', 'rank', 'sleep', 'autostats_cardinality_mode', 'current_schema', 'join', 'queries', 'hour_microsecond', 'function', 'holding', '_repl', 'tags', '_term_bump', 'stdin', 'into', 'deterministic', 'forward', 'dayofmonth', 'fix_alter', 'inherits', 'json_length', '_rpc', 'aggregate', 'geometry_contains', 'view', 'clear', 'xor', 'key_block_size', 'backup_id', 'csv', 'begin', 'max_errors', 'asin', 'table_checksum', '_pause_replay', 'compression', 'nowait', 'continue', '_unload', 'option', 'boolean', 'offsets', 'temp', 'statistics', 'optimization', 'snapshot', 'simple', 'byte_length', 'ceil', 'fault', 'characteristics', 'date_trunc', 'undefined', 'ilike', 'stats', 'count', 'starting', 'clustered', 'dual', 'ltrim', 'file', 'pivot', 'hash', 'leaves', 'sqlstate', 'zerofill', 'session_user', 'capture', 'detach', 'soname', 'system', 'geometry_within_distance', 'tracelogs', 'nullif', 'spatial', 'stddev_pop', 'wrapper', 'integer', 'profiles', 'localtime', 'external', 'modifies', 'groups', 'skip', 'authorization', 'columnstore_segment_rows', 'varcharacter', 'rename', 'auto_increment', 'dayofweek', 'end', 'json_splice_string', 'str_to_date', 'trunc', 'excluding', 'order', 'hour_second', 'char_length', 'lines', 'identity', 'bootstrap', 'lock', '_resurrect', '_send_threads', 'auto', 'substring_index', 'json_array_push_double', 'vacuum', 'rtrim', '_sync_partitions', 'state', 'percentile_cont', 'standalone', '_snapshot', 'backward', 'group_concat', 'smallint', 'sqrt', 'type', 'status', 'family', 'event', 'plugins', 'sensitive', 'month', 'condition', 'hour', 'right_semi_join', 'within', 'voting', 'schemas', 'delayed', 'coercibility', 'approx_count_distinct_estimate', 'upper', 'retry', 'stdout', 'test', 'extractors', 'float4', 'content', 'schema', 'zone', 'json_set_string', 'inline', 'as', 'lpad', 'rowstore', 'bigint', 'modify', 'hard_cpu_limit_percentage', 'aggregators', '_wm_heartbeat', 'leave', 'sparse', 'batch_interval', 'tablespace', 'range', 'transform', 'split', 'leading', 'listen', 'monthname', 'escape', 'immutable', 'get_format', 'remote', 'change', 'geometry_x', '_failover', 'plancache', 'types', 'sql_calc_found_rows', 'pools', '_binary', 'float', 'leaf', 'analyze', 'connection', 'weekofyear', 'out', 'index', 'inner', 'keys', 'rebalance', 'int8', 'variables', 'reverse', 'replicating', 'float8', 'maxvalue', 'configuration', 'on', 'utc_time', 'approx_count_distinct_combine', 'reload', 'inject', 'low_priority', 'ln', 'current_date', 'killall', 'unlock', 'weekday', 'none', 'whitespace', 'hold', 'do', 'analyse', 'session', 'unsigned', 'byte', 'geography_intersects', 'int3', 'max_rows', 'current_role', 'isnull', 'table', 'second_microsecond', 'search', 'serial', 'delimiter', 'cross', 'temptable', 'enclosed', 'asymmetric', 'from_days', 'master', 'definer', 'disk', 'hosts', 'adddate', 'security_lists_intersect', 'namespace', 'partitions', 'geography_contains', 'lz4', 'unlogged', 'compile', 'object', 'resource_pool', 'sql_big_result', 'json_delete_key', 'case', 'lc_collate', 'encoding', 'charset', 'default', 'label', 'infile', 'sql_buffer_result', 'greatest', 'day_hour', 'from_base64', 'sql_no_cache', 'cascade', 'save', 'current_timestamp', 'pack_keys', 'soft_cpu_limit_percentage', 'document', 'inet_aton', 'ntile', 'date', 'curdate', 'aggregates', 'wait', 'call', '_check_can_connect', 'backup_history', 'cascaded', 'directory', 'passing', 'sha', 'true', 'match', 'batches', 'encrypted', 'autostats', 'day_second', 'engines', 'mbc', 'language', 'paired', 'catalog', 'extra_join', 'geography_distance', 'json_extract_double', 'also', '_management_thread', 'unlisten', 'stddev_samp', 'long', 'nulls', 'character_length', 'template', 'deferrable', 'workload', 'implicit', 'fill', 'cast', 'minvalue', 'shard', 'references', 'year', 'cost', 'limit', 'partition_id', 'vector_sub', 'cnf', 'grouping', 'large', 'pow', 'metadata', 'availability', 'scalar', 'always', 'ordered_serialize', 'parser', 'preceding', 'force_interpreter_mode', 'strict', 'to_seconds', 'text', 'unknown', 'asm', 'init', 'assertion', 'last_day', 'sequence', 'treat', 'max_retries_per_batch_partition', 'ucase', 'gzip', 'synchronize', 'reindex', 'geography_latitude', 'attach', 'fs', 'geometry_filter', 'async', 'partitioning', 'procedures', 'redundancy', 'elt', 'to_number', 'hdfs', 'called', 'full', 'trailing', 'optionally', 'record', 'current_time', 'duplicate', 'aes_encrypt', 'unencrypted', 'immediate', 'no_write_to_binlog', 'json_set_double', 'euclidean_distance', 'prepare', '_fsync', 'memsql_imitating_kafka', 'result', 'earliest', 'credentials', 'reassign', 'then', 'volatile', 'strip', 'null', 'cume_dist', 'timeout', 'invoker', 'out_of_order', 'spatial_check_index', 'indexes', '_disconnect', 'columnar', 'memory_percentage', 'yes', 'fetch', 'role', 'max_partitions_per_batch', 'refresh', 'regexp', '_sync_snapshot', 'generate', 'json_extract_string', 'sql_small_result', 'geometry_length', 'percent_rank', 'functions', 'release', 'attribute', 'substr', 'set', 'year_month', 'arrange', 'estimate', 'addtime', 'all', 'deallocate', '_load', 'pool', 'except', 'day', 'insert', 'fixed', 'time_to_sec', '_drop_profile', 'require', 'log2', 'savepoint', 'events', 'loop', 'undo', '_core', 'of', 'import', 'row_count', 'processlist', 'merge', 'arrangement', 'checksum', 'coalesce', 'right_straight_join', 'instr', 'date_format', 'geometry', 'global', 'curtime', 'natural', 'varbinary', '_unittest', '_reprovisioning', 'success', 'acos', 'execute', 'proxy', 'gc', 'least', 'including', 'without', 'external_host', 'overlay', 'dayname', 'not', 'client_found_rows', 'dayofyear', 'alter', 'specific', 'variance', 'approx_count_distinct', 'group', 'unhex', 'blob', 'force_compiled_mode', 'copy', 'batch', 'rollback', 'repeat', 'ceiling', 'round', 'password', 'auto_reprovision', 'concurrent', 'after', 'chain', 'rlike', 'foreground', 'sql_cache', 'avg', 'floor', 'interpreter_mode', 'query', 'tinyblob', 'local', 'optimizer', 'outer', 'kill', 'varying', 'quote', 'files', 'redundant', 'fields', 'sin', 'offline', 'datetime', 'concat_ws', 'profile', 'process', 'domain', 'two_phase', 'only', 'triggers', 'atan', 'delay_key_write', '_snapshots', 'array', 'start', 'row_number', 'columnstore', 'mediumint', 'autostats_histogram_mode', 'before', 'rpad', 'pipelines', 'reads', 'checkpoint', '_sync', 'memsql', 'relative', 'false', 'escaped', 'dec', '_gcx', 'median', 'aggregator_plan_hash', 'precision', 'defined', 'signed', 'reference', 'json', 'lag', 'assignment', 'location', 'avg_row_length', 'timestampadd', 'bit', 'sha2', 'select', 'skipped_batches', 'sharded', 'ifnull', 'close', 'unpivot', 'nullcols', 'lower', 'enable', 'trigger', 'window', 'fulltext', 'node', 'format', '_twopcid', 'min_rows', 'tan', 'exit', 'inout', 'middleint', 'next', 'time_format', 'access', 'semi_join', 'collect', 'inherit', 'interval', 'unbounded', 'outfile', 'decimal', 'localtimestamp', 'similar', 'octet_length', 'dense_rank', 'rows', 'named', 'running', 'force', 'int4', 'procedure', 'geography_point', 'granted', 'by', 'increment', 'instead', 'collation', 'replication', 'client', 'minute_microsecond', 'cot', 'row_format', 'int1', 'data', 'show', 'rely', 'column', 'extension', 'replica', 'longblob', '_init_profile', 'insensitive', 'and', 'log', 'unhold', 'inet_ntoa', 'row', 'election', 'azure', 'date_add', 'inet6_aton', 'for', 'replace', 'approx_count_distinct_accumulate', 'exclusive', 'cursor', 'prior', 'signal', 'cache', '_internal_dynamic_typecast', 'json_agg', 'server', 'load', 'disable', 'to_timestamp', 'constraint', 'while', 'national', 'describe', 'warnings', 'approx_geography_intersects', '_check_consistency', 'mediumblob', 'highlight', 'revoke', 'prepared', 'action', 'nchar', 'ref', 'echo', 'geographypoint', 'second', 'validator', 'periodic', 'right', '_bt', 'real', 'btree', 'geometrypoint', 'service_user', 'to_char', 'timezone', 'leakproof', 'sync', 'last_insert_id', 'norely', 'rand', 'identified', 'locate', 'database', 'aggregator', 'names', 'abs', 'overlaps', 'version', 'dot_product', 'initcap', 'json_extract_json', 'password_lock_time', 'repeatable', 'max', 'recursive', 'cube', 'failed_login_attempts', 'against', 's3', 'committed', '_sleep', 'persisted', 'bit_or', 'straight_join', 'use', '_ls', 'sum', 'has_temp_tables', 'loaddata_where', 'to_days', 'distinct', 'rg_pool', 'query_timeout', 'hex', 'user', 'preserve', 'usage', 'off', 'max_concurrency', 'tinytext', 'using', 'following', 'div', 'update', 'input', 'varchar', 'with', 'pipeline', 'convert', 'geometry_intersects', 'move', 'materialized', 'foreign', 'handler', 'separator', 'exp', 'schema_binding', 'class', 'cycle', 'day_microsecond', 'site', 'sysid', '_wake', 'lead', 'convert_tz', 'quarter', 'decode', 'model', 'binary', 'var_pop', 'until', 'radians', 'sharded_id', 'both', 'no', 'sql_mode', 'partial', 'series', 'open', 'last_value', 'geography_longitude', 'create', 'handle', 'purge', '_sync2', 'from', 'json_array_contains_string', 'sql', 'noparam', 'tables', 'mediumtext', 'dynamic', 'ignore', 'having', 'terminated', 'current_user', 'avro', 'void', 'header', 'scroll', 'unicode', 'users', 'plans', 'bin', 'latest', 'memsql_serialize', 'add', 'months_between', 'validate', 'over', 'grant', 'where', 'subdate', 'minute', 'differential'}
@unsupported_args('on_condition')
def
jsonvalue_sql(self, expression: sqlglot.expressions.JSONValue) -> str:
1737 @unsupported_args("on_condition") 1738 def jsonvalue_sql(self, expression: exp.JSONValue) -> str: 1739 res: exp.Expression = exp.JSONExtractScalar( 1740 this=expression.this, 1741 expression=expression.args.get("path"), 1742 json_type="STRING", 1743 ) 1744 1745 returning = expression.args.get("returning") 1746 if returning is not None: 1747 res = exp.Cast(this=res, to=returning) 1748 1749 return self.sql(res)
1755 def jsonarraycontains_sql(self, expression: exp.JSONArrayContains) -> str: 1756 json_type = expression.text("json_type").upper() 1757 1758 if json_type: 1759 return self.func( 1760 f"JSON_ARRAY_CONTAINS_{json_type}", expression.expression, expression.this 1761 ) 1762 1763 return self.func( 1764 "JSON_ARRAY_CONTAINS_JSON", 1765 expression.expression, 1766 self.func("TO_JSON", expression.this), 1767 )
@unsupported_args('kind', 'values')
def
datatype_sql(self, expression: sqlglot.expressions.DataType) -> str:
1769 @unsupported_args("kind", "values") 1770 def datatype_sql(self, expression: exp.DataType) -> str: 1771 if expression.args.get("nested") and not expression.is_type(exp.DataType.Type.STRUCT): 1772 self.unsupported( 1773 f"Argument 'nested' is not supported for representation of '{expression.this.value}' in SingleStore" 1774 ) 1775 1776 if expression.is_type(exp.DataType.Type.VARBINARY) and not expression.expressions: 1777 # `VARBINARY` must always have a size - if it doesn't, we always generate `BLOB` 1778 return "BLOB" 1779 if expression.is_type( 1780 exp.DataType.Type.DECIMAL32, 1781 exp.DataType.Type.DECIMAL64, 1782 exp.DataType.Type.DECIMAL128, 1783 exp.DataType.Type.DECIMAL256, 1784 ): 1785 scale = self.expressions(expression, flat=True) 1786 1787 if expression.is_type(exp.DataType.Type.DECIMAL32): 1788 precision = "9" 1789 elif expression.is_type(exp.DataType.Type.DECIMAL64): 1790 precision = "18" 1791 elif expression.is_type(exp.DataType.Type.DECIMAL128): 1792 precision = "38" 1793 else: 1794 # 65 is a maximum precision supported in SingleStore 1795 precision = "65" 1796 if scale is not None: 1797 return f"DECIMAL({precision}, {scale[0]})" 1798 else: 1799 return f"DECIMAL({precision})" 1800 if expression.is_type(exp.DataType.Type.VECTOR): 1801 expressions = expression.expressions 1802 if len(expressions) == 2: 1803 type_name = self.sql(expressions[0]) 1804 if type_name in self.dialect.INVERSE_VECTOR_TYPE_ALIASES: 1805 type_name = self.dialect.INVERSE_VECTOR_TYPE_ALIASES[type_name] 1806 1807 return f"VECTOR({self.sql(expressions[1])}, {type_name})" 1808 1809 return super().datatype_sql(expression)
1816 def currentdate_sql(self, expression: exp.CurrentDate) -> str: 1817 timezone = expression.this 1818 if timezone: 1819 if isinstance(timezone, exp.Literal) and timezone.name.lower() == "utc": 1820 return self.func("UTC_DATE") 1821 self.unsupported("CurrentDate with timezone is not supported in SingleStore") 1822 1823 return self.func("CURRENT_DATE")
1825 def currenttime_sql(self, expression: exp.CurrentTime) -> str: 1826 arg = expression.this 1827 if arg: 1828 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1829 return self.func("UTC_TIME") 1830 if isinstance(arg, exp.Literal) and arg.is_number: 1831 return self.func("CURRENT_TIME", arg) 1832 self.unsupported("CurrentTime with timezone is not supported in SingleStore") 1833 1834 return self.func("CURRENT_TIME")
1836 def currenttimestamp_sql(self, expression: exp.CurrentTimestamp) -> str: 1837 arg = expression.this 1838 if arg: 1839 if isinstance(arg, exp.Literal) and arg.name.lower() == "utc": 1840 return self.func("UTC_TIMESTAMP") 1841 if isinstance(arg, exp.Literal) and arg.is_number: 1842 return self.func("CURRENT_TIMESTAMP", arg) 1843 self.unsupported("CurrentTimestamp with timezone is not supported in SingleStore") 1844 1845 return self.func("CURRENT_TIMESTAMP")
1847 def standardhash_sql(self, expression: exp.StandardHash) -> str: 1848 hash_function = expression.expression 1849 if hash_function is None: 1850 return self.func("SHA", expression.this) 1851 if isinstance(hash_function, exp.Literal): 1852 if hash_function.name.lower() == "sha": 1853 return self.func("SHA", expression.this) 1854 if hash_function.name.lower() == "md5": 1855 return self.func("MD5", expression.this) 1856 1857 self.unsupported( 1858 f"{hash_function.this} hash method is not supported in SingleStore" 1859 ) 1860 return self.func("SHA", expression.this) 1861 1862 self.unsupported("STANDARD_HASH function is not supported in SingleStore") 1863 return self.func("SHA", expression.this)
@unsupported_args('is_database', 'exists', 'cluster', 'identity', 'option', 'partition')
def
truncatetable_sql(self, expression: sqlglot.expressions.TruncateTable) -> str:
1865 @unsupported_args("is_database", "exists", "cluster", "identity", "option", "partition") 1866 def truncatetable_sql(self, expression: exp.TruncateTable) -> str: 1867 statements = [] 1868 for expression in expression.expressions: 1869 statements.append(f"TRUNCATE {self.sql(expression)}") 1870 1871 return "; ".join(statements)
@unsupported_args('exists')
def
renamecolumn_sql(self, expression: sqlglot.expressions.RenameColumn) -> str:
@unsupported_args('drop', 'comment', 'allow_null', 'visible', 'using')
def
altercolumn_sql(self, expression: sqlglot.expressions.AlterColumn) -> str:
1879 @unsupported_args("drop", "comment", "allow_null", "visible", "using") 1880 def altercolumn_sql(self, expression: exp.AlterColumn) -> str: 1881 alter = super().altercolumn_sql(expression) 1882 1883 collate = self.sql(expression, "collate") 1884 collate = f" COLLATE {collate}" if collate else "" 1885 return f"{alter}{collate}"
def
computedcolumnconstraint_sql(self, expression: sqlglot.expressions.ComputedColumnConstraint) -> str:
1887 def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint) -> str: 1888 this = self.sql(expression, "this") 1889 not_null = " NOT NULL" if expression.args.get("not_null") else "" 1890 type = self.sql(expression, "data_type") or "AUTO" 1891 return f"AS {this} PERSISTED {type}{not_null}"
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
- SET_ASSIGNMENT_REQUIRES_VARIABLE_KEYWORD
- TIME_PART_SINGULARS
- TOKEN_MAPPING
- PARAMETER_TOKEN
- NAMED_PLACEHOLDER_TOKEN
- EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
- WITH_SEPARATED_COMMENTS
- EXCLUDE_COMMENTS
- UNWRAPPED_INTERVAL_VALUES
- PARAMETERIZABLE_TEXT_TYPES
- EXPRESSIONS_WITHOUT_NESTED_CTES
- RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS
- SAFE_JSON_PATH_KEY_RE
- SENTINEL_LINE_BREAK
- pretty
- identify
- normalize
- pad
- unsupported_level
- max_unsupported
- leading_comma
- max_text_width
- comments
- dialect
- normalize_functions
- unsupported_messages
- generate
- preprocess
- unsupported
- sep
- seg
- sanitize_comment
- maybe_comment
- wrap
- no_identify
- normalize_func
- indent
- sql
- uncache_sql
- cache_sql
- characterset_sql
- column_parts
- column_sql
- pseudocolumn_sql
- columnposition_sql
- columndef_sql
- columnconstraint_sql
- autoincrementcolumnconstraint_sql
- compresscolumnconstraint_sql
- generatedasidentitycolumnconstraint_sql
- generatedasrowcolumnconstraint_sql
- periodforsystemtimeconstraint_sql
- notnullcolumnconstraint_sql
- primarykeycolumnconstraint_sql
- uniquecolumnconstraint_sql
- inoutcolumnconstraint_sql
- createable_sql
- create_sql
- sequenceproperties_sql
- clone_sql
- describe_sql
- heredoc_sql
- prepend_ctes
- with_sql
- cte_sql
- tablealias_sql
- bitstring_sql
- hexstring_sql
- bytestring_sql
- unicodestring_sql
- rawstring_sql
- datatypeparam_sql
- directory_sql
- delete_sql
- drop_sql
- set_operation
- set_operations
- fetch_sql
- limitoptions_sql
- filter_sql
- hint_sql
- indexparameters_sql
- index_sql
- identifier_sql
- hex_sql
- lowerhex_sql
- inputoutputformat_sql
- national_sql
- 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
- booland_sql
- boolor_sql
- order_sql
- withfill_sql
- cluster_sql
- distribute_sql
- sort_sql
- ordered_sql
- matchrecognizemeasure_sql
- matchrecognize_sql
- query_modifiers
- options_modifier
- for_modifiers
- queryoption_sql
- offset_limit_modifiers
- after_limit_modifiers
- select_sql
- schema_sql
- schema_columns_sql
- star_sql
- parameter_sql
- sessionparameter_sql
- placeholder_sql
- subquery_sql
- qualify_sql
- unnest_sql
- prewhere_sql
- where_sql
- window_sql
- partition_by_sql
- windowspec_sql
- withingroup_sql
- between_sql
- bracket_offset_expressions
- bracket_sql
- any_sql
- exists_sql
- case_sql
- constraint_sql
- nextvaluefor_sql
- trim_sql
- convert_concat_args
- concat_sql
- concatws_sql
- check_sql
- foreignkey_sql
- primarykey_sql
- if_sql
- matchagainst_sql
- jsonkeyvalue_sql
- jsonpath_sql
- json_path_part
- formatjson_sql
- formatphrase_sql
- jsonobject_sql
- jsonobjectagg_sql
- jsonarray_sql
- jsonarrayagg_sql
- jsoncolumndef_sql
- jsonschema_sql
- jsontable_sql
- openjsoncolumndef_sql
- openjson_sql
- in_sql
- in_unnest_op
- interval_sql
- return_sql
- reference_sql
- anonymous_sql
- paren_sql
- neg_sql
- not_sql
- alias_sql
- pivotalias_sql
- aliases_sql
- atindex_sql
- fromtimezone_sql
- add_sql
- and_sql
- or_sql
- xor_sql
- connector_sql
- bitwiseand_sql
- bitwiseleftshift_sql
- bitwisenot_sql
- bitwiseor_sql
- bitwiserightshift_sql
- bitwisexor_sql
- strtotime_sql
- command_sql
- comment_sql
- mergetreettlaction_sql
- mergetreettl_sql
- transaction_sql
- commit_sql
- rollback_sql
- alterindex_sql
- alterdiststyle_sql
- altersortkey_sql
- alterrename_sql
- alterset_sql
- alter_sql
- altersession_sql
- add_column_sql
- droppartition_sql
- addconstraint_sql
- addpartition_sql
- distinct_sql
- respectnulls_sql
- havingmax_sql
- intdiv_sql
- div_sql
- safedivide_sql
- overlaps_sql
- distance_sql
- dot_sql
- eq_sql
- propertyeq_sql
- escape_sql
- glob_sql
- gt_sql
- gte_sql
- is_sql
- like_sql
- ilike_sql
- match_sql
- similarto_sql
- lt_sql
- lte_sql
- mod_sql
- mul_sql
- neq_sql
- nullsafeeq_sql
- nullsafeneq_sql
- sub_sql
- trycast_sql
- jsoncast_sql
- try_sql
- log_sql
- use_sql
- binary
- ceil_floor
- function_fallback_sql
- func
- format_args
- too_wide
- format_time
- expressions
- op_expressions
- naked_property
- tag_sql
- token_sql
- userdefinedfunction_sql
- joinhint_sql
- kwarg_sql
- when_sql
- whens_sql
- merge_sql
- tochar_sql
- tonumber_sql
- dictproperty_sql
- dictrange_sql
- dictsubproperty_sql
- duplicatekeyproperty_sql
- 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
- generateembedding_sql
- mltranslate_sql
- mlforecast_sql
- featuresattime_sql
- vectorsearch_sql
- forin_sql
- refresh_sql
- toarray_sql
- tsordstotime_sql
- tsordstotimestamp_sql
- tsordstodatetime_sql
- tsordstodate_sql
- unixdate_sql
- lastday_sql
- dateadd_sql
- arrayany_sql
- struct_sql
- partitionrange_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
- slice_sql
- apply_sql
- grant_sql
- revoke_sql
- grantprivilege_sql
- grantprincipal_sql
- columns_sql
- overlay_sql
- todouble_sql
- string_sql
- median_sql
- overflowtruncatebehavior_sql
- unixseconds_sql
- arraysize_sql
- attach_sql
- detach_sql
- attachoption_sql
- watermarkcolumnconstraint_sql
- encodeproperty_sql
- includeproperty_sql
- xmlelement_sql
- xmlkeyvalueoption_sql
- 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
- install_sql
- get_put_sql
- translatecharacters_sql
- decodecase_sql
- semanticview_sql
- getextract_sql
- datefromunixdate_sql
- space_sql
- buildproperty_sql
- refreshtriggerproperty_sql
- modelattribute_sql
- directorystage_sql
- uuid_sql
- initcap_sql
- localtime_sql
- localtimestamp_sql
- weekstart_sql
- chr_sql
- sqlglot.dialects.mysql.MySQL.Generator
- INTERVAL_ALLOWS_PLURAL_FORM
- LOCKING_READS_SUPPORTED
- 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
- UPDATE_STATEMENT_SUPPORTS_FROM
- UNSIGNED_TYPE_MAPPING
- TIMESTAMP_TYPE_MAPPING
- PROPERTIES_LOCATION
- LIMIT_FETCH
- LIMIT_ONLY_LITERALS
- CHAR_CAST_MAPPING
- SIGNED_CAST_MAPPING
- CAST_MAPPING
- TIMESTAMP_FUNC_TYPES
- array_sql
- arraycontainsall_sql
- dpipe_sql
- extract_sql
- cast_sql
- show_sql
- timestamptrunc_sql
- converttimezone_sql
- attimezone_sql
- isascii_sql
- ignorenulls_sql
- currentschema_sql