sqlglot.dialects.exasol
1from __future__ import annotations 2 3import typing as t 4 5from sqlglot import exp, generator, parser, tokens, transforms 6from sqlglot.dialects.dialect import ( 7 DATE_ADD_OR_SUB, 8 Dialect, 9 NormalizationStrategy, 10 binary_from_function, 11 build_date_delta, 12 build_formatted_time, 13 build_timetostr_or_tochar, 14 build_trunc, 15 groupconcat_sql, 16 no_last_day_sql, 17 rename_func, 18 strposition_sql, 19 timestrtotime_sql, 20 timestamptrunc_sql, 21) 22from sqlglot.generator import unsupported_args 23from sqlglot.helper import seq_get 24from sqlglot.tokens import TokenType 25from sqlglot.optimizer.scope import build_scope 26 27 28def _sha2_sql(self: Exasol.Generator, expression: exp.SHA2) -> str: 29 length = expression.text("length") 30 func_name = "HASH_SHA256" if length == "256" else "HASH_SHA512" 31 return self.func(func_name, expression.this) 32 33 34def _date_diff_sql(self: Exasol.Generator, expression: exp.DateDiff | exp.TsOrDsDiff) -> str: 35 unit = expression.text("unit").upper() or "DAY" 36 37 if unit not in DATE_UNITS: 38 self.unsupported(f"'{unit}' is not supported in Exasol.") 39 return self.function_fallback_sql(expression) 40 41 return self.func(f"{unit}S_BETWEEN", expression.this, expression.expression) 42 43 44# https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/zeroifnull.htm 45def _build_zeroifnull(args: t.List) -> exp.If: 46 cond = exp.Is(this=seq_get(args, 0), expression=exp.Null()) 47 return exp.If(this=cond, true=exp.Literal.number(0), false=seq_get(args, 0)) 48 49 50# https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/nullifzero.htm 51def _build_nullifzero(args: t.List) -> exp.If: 52 cond = exp.EQ(this=seq_get(args, 0), expression=exp.Literal.number(0)) 53 return exp.If(this=cond, true=exp.Null(), false=seq_get(args, 0)) 54 55 56# https://docs.exasol.com/db/latest/sql/select.htm#:~:text=If%20you%20have,local.x%3E10 57def _add_local_prefix_for_aliases(expression: exp.Expression) -> exp.Expression: 58 if isinstance(expression, exp.Select): 59 aliases: dict[str, bool] = { 60 alias.name: bool(alias.args.get("quoted")) 61 for sel in expression.selects 62 if isinstance(sel, exp.Alias) and (alias := sel.args.get("alias")) 63 } 64 65 table = expression.find(exp.Table) 66 table_ident = table.this if table else None 67 68 if ( 69 table_ident 70 and table_ident.name.upper() == "LOCAL" 71 and not bool(table_ident.args.get("quoted")) 72 ): 73 table_ident.replace(exp.to_identifier(table_ident.name.upper(), quoted=True)) 74 75 def prefix_local(node, visible_aliases: dict[str, bool]) -> exp.Expression: 76 if isinstance(node, exp.Column) and not node.table: 77 if node.name in visible_aliases: 78 return exp.Column( 79 this=exp.to_identifier(node.name, quoted=visible_aliases[node.name]), 80 table=exp.to_identifier("LOCAL", quoted=False), 81 ) 82 return node 83 84 for key in ("where", "group", "having"): 85 if arg := expression.args.get(key): 86 expression.set(key, arg.transform(lambda node: prefix_local(node, aliases))) 87 88 seen_aliases: dict[str, bool] = {} 89 new_selects: list[exp.Expression] = [] 90 for sel in expression.selects: 91 if isinstance(sel, exp.Alias): 92 inner = sel.this.transform(lambda node: prefix_local(node, seen_aliases)) 93 sel.set("this", inner) 94 95 alias_node = sel.args.get("alias") 96 97 seen_aliases[sel.alias] = bool(alias_node and getattr(alias_node, "quoted", False)) 98 new_selects.append(sel) 99 else: 100 new_selects.append(sel.transform(lambda node: prefix_local(node, seen_aliases))) 101 expression.set("expressions", new_selects) 102 103 return expression 104 105 106def _trunc_sql(self: Exasol.Generator, kind: str, expression: exp.DateTrunc) -> str: 107 unit = expression.text("unit") 108 node = expression.this.this if isinstance(expression.this, exp.Cast) else expression.this 109 expr_sql = self.sql(node) 110 if isinstance(node, exp.Literal) and node.is_string: 111 expr_sql = ( 112 f"{kind} '{node.this.replace('T', ' ')}'" 113 if kind == "TIMESTAMP" 114 else f"DATE '{node.this}'" 115 ) 116 return f"DATE_TRUNC('{unit}', {expr_sql})" 117 118 119def _date_trunc_sql(self: Exasol.Generator, expression: exp.DateTrunc) -> str: 120 return _trunc_sql(self, "DATE", expression) 121 122 123def _timestamp_trunc_sql(self: Exasol.Generator, expression: exp.DateTrunc) -> str: 124 return _trunc_sql(self, "TIMESTAMP", expression) 125 126 127def is_case_insensitive(node: exp.Expression) -> bool: 128 return isinstance(node, exp.Collate) and node.text("expression").upper() == "UTF8_LCASE" 129 130 131def _substring_index_sql(self: Exasol.Generator, expression: exp.SubstringIndex) -> str: 132 this = expression.this 133 delimiter = expression.args["delimiter"] 134 count_node = expression.args["count"] 135 count_sql = self.sql(expression, "count") 136 num = count_node.to_py() if count_node.is_number else 0 137 138 haystack_sql = self.sql(this) 139 if num == 0: 140 return self.func("SUBSTR", haystack_sql, "1", "0") 141 142 from_right = num < 0 143 direction = "-1" if from_right else "1" 144 occur = self.func("ABS", count_sql) if from_right else count_sql 145 146 delimiter_sql = self.sql(delimiter) 147 148 position = self.func( 149 "INSTR", 150 self.func("LOWER", haystack_sql) if is_case_insensitive(this) else haystack_sql, 151 self.func("LOWER", delimiter_sql) if is_case_insensitive(delimiter) else delimiter_sql, 152 direction, 153 occur, 154 ) 155 nullable_pos = self.func("NULLIF", position, "0") 156 157 if from_right: 158 start = self.func( 159 "NVL", f"{nullable_pos} + {self.func('LENGTH', delimiter_sql)}", direction 160 ) 161 return self.func("SUBSTR", haystack_sql, start) 162 163 length = self.func("NVL", f"{nullable_pos} - 1", self.func("LENGTH", haystack_sql)) 164 return self.func("SUBSTR", haystack_sql, direction, length) 165 166 167# https://docs.exasol.com/db/latest/sql/select.htm#:~:text=The%20select_list%20defines%20the%20columns%20of%20the%20result%20table.%20If%20*%20is%20used%2C%20all%20columns%20are%20listed.%20You%20can%20use%20an%20expression%20like%20t.*%20to%20list%20all%20columns%20of%20the%20table%20t%2C%20the%20view%20t%2C%20or%20the%20object%20with%20the%20table%20alias%20t. 168def _qualify_unscoped_star(expression: exp.Expression) -> exp.Expression: 169 """ 170 Exasol doesn't support a bare * alongside other select items, so we rewrite it 171 Rewrite: SELECT *, <other> FROM <Table> 172 Into: SELECT T.*, <other> FROM <Table> AS T 173 """ 174 175 if not isinstance(expression, exp.Select): 176 return expression 177 178 select_expressions = expression.expressions or [] 179 180 def is_bare_star(expr: exp.Expression) -> bool: 181 return isinstance(expr, exp.Star) and expr.this is None 182 183 has_other_expression = False 184 bare_star_expr: exp.Expression | None = None 185 for expr in select_expressions: 186 has_bare_star = is_bare_star(expr) 187 if has_bare_star and bare_star_expr is None: 188 bare_star_expr = expr 189 elif not has_bare_star: 190 has_other_expression = True 191 if bare_star_expr and has_other_expression: 192 break 193 194 if not (bare_star_expr and has_other_expression): 195 return expression 196 197 scope = build_scope(expression) 198 199 if not scope or not scope.selected_sources: 200 return expression 201 202 table_identifiers: list[exp.Identifier] = [] 203 204 for source_name, (source_expr, _) in scope.selected_sources.items(): 205 ident = ( 206 source_expr.this.copy() 207 if isinstance(source_expr, exp.Table) and isinstance(source_expr.this, exp.Identifier) 208 else exp.to_identifier(source_name) 209 ) 210 table_identifiers.append(ident) 211 212 qualified_star_columns = [ 213 exp.Column(this=bare_star_expr.copy(), table=ident) for ident in table_identifiers 214 ] 215 216 new_select_expressions: list[exp.Expression] = [] 217 218 for select_expr in select_expressions: 219 new_select_expressions.extend(qualified_star_columns) if is_bare_star( 220 select_expr 221 ) else new_select_expressions.append(select_expr) 222 223 expression.set("expressions", new_select_expressions) 224 return expression 225 226 227def _add_date_sql(self: Exasol.Generator, expression: DATE_ADD_OR_SUB) -> str: 228 interval = expression.expression if isinstance(expression.expression, exp.Interval) else None 229 230 unit = ( 231 (interval.text("unit") or "DAY").upper() 232 if interval is not None 233 else (expression.text("unit") or "DAY").upper() 234 ) 235 236 if unit not in DATE_UNITS: 237 self.unsupported(f"'{unit}' is not supported in Exasol.") 238 return self.function_fallback_sql(expression) 239 240 offset_expr: exp.Expression = expression.expression 241 if interval is not None: 242 offset_expr = interval.this 243 244 if isinstance(expression, exp.DateSub): 245 offset_expr = exp.Neg(this=offset_expr) 246 247 return self.func(f"ADD_{unit}S", expression.this, offset_expr) 248 249 250DATE_UNITS = {"DAY", "WEEK", "MONTH", "YEAR", "HOUR", "MINUTE", "SECOND"} 251 252 253class Exasol(Dialect): 254 # https://docs.exasol.com/db/latest/sql_references/basiclanguageelements.htm#SQLidentifier 255 NORMALIZATION_STRATEGY = NormalizationStrategy.UPPERCASE 256 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypesoverview.htm 257 SUPPORTS_USER_DEFINED_TYPES = False 258 # https://docs.exasol.com/db/latest/sql/select.htm 259 SUPPORTS_SEMI_ANTI_JOIN = False 260 SUPPORTS_COLUMN_JOIN_MARKS = True 261 NULL_ORDERING = "nulls_are_last" 262 # https://docs.exasol.com/db/latest/sql_references/literals.htm#StringLiterals 263 CONCAT_COALESCE = True 264 265 TIME_MAPPING = { 266 "yyyy": "%Y", 267 "YYYY": "%Y", 268 "yy": "%y", 269 "YY": "%y", 270 "mm": "%m", 271 "MM": "%m", 272 "MONTH": "%B", 273 "MON": "%b", 274 "dd": "%d", 275 "DD": "%d", 276 "DAY": "%A", 277 "DY": "%a", 278 "H12": "%I", 279 "H24": "%H", 280 "HH": "%H", 281 "ID": "%u", 282 "vW": "%V", 283 "IW": "%V", 284 "vYYY": "%G", 285 "IYYY": "%G", 286 "MI": "%M", 287 "SS": "%S", 288 "uW": "%W", 289 "UW": "%U", 290 "Z": "%z", 291 } 292 293 class Tokenizer(tokens.Tokenizer): 294 IDENTIFIERS = ['"', ("[", "]")] 295 KEYWORDS = { 296 **tokens.Tokenizer.KEYWORDS, 297 "USER": TokenType.CURRENT_USER, 298 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/if.htm 299 "ENDIF": TokenType.END, 300 "LONG VARCHAR": TokenType.TEXT, 301 "SEPARATOR": TokenType.SEPARATOR, 302 "SYSTIMESTAMP": TokenType.SYSTIMESTAMP, 303 } 304 KEYWORDS.pop("DIV") 305 306 class Parser(parser.Parser): 307 FUNCTIONS = { 308 **parser.Parser.FUNCTIONS, 309 **{ 310 f"ADD_{unit}S": build_date_delta(exp.DateAdd, default_unit=unit) 311 for unit in DATE_UNITS 312 }, 313 **{ 314 f"{unit}S_BETWEEN": build_date_delta(exp.DateDiff, default_unit=unit) 315 for unit in DATE_UNITS 316 }, 317 "APPROXIMATE_COUNT_DISTINCT": exp.ApproxDistinct.from_arg_list, 318 "BIT_AND": binary_from_function(exp.BitwiseAnd), 319 "BIT_OR": binary_from_function(exp.BitwiseOr), 320 "BIT_XOR": binary_from_function(exp.BitwiseXor), 321 "BIT_NOT": lambda args: exp.BitwiseNot(this=seq_get(args, 0)), 322 "BIT_LSHIFT": binary_from_function(exp.BitwiseLeftShift), 323 "BIT_RSHIFT": binary_from_function(exp.BitwiseRightShift), 324 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/convert_tz.htm 325 "CONVERT_TZ": lambda args: exp.ConvertTimezone( 326 source_tz=seq_get(args, 1), 327 target_tz=seq_get(args, 2), 328 timestamp=seq_get(args, 0), 329 options=seq_get(args, 3), 330 ), 331 "CURDATE": exp.CurrentDate.from_arg_list, 332 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/date_trunc.htm#DATE_TRUNC 333 "DATE_TRUNC": lambda args: exp.TimestampTrunc( 334 this=seq_get(args, 1), unit=seq_get(args, 0) 335 ), 336 "DIV": binary_from_function(exp.IntDiv), 337 "EVERY": lambda args: exp.All(this=seq_get(args, 0)), 338 "EDIT_DISTANCE": exp.Levenshtein.from_arg_list, 339 "HASH_SHA": exp.SHA.from_arg_list, 340 "HASH_SHA1": exp.SHA.from_arg_list, 341 "HASH_MD5": exp.MD5.from_arg_list, 342 "HASHTYPE_MD5": exp.MD5Digest.from_arg_list, 343 "HASH_SHA256": lambda args: exp.SHA2( 344 this=seq_get(args, 0), length=exp.Literal.number(256) 345 ), 346 "HASH_SHA512": lambda args: exp.SHA2( 347 this=seq_get(args, 0), length=exp.Literal.number(512) 348 ), 349 "NOW": exp.CurrentTimestamp.from_arg_list, 350 "NULLIFZERO": _build_nullifzero, 351 "REGEXP_SUBSTR": exp.RegexpExtract.from_arg_list, 352 "REGEXP_REPLACE": lambda args: exp.RegexpReplace( 353 this=seq_get(args, 0), 354 expression=seq_get(args, 1), 355 replacement=seq_get(args, 2), 356 position=seq_get(args, 3), 357 occurrence=seq_get(args, 4), 358 ), 359 "TRUNC": build_trunc, 360 "TRUNCATE": build_trunc, 361 "TO_CHAR": build_timetostr_or_tochar, 362 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "exasol"), 363 "USER": exp.CurrentUser.from_arg_list, 364 "VAR_POP": exp.VariancePop.from_arg_list, 365 "ZEROIFNULL": _build_zeroifnull, 366 } 367 CONSTRAINT_PARSERS = { 368 **parser.Parser.CONSTRAINT_PARSERS, 369 "COMMENT": lambda self: self.expression( 370 exp.CommentColumnConstraint, 371 this=self._match(TokenType.IS) and self._parse_string(), 372 ), 373 } 374 375 FUNC_TOKENS = { 376 *parser.Parser.FUNC_TOKENS, 377 TokenType.SYSTIMESTAMP, 378 } 379 380 NO_PAREN_FUNCTIONS = { 381 **parser.Parser.NO_PAREN_FUNCTIONS, 382 TokenType.SYSTIMESTAMP: exp.Systimestamp, 383 TokenType.CURRENT_SCHEMA: exp.CurrentSchema, 384 } 385 386 FUNCTION_PARSERS = { 387 **parser.Parser.FUNCTION_PARSERS, 388 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/listagg.htm 389 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/group_concat.htm 390 **dict.fromkeys(("GROUP_CONCAT", "LISTAGG"), lambda self: self._parse_group_concat()), 391 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/json_value.htm 392 "JSON_VALUE": lambda self: self._parse_json_value(), 393 } 394 395 def _parse_column(self) -> t.Optional[exp.Expression]: 396 column = super()._parse_column() 397 if not isinstance(column, exp.Column): 398 return column 399 table_ident = column.args.get("table") 400 if ( 401 isinstance(table_ident, exp.Identifier) 402 and table_ident.name.upper() == "LOCAL" 403 and not bool(table_ident.args.get("quoted")) 404 ): 405 column.set("table", None) 406 return column 407 408 ODBC_DATETIME_LITERALS = { 409 "d": exp.Date, 410 "ts": exp.Timestamp, 411 } 412 413 class Generator(generator.Generator): 414 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypedetails.htm#StringDataType 415 STRING_TYPE_MAPPING = { 416 exp.DataType.Type.BLOB: "VARCHAR", 417 exp.DataType.Type.LONGBLOB: "VARCHAR", 418 exp.DataType.Type.LONGTEXT: "VARCHAR", 419 exp.DataType.Type.MEDIUMBLOB: "VARCHAR", 420 exp.DataType.Type.MEDIUMTEXT: "VARCHAR", 421 exp.DataType.Type.TINYBLOB: "VARCHAR", 422 exp.DataType.Type.TINYTEXT: "VARCHAR", 423 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypealiases.htm 424 exp.DataType.Type.TEXT: "LONG VARCHAR", 425 exp.DataType.Type.VARBINARY: "VARCHAR", 426 } 427 428 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypealiases.htm 429 TYPE_MAPPING = { 430 **generator.Generator.TYPE_MAPPING, 431 **STRING_TYPE_MAPPING, 432 exp.DataType.Type.TINYINT: "SMALLINT", 433 exp.DataType.Type.MEDIUMINT: "INT", 434 exp.DataType.Type.DECIMAL32: "DECIMAL", 435 exp.DataType.Type.DECIMAL64: "DECIMAL", 436 exp.DataType.Type.DECIMAL128: "DECIMAL", 437 exp.DataType.Type.DECIMAL256: "DECIMAL", 438 exp.DataType.Type.DATETIME: "TIMESTAMP", 439 exp.DataType.Type.TIMESTAMPTZ: "TIMESTAMP", 440 exp.DataType.Type.TIMESTAMPLTZ: "TIMESTAMP", 441 exp.DataType.Type.TIMESTAMPNTZ: "TIMESTAMP", 442 } 443 444 def datatype_sql(self, expression: exp.DataType) -> str: 445 # Exasol supports a fixed default precision of 3 for TIMESTAMP WITH LOCAL TIME ZONE 446 # and does not allow specifying a different custom precision 447 if expression.is_type(exp.DataType.Type.TIMESTAMPLTZ): 448 return "TIMESTAMP WITH LOCAL TIME ZONE" 449 450 return super().datatype_sql(expression) 451 452 TRANSFORMS = { 453 **generator.Generator.TRANSFORMS, 454 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/every.htm 455 exp.All: rename_func("EVERY"), 456 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_and.htm 457 exp.BitwiseAnd: rename_func("BIT_AND"), 458 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_or.htm 459 exp.BitwiseOr: rename_func("BIT_OR"), 460 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_not.htm 461 exp.BitwiseNot: rename_func("BIT_NOT"), 462 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_lshift.htm 463 exp.BitwiseLeftShift: rename_func("BIT_LSHIFT"), 464 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_rshift.htm 465 exp.BitwiseRightShift: rename_func("BIT_RSHIFT"), 466 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_xor.htm 467 exp.BitwiseXor: rename_func("BIT_XOR"), 468 exp.CurrentSchema: lambda *_: "CURRENT_SCHEMA", 469 exp.DateDiff: _date_diff_sql, 470 exp.DateAdd: _add_date_sql, 471 exp.TsOrDsAdd: _add_date_sql, 472 exp.DateSub: _add_date_sql, 473 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/div.htm#DIV 474 exp.IntDiv: rename_func("DIV"), 475 exp.TsOrDsDiff: _date_diff_sql, 476 exp.DateTrunc: _date_trunc_sql, 477 exp.DayOfWeek: lambda self, e: f"CAST(TO_CHAR({self.sql(e, 'this')}, 'D') AS INTEGER)", 478 exp.DatetimeTrunc: timestamptrunc_sql(), 479 exp.GroupConcat: lambda self, e: groupconcat_sql( 480 self, e, func_name="LISTAGG", within_group=True 481 ), 482 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/edit_distance.htm#EDIT_DISTANCE 483 exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")( 484 rename_func("EDIT_DISTANCE") 485 ), 486 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/mod.htm 487 exp.Mod: rename_func("MOD"), 488 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/rank.htm 489 exp.Rank: unsupported_args("expressions")(lambda *_: "RANK()"), 490 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/dense_rank.htm 491 exp.DenseRank: unsupported_args("expressions")(lambda *_: "DENSE_RANK()"), 492 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/regexp_substr.htm 493 exp.RegexpExtract: unsupported_args("parameters", "group")( 494 rename_func("REGEXP_SUBSTR") 495 ), 496 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/regexp_replace.htm 497 exp.RegexpReplace: unsupported_args("modifiers")(rename_func("REGEXP_REPLACE")), 498 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/var_pop.htm 499 exp.VariancePop: rename_func("VAR_POP"), 500 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/approximate_count_distinct.htm 501 exp.ApproxDistinct: unsupported_args("accuracy")( 502 rename_func("APPROXIMATE_COUNT_DISTINCT") 503 ), 504 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_char%20(datetime).htm 505 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 506 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_date.htm 507 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 508 exp.TimeToStr: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 509 exp.TimeStrToTime: timestrtotime_sql, 510 exp.TimestampTrunc: _timestamp_trunc_sql, 511 exp.StrToTime: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 512 exp.CurrentUser: lambda *_: "CURRENT_USER", 513 exp.AtTimeZone: lambda self, e: self.func( 514 "CONVERT_TZ", 515 e.this, 516 "'UTC'", 517 e.args.get("zone"), 518 ), 519 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/instr.htm 520 exp.StrPosition: lambda self, e: ( 521 strposition_sql( 522 self, e, func_name="INSTR", supports_position=True, supports_occurrence=True 523 ) 524 ), 525 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha%5B1%5D.htm#HASH_SHA%5B1%5D 526 exp.SHA: rename_func("HASH_SHA"), 527 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha256.htm 528 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha512.htm 529 exp.SHA2: _sha2_sql, 530 exp.MD5: rename_func("HASH_MD5"), 531 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hashtype_md5.htm 532 exp.MD5Digest: rename_func("HASHTYPE_MD5"), 533 # https://docs.exasol.com/db/latest/sql/create_view.htm 534 exp.CommentColumnConstraint: lambda self, e: f"COMMENT IS {self.sql(e, 'this')}", 535 exp.Select: transforms.preprocess( 536 [ 537 _qualify_unscoped_star, 538 _add_local_prefix_for_aliases, 539 ] 540 ), 541 exp.SubstringIndex: _substring_index_sql, 542 exp.WeekOfYear: rename_func("WEEK"), 543 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_date.htm 544 exp.Date: rename_func("TO_DATE"), 545 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_timestamp.htm 546 exp.Timestamp: rename_func("TO_TIMESTAMP"), 547 exp.Quarter: lambda self, e: f"CEIL(MONTH(TO_DATE({self.sql(e, 'this')}))/3)", 548 exp.LastDay: no_last_day_sql, 549 } 550 551 # https://docs.exasol.com/db/7.1/sql_references/system_tables/metadata/exa_sql_keywords.htm 552 RESERVED_KEYWORDS = { 553 "absolute", 554 "action", 555 "add", 556 "after", 557 "all", 558 "allocate", 559 "alter", 560 "and", 561 "any", 562 "append", 563 "are", 564 "array", 565 "as", 566 "asc", 567 "asensitive", 568 "assertion", 569 "at", 570 "attribute", 571 "authid", 572 "authorization", 573 "before", 574 "begin", 575 "between", 576 "bigint", 577 "binary", 578 "bit", 579 "blob", 580 "blocked", 581 "bool", 582 "boolean", 583 "both", 584 "by", 585 "byte", 586 "call", 587 "called", 588 "cardinality", 589 "cascade", 590 "cascaded", 591 "case", 592 "casespecific", 593 "cast", 594 "catalog", 595 "chain", 596 "char", 597 "character", 598 "character_set_catalog", 599 "character_set_name", 600 "character_set_schema", 601 "characteristics", 602 "check", 603 "checked", 604 "clob", 605 "close", 606 "coalesce", 607 "collate", 608 "collation", 609 "collation_catalog", 610 "collation_name", 611 "collation_schema", 612 "column", 613 "commit", 614 "condition", 615 "connect_by_iscycle", 616 "connect_by_isleaf", 617 "connect_by_root", 618 "connection", 619 "constant", 620 "constraint", 621 "constraint_state_default", 622 "constraints", 623 "constructor", 624 "contains", 625 "continue", 626 "control", 627 "convert", 628 "corresponding", 629 "create", 630 "cs", 631 "csv", 632 "cube", 633 "current", 634 "current_cluster", 635 "current_cluster_uid", 636 "current_date", 637 "current_path", 638 "current_role", 639 "current_schema", 640 "current_session", 641 "current_statement", 642 "current_time", 643 "current_timestamp", 644 "current_user", 645 "cursor", 646 "cycle", 647 "data", 648 "datalink", 649 "datetime_interval_code", 650 "datetime_interval_precision", 651 "day", 652 "dbtimezone", 653 "deallocate", 654 "dec", 655 "decimal", 656 "declare", 657 "default", 658 "default_like_escape_character", 659 "deferrable", 660 "deferred", 661 "defined", 662 "definer", 663 "delete", 664 "deref", 665 "derived", 666 "desc", 667 "describe", 668 "descriptor", 669 "deterministic", 670 "disable", 671 "disabled", 672 "disconnect", 673 "dispatch", 674 "distinct", 675 "dlurlcomplete", 676 "dlurlpath", 677 "dlurlpathonly", 678 "dlurlscheme", 679 "dlurlserver", 680 "dlvalue", 681 "do", 682 "domain", 683 "double", 684 "drop", 685 "dynamic", 686 "dynamic_function", 687 "dynamic_function_code", 688 "each", 689 "else", 690 "elseif", 691 "elsif", 692 "emits", 693 "enable", 694 "enabled", 695 "end", 696 "end-exec", 697 "endif", 698 "enforce", 699 "equals", 700 "errors", 701 "escape", 702 "except", 703 "exception", 704 "exec", 705 "execute", 706 "exists", 707 "exit", 708 "export", 709 "external", 710 "extract", 711 "false", 712 "fbv", 713 "fetch", 714 "file", 715 "final", 716 "first", 717 "float", 718 "following", 719 "for", 720 "forall", 721 "force", 722 "format", 723 "found", 724 "free", 725 "from", 726 "fs", 727 "full", 728 "function", 729 "general", 730 "generated", 731 "geometry", 732 "get", 733 "global", 734 "go", 735 "goto", 736 "grant", 737 "granted", 738 "group", 739 "group_concat", 740 "grouping", 741 "groups", 742 "hashtype", 743 "hashtype_format", 744 "having", 745 "high", 746 "hold", 747 "hour", 748 "identity", 749 "if", 750 "ifnull", 751 "immediate", 752 "impersonate", 753 "implementation", 754 "import", 755 "in", 756 "index", 757 "indicator", 758 "inner", 759 "inout", 760 "input", 761 "insensitive", 762 "insert", 763 "instance", 764 "instantiable", 765 "int", 766 "integer", 767 "integrity", 768 "intersect", 769 "interval", 770 "into", 771 "inverse", 772 "invoker", 773 "is", 774 "iterate", 775 "join", 776 "key_member", 777 "key_type", 778 "large", 779 "last", 780 "lateral", 781 "ldap", 782 "leading", 783 "leave", 784 "left", 785 "level", 786 "like", 787 "limit", 788 "listagg", 789 "localtime", 790 "localtimestamp", 791 "locator", 792 "log", 793 "longvarchar", 794 "loop", 795 "low", 796 "map", 797 "match", 798 "matched", 799 "merge", 800 "method", 801 "minus", 802 "minute", 803 "mod", 804 "modifies", 805 "modify", 806 "module", 807 "month", 808 "names", 809 "national", 810 "natural", 811 "nchar", 812 "nclob", 813 "new", 814 "next", 815 "nls_date_format", 816 "nls_date_language", 817 "nls_first_day_of_week", 818 "nls_numeric_characters", 819 "nls_timestamp_format", 820 "no", 821 "nocycle", 822 "nologging", 823 "none", 824 "not", 825 "null", 826 "nullif", 827 "number", 828 "numeric", 829 "nvarchar", 830 "nvarchar2", 831 "object", 832 "of", 833 "off", 834 "old", 835 "on", 836 "only", 837 "open", 838 "option", 839 "options", 840 "or", 841 "order", 842 "ordering", 843 "ordinality", 844 "others", 845 "out", 846 "outer", 847 "output", 848 "over", 849 "overlaps", 850 "overlay", 851 "overriding", 852 "pad", 853 "parallel_enable", 854 "parameter", 855 "parameter_specific_catalog", 856 "parameter_specific_name", 857 "parameter_specific_schema", 858 "parquet", 859 "partial", 860 "path", 861 "permission", 862 "placing", 863 "plus", 864 "preceding", 865 "preferring", 866 "prepare", 867 "preserve", 868 "prior", 869 "privileges", 870 "procedure", 871 "profile", 872 "qualify", 873 "random", 874 "range", 875 "read", 876 "reads", 877 "real", 878 "recovery", 879 "recursive", 880 "ref", 881 "references", 882 "referencing", 883 "refresh", 884 "regexp_like", 885 "relative", 886 "release", 887 "rename", 888 "repeat", 889 "replace", 890 "restore", 891 "restrict", 892 "result", 893 "return", 894 "returned_length", 895 "returned_octet_length", 896 "returns", 897 "revoke", 898 "right", 899 "rollback", 900 "rollup", 901 "routine", 902 "row", 903 "rows", 904 "rowtype", 905 "savepoint", 906 "schema", 907 "scope", 908 "scope_user", 909 "script", 910 "scroll", 911 "search", 912 "second", 913 "section", 914 "security", 915 "select", 916 "selective", 917 "self", 918 "sensitive", 919 "separator", 920 "sequence", 921 "session", 922 "session_user", 923 "sessiontimezone", 924 "set", 925 "sets", 926 "shortint", 927 "similar", 928 "smallint", 929 "some", 930 "source", 931 "space", 932 "specific", 933 "specifictype", 934 "sql", 935 "sql_bigint", 936 "sql_bit", 937 "sql_char", 938 "sql_date", 939 "sql_decimal", 940 "sql_double", 941 "sql_float", 942 "sql_integer", 943 "sql_longvarchar", 944 "sql_numeric", 945 "sql_preprocessor_script", 946 "sql_real", 947 "sql_smallint", 948 "sql_timestamp", 949 "sql_tinyint", 950 "sql_type_date", 951 "sql_type_timestamp", 952 "sql_varchar", 953 "sqlexception", 954 "sqlstate", 955 "sqlwarning", 956 "start", 957 "state", 958 "statement", 959 "static", 960 "structure", 961 "style", 962 "substring", 963 "subtype", 964 "sysdate", 965 "system", 966 "system_user", 967 "systimestamp", 968 "table", 969 "temporary", 970 "text", 971 "then", 972 "time", 973 "timestamp", 974 "timezone_hour", 975 "timezone_minute", 976 "tinyint", 977 "to", 978 "trailing", 979 "transaction", 980 "transform", 981 "transforms", 982 "translation", 983 "treat", 984 "trigger", 985 "trim", 986 "true", 987 "truncate", 988 "under", 989 "union", 990 "unique", 991 "unknown", 992 "unlink", 993 "unnest", 994 "until", 995 "update", 996 "usage", 997 "user", 998 "using", 999 "value", 1000 "values", 1001 "varchar", 1002 "varchar2", 1003 "varray", 1004 "verify", 1005 "view", 1006 "when", 1007 "whenever", 1008 "where", 1009 "while", 1010 "window", 1011 "with", 1012 "within", 1013 "without", 1014 "work", 1015 "year", 1016 "yes", 1017 "zone", 1018 } 1019 1020 def converttimezone_sql(self, expression: exp.ConvertTimezone) -> str: 1021 from_tz = expression.args.get("source_tz") 1022 to_tz = expression.args.get("target_tz") 1023 datetime = expression.args.get("timestamp") 1024 options = expression.args.get("options") 1025 1026 return self.func("CONVERT_TZ", datetime, from_tz, to_tz, options) 1027 1028 def if_sql(self, expression: exp.If) -> str: 1029 this = self.sql(expression, "this") 1030 true = self.sql(expression, "true") 1031 false = self.sql(expression, "false") 1032 return f"IF {this} THEN {true} ELSE {false} ENDIF" 1033 1034 def collate_sql(self, expression: exp.Collate) -> str: 1035 return self.sql(expression.this)
DATE_UNITS =
{'MINUTE', 'MONTH', 'YEAR', 'HOUR', 'DAY', 'SECOND', 'WEEK'}
class
Exasol(sqlglot.dialects.dialect.Dialect):
254class Exasol(Dialect): 255 # https://docs.exasol.com/db/latest/sql_references/basiclanguageelements.htm#SQLidentifier 256 NORMALIZATION_STRATEGY = NormalizationStrategy.UPPERCASE 257 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypesoverview.htm 258 SUPPORTS_USER_DEFINED_TYPES = False 259 # https://docs.exasol.com/db/latest/sql/select.htm 260 SUPPORTS_SEMI_ANTI_JOIN = False 261 SUPPORTS_COLUMN_JOIN_MARKS = True 262 NULL_ORDERING = "nulls_are_last" 263 # https://docs.exasol.com/db/latest/sql_references/literals.htm#StringLiterals 264 CONCAT_COALESCE = True 265 266 TIME_MAPPING = { 267 "yyyy": "%Y", 268 "YYYY": "%Y", 269 "yy": "%y", 270 "YY": "%y", 271 "mm": "%m", 272 "MM": "%m", 273 "MONTH": "%B", 274 "MON": "%b", 275 "dd": "%d", 276 "DD": "%d", 277 "DAY": "%A", 278 "DY": "%a", 279 "H12": "%I", 280 "H24": "%H", 281 "HH": "%H", 282 "ID": "%u", 283 "vW": "%V", 284 "IW": "%V", 285 "vYYY": "%G", 286 "IYYY": "%G", 287 "MI": "%M", 288 "SS": "%S", 289 "uW": "%W", 290 "UW": "%U", 291 "Z": "%z", 292 } 293 294 class Tokenizer(tokens.Tokenizer): 295 IDENTIFIERS = ['"', ("[", "]")] 296 KEYWORDS = { 297 **tokens.Tokenizer.KEYWORDS, 298 "USER": TokenType.CURRENT_USER, 299 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/if.htm 300 "ENDIF": TokenType.END, 301 "LONG VARCHAR": TokenType.TEXT, 302 "SEPARATOR": TokenType.SEPARATOR, 303 "SYSTIMESTAMP": TokenType.SYSTIMESTAMP, 304 } 305 KEYWORDS.pop("DIV") 306 307 class Parser(parser.Parser): 308 FUNCTIONS = { 309 **parser.Parser.FUNCTIONS, 310 **{ 311 f"ADD_{unit}S": build_date_delta(exp.DateAdd, default_unit=unit) 312 for unit in DATE_UNITS 313 }, 314 **{ 315 f"{unit}S_BETWEEN": build_date_delta(exp.DateDiff, default_unit=unit) 316 for unit in DATE_UNITS 317 }, 318 "APPROXIMATE_COUNT_DISTINCT": exp.ApproxDistinct.from_arg_list, 319 "BIT_AND": binary_from_function(exp.BitwiseAnd), 320 "BIT_OR": binary_from_function(exp.BitwiseOr), 321 "BIT_XOR": binary_from_function(exp.BitwiseXor), 322 "BIT_NOT": lambda args: exp.BitwiseNot(this=seq_get(args, 0)), 323 "BIT_LSHIFT": binary_from_function(exp.BitwiseLeftShift), 324 "BIT_RSHIFT": binary_from_function(exp.BitwiseRightShift), 325 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/convert_tz.htm 326 "CONVERT_TZ": lambda args: exp.ConvertTimezone( 327 source_tz=seq_get(args, 1), 328 target_tz=seq_get(args, 2), 329 timestamp=seq_get(args, 0), 330 options=seq_get(args, 3), 331 ), 332 "CURDATE": exp.CurrentDate.from_arg_list, 333 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/date_trunc.htm#DATE_TRUNC 334 "DATE_TRUNC": lambda args: exp.TimestampTrunc( 335 this=seq_get(args, 1), unit=seq_get(args, 0) 336 ), 337 "DIV": binary_from_function(exp.IntDiv), 338 "EVERY": lambda args: exp.All(this=seq_get(args, 0)), 339 "EDIT_DISTANCE": exp.Levenshtein.from_arg_list, 340 "HASH_SHA": exp.SHA.from_arg_list, 341 "HASH_SHA1": exp.SHA.from_arg_list, 342 "HASH_MD5": exp.MD5.from_arg_list, 343 "HASHTYPE_MD5": exp.MD5Digest.from_arg_list, 344 "HASH_SHA256": lambda args: exp.SHA2( 345 this=seq_get(args, 0), length=exp.Literal.number(256) 346 ), 347 "HASH_SHA512": lambda args: exp.SHA2( 348 this=seq_get(args, 0), length=exp.Literal.number(512) 349 ), 350 "NOW": exp.CurrentTimestamp.from_arg_list, 351 "NULLIFZERO": _build_nullifzero, 352 "REGEXP_SUBSTR": exp.RegexpExtract.from_arg_list, 353 "REGEXP_REPLACE": lambda args: exp.RegexpReplace( 354 this=seq_get(args, 0), 355 expression=seq_get(args, 1), 356 replacement=seq_get(args, 2), 357 position=seq_get(args, 3), 358 occurrence=seq_get(args, 4), 359 ), 360 "TRUNC": build_trunc, 361 "TRUNCATE": build_trunc, 362 "TO_CHAR": build_timetostr_or_tochar, 363 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "exasol"), 364 "USER": exp.CurrentUser.from_arg_list, 365 "VAR_POP": exp.VariancePop.from_arg_list, 366 "ZEROIFNULL": _build_zeroifnull, 367 } 368 CONSTRAINT_PARSERS = { 369 **parser.Parser.CONSTRAINT_PARSERS, 370 "COMMENT": lambda self: self.expression( 371 exp.CommentColumnConstraint, 372 this=self._match(TokenType.IS) and self._parse_string(), 373 ), 374 } 375 376 FUNC_TOKENS = { 377 *parser.Parser.FUNC_TOKENS, 378 TokenType.SYSTIMESTAMP, 379 } 380 381 NO_PAREN_FUNCTIONS = { 382 **parser.Parser.NO_PAREN_FUNCTIONS, 383 TokenType.SYSTIMESTAMP: exp.Systimestamp, 384 TokenType.CURRENT_SCHEMA: exp.CurrentSchema, 385 } 386 387 FUNCTION_PARSERS = { 388 **parser.Parser.FUNCTION_PARSERS, 389 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/listagg.htm 390 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/group_concat.htm 391 **dict.fromkeys(("GROUP_CONCAT", "LISTAGG"), lambda self: self._parse_group_concat()), 392 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/json_value.htm 393 "JSON_VALUE": lambda self: self._parse_json_value(), 394 } 395 396 def _parse_column(self) -> t.Optional[exp.Expression]: 397 column = super()._parse_column() 398 if not isinstance(column, exp.Column): 399 return column 400 table_ident = column.args.get("table") 401 if ( 402 isinstance(table_ident, exp.Identifier) 403 and table_ident.name.upper() == "LOCAL" 404 and not bool(table_ident.args.get("quoted")) 405 ): 406 column.set("table", None) 407 return column 408 409 ODBC_DATETIME_LITERALS = { 410 "d": exp.Date, 411 "ts": exp.Timestamp, 412 } 413 414 class Generator(generator.Generator): 415 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypedetails.htm#StringDataType 416 STRING_TYPE_MAPPING = { 417 exp.DataType.Type.BLOB: "VARCHAR", 418 exp.DataType.Type.LONGBLOB: "VARCHAR", 419 exp.DataType.Type.LONGTEXT: "VARCHAR", 420 exp.DataType.Type.MEDIUMBLOB: "VARCHAR", 421 exp.DataType.Type.MEDIUMTEXT: "VARCHAR", 422 exp.DataType.Type.TINYBLOB: "VARCHAR", 423 exp.DataType.Type.TINYTEXT: "VARCHAR", 424 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypealiases.htm 425 exp.DataType.Type.TEXT: "LONG VARCHAR", 426 exp.DataType.Type.VARBINARY: "VARCHAR", 427 } 428 429 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypealiases.htm 430 TYPE_MAPPING = { 431 **generator.Generator.TYPE_MAPPING, 432 **STRING_TYPE_MAPPING, 433 exp.DataType.Type.TINYINT: "SMALLINT", 434 exp.DataType.Type.MEDIUMINT: "INT", 435 exp.DataType.Type.DECIMAL32: "DECIMAL", 436 exp.DataType.Type.DECIMAL64: "DECIMAL", 437 exp.DataType.Type.DECIMAL128: "DECIMAL", 438 exp.DataType.Type.DECIMAL256: "DECIMAL", 439 exp.DataType.Type.DATETIME: "TIMESTAMP", 440 exp.DataType.Type.TIMESTAMPTZ: "TIMESTAMP", 441 exp.DataType.Type.TIMESTAMPLTZ: "TIMESTAMP", 442 exp.DataType.Type.TIMESTAMPNTZ: "TIMESTAMP", 443 } 444 445 def datatype_sql(self, expression: exp.DataType) -> str: 446 # Exasol supports a fixed default precision of 3 for TIMESTAMP WITH LOCAL TIME ZONE 447 # and does not allow specifying a different custom precision 448 if expression.is_type(exp.DataType.Type.TIMESTAMPLTZ): 449 return "TIMESTAMP WITH LOCAL TIME ZONE" 450 451 return super().datatype_sql(expression) 452 453 TRANSFORMS = { 454 **generator.Generator.TRANSFORMS, 455 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/every.htm 456 exp.All: rename_func("EVERY"), 457 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_and.htm 458 exp.BitwiseAnd: rename_func("BIT_AND"), 459 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_or.htm 460 exp.BitwiseOr: rename_func("BIT_OR"), 461 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_not.htm 462 exp.BitwiseNot: rename_func("BIT_NOT"), 463 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_lshift.htm 464 exp.BitwiseLeftShift: rename_func("BIT_LSHIFT"), 465 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_rshift.htm 466 exp.BitwiseRightShift: rename_func("BIT_RSHIFT"), 467 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_xor.htm 468 exp.BitwiseXor: rename_func("BIT_XOR"), 469 exp.CurrentSchema: lambda *_: "CURRENT_SCHEMA", 470 exp.DateDiff: _date_diff_sql, 471 exp.DateAdd: _add_date_sql, 472 exp.TsOrDsAdd: _add_date_sql, 473 exp.DateSub: _add_date_sql, 474 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/div.htm#DIV 475 exp.IntDiv: rename_func("DIV"), 476 exp.TsOrDsDiff: _date_diff_sql, 477 exp.DateTrunc: _date_trunc_sql, 478 exp.DayOfWeek: lambda self, e: f"CAST(TO_CHAR({self.sql(e, 'this')}, 'D') AS INTEGER)", 479 exp.DatetimeTrunc: timestamptrunc_sql(), 480 exp.GroupConcat: lambda self, e: groupconcat_sql( 481 self, e, func_name="LISTAGG", within_group=True 482 ), 483 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/edit_distance.htm#EDIT_DISTANCE 484 exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")( 485 rename_func("EDIT_DISTANCE") 486 ), 487 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/mod.htm 488 exp.Mod: rename_func("MOD"), 489 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/rank.htm 490 exp.Rank: unsupported_args("expressions")(lambda *_: "RANK()"), 491 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/dense_rank.htm 492 exp.DenseRank: unsupported_args("expressions")(lambda *_: "DENSE_RANK()"), 493 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/regexp_substr.htm 494 exp.RegexpExtract: unsupported_args("parameters", "group")( 495 rename_func("REGEXP_SUBSTR") 496 ), 497 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/regexp_replace.htm 498 exp.RegexpReplace: unsupported_args("modifiers")(rename_func("REGEXP_REPLACE")), 499 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/var_pop.htm 500 exp.VariancePop: rename_func("VAR_POP"), 501 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/approximate_count_distinct.htm 502 exp.ApproxDistinct: unsupported_args("accuracy")( 503 rename_func("APPROXIMATE_COUNT_DISTINCT") 504 ), 505 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_char%20(datetime).htm 506 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 507 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_date.htm 508 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 509 exp.TimeToStr: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 510 exp.TimeStrToTime: timestrtotime_sql, 511 exp.TimestampTrunc: _timestamp_trunc_sql, 512 exp.StrToTime: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 513 exp.CurrentUser: lambda *_: "CURRENT_USER", 514 exp.AtTimeZone: lambda self, e: self.func( 515 "CONVERT_TZ", 516 e.this, 517 "'UTC'", 518 e.args.get("zone"), 519 ), 520 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/instr.htm 521 exp.StrPosition: lambda self, e: ( 522 strposition_sql( 523 self, e, func_name="INSTR", supports_position=True, supports_occurrence=True 524 ) 525 ), 526 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha%5B1%5D.htm#HASH_SHA%5B1%5D 527 exp.SHA: rename_func("HASH_SHA"), 528 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha256.htm 529 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha512.htm 530 exp.SHA2: _sha2_sql, 531 exp.MD5: rename_func("HASH_MD5"), 532 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hashtype_md5.htm 533 exp.MD5Digest: rename_func("HASHTYPE_MD5"), 534 # https://docs.exasol.com/db/latest/sql/create_view.htm 535 exp.CommentColumnConstraint: lambda self, e: f"COMMENT IS {self.sql(e, 'this')}", 536 exp.Select: transforms.preprocess( 537 [ 538 _qualify_unscoped_star, 539 _add_local_prefix_for_aliases, 540 ] 541 ), 542 exp.SubstringIndex: _substring_index_sql, 543 exp.WeekOfYear: rename_func("WEEK"), 544 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_date.htm 545 exp.Date: rename_func("TO_DATE"), 546 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_timestamp.htm 547 exp.Timestamp: rename_func("TO_TIMESTAMP"), 548 exp.Quarter: lambda self, e: f"CEIL(MONTH(TO_DATE({self.sql(e, 'this')}))/3)", 549 exp.LastDay: no_last_day_sql, 550 } 551 552 # https://docs.exasol.com/db/7.1/sql_references/system_tables/metadata/exa_sql_keywords.htm 553 RESERVED_KEYWORDS = { 554 "absolute", 555 "action", 556 "add", 557 "after", 558 "all", 559 "allocate", 560 "alter", 561 "and", 562 "any", 563 "append", 564 "are", 565 "array", 566 "as", 567 "asc", 568 "asensitive", 569 "assertion", 570 "at", 571 "attribute", 572 "authid", 573 "authorization", 574 "before", 575 "begin", 576 "between", 577 "bigint", 578 "binary", 579 "bit", 580 "blob", 581 "blocked", 582 "bool", 583 "boolean", 584 "both", 585 "by", 586 "byte", 587 "call", 588 "called", 589 "cardinality", 590 "cascade", 591 "cascaded", 592 "case", 593 "casespecific", 594 "cast", 595 "catalog", 596 "chain", 597 "char", 598 "character", 599 "character_set_catalog", 600 "character_set_name", 601 "character_set_schema", 602 "characteristics", 603 "check", 604 "checked", 605 "clob", 606 "close", 607 "coalesce", 608 "collate", 609 "collation", 610 "collation_catalog", 611 "collation_name", 612 "collation_schema", 613 "column", 614 "commit", 615 "condition", 616 "connect_by_iscycle", 617 "connect_by_isleaf", 618 "connect_by_root", 619 "connection", 620 "constant", 621 "constraint", 622 "constraint_state_default", 623 "constraints", 624 "constructor", 625 "contains", 626 "continue", 627 "control", 628 "convert", 629 "corresponding", 630 "create", 631 "cs", 632 "csv", 633 "cube", 634 "current", 635 "current_cluster", 636 "current_cluster_uid", 637 "current_date", 638 "current_path", 639 "current_role", 640 "current_schema", 641 "current_session", 642 "current_statement", 643 "current_time", 644 "current_timestamp", 645 "current_user", 646 "cursor", 647 "cycle", 648 "data", 649 "datalink", 650 "datetime_interval_code", 651 "datetime_interval_precision", 652 "day", 653 "dbtimezone", 654 "deallocate", 655 "dec", 656 "decimal", 657 "declare", 658 "default", 659 "default_like_escape_character", 660 "deferrable", 661 "deferred", 662 "defined", 663 "definer", 664 "delete", 665 "deref", 666 "derived", 667 "desc", 668 "describe", 669 "descriptor", 670 "deterministic", 671 "disable", 672 "disabled", 673 "disconnect", 674 "dispatch", 675 "distinct", 676 "dlurlcomplete", 677 "dlurlpath", 678 "dlurlpathonly", 679 "dlurlscheme", 680 "dlurlserver", 681 "dlvalue", 682 "do", 683 "domain", 684 "double", 685 "drop", 686 "dynamic", 687 "dynamic_function", 688 "dynamic_function_code", 689 "each", 690 "else", 691 "elseif", 692 "elsif", 693 "emits", 694 "enable", 695 "enabled", 696 "end", 697 "end-exec", 698 "endif", 699 "enforce", 700 "equals", 701 "errors", 702 "escape", 703 "except", 704 "exception", 705 "exec", 706 "execute", 707 "exists", 708 "exit", 709 "export", 710 "external", 711 "extract", 712 "false", 713 "fbv", 714 "fetch", 715 "file", 716 "final", 717 "first", 718 "float", 719 "following", 720 "for", 721 "forall", 722 "force", 723 "format", 724 "found", 725 "free", 726 "from", 727 "fs", 728 "full", 729 "function", 730 "general", 731 "generated", 732 "geometry", 733 "get", 734 "global", 735 "go", 736 "goto", 737 "grant", 738 "granted", 739 "group", 740 "group_concat", 741 "grouping", 742 "groups", 743 "hashtype", 744 "hashtype_format", 745 "having", 746 "high", 747 "hold", 748 "hour", 749 "identity", 750 "if", 751 "ifnull", 752 "immediate", 753 "impersonate", 754 "implementation", 755 "import", 756 "in", 757 "index", 758 "indicator", 759 "inner", 760 "inout", 761 "input", 762 "insensitive", 763 "insert", 764 "instance", 765 "instantiable", 766 "int", 767 "integer", 768 "integrity", 769 "intersect", 770 "interval", 771 "into", 772 "inverse", 773 "invoker", 774 "is", 775 "iterate", 776 "join", 777 "key_member", 778 "key_type", 779 "large", 780 "last", 781 "lateral", 782 "ldap", 783 "leading", 784 "leave", 785 "left", 786 "level", 787 "like", 788 "limit", 789 "listagg", 790 "localtime", 791 "localtimestamp", 792 "locator", 793 "log", 794 "longvarchar", 795 "loop", 796 "low", 797 "map", 798 "match", 799 "matched", 800 "merge", 801 "method", 802 "minus", 803 "minute", 804 "mod", 805 "modifies", 806 "modify", 807 "module", 808 "month", 809 "names", 810 "national", 811 "natural", 812 "nchar", 813 "nclob", 814 "new", 815 "next", 816 "nls_date_format", 817 "nls_date_language", 818 "nls_first_day_of_week", 819 "nls_numeric_characters", 820 "nls_timestamp_format", 821 "no", 822 "nocycle", 823 "nologging", 824 "none", 825 "not", 826 "null", 827 "nullif", 828 "number", 829 "numeric", 830 "nvarchar", 831 "nvarchar2", 832 "object", 833 "of", 834 "off", 835 "old", 836 "on", 837 "only", 838 "open", 839 "option", 840 "options", 841 "or", 842 "order", 843 "ordering", 844 "ordinality", 845 "others", 846 "out", 847 "outer", 848 "output", 849 "over", 850 "overlaps", 851 "overlay", 852 "overriding", 853 "pad", 854 "parallel_enable", 855 "parameter", 856 "parameter_specific_catalog", 857 "parameter_specific_name", 858 "parameter_specific_schema", 859 "parquet", 860 "partial", 861 "path", 862 "permission", 863 "placing", 864 "plus", 865 "preceding", 866 "preferring", 867 "prepare", 868 "preserve", 869 "prior", 870 "privileges", 871 "procedure", 872 "profile", 873 "qualify", 874 "random", 875 "range", 876 "read", 877 "reads", 878 "real", 879 "recovery", 880 "recursive", 881 "ref", 882 "references", 883 "referencing", 884 "refresh", 885 "regexp_like", 886 "relative", 887 "release", 888 "rename", 889 "repeat", 890 "replace", 891 "restore", 892 "restrict", 893 "result", 894 "return", 895 "returned_length", 896 "returned_octet_length", 897 "returns", 898 "revoke", 899 "right", 900 "rollback", 901 "rollup", 902 "routine", 903 "row", 904 "rows", 905 "rowtype", 906 "savepoint", 907 "schema", 908 "scope", 909 "scope_user", 910 "script", 911 "scroll", 912 "search", 913 "second", 914 "section", 915 "security", 916 "select", 917 "selective", 918 "self", 919 "sensitive", 920 "separator", 921 "sequence", 922 "session", 923 "session_user", 924 "sessiontimezone", 925 "set", 926 "sets", 927 "shortint", 928 "similar", 929 "smallint", 930 "some", 931 "source", 932 "space", 933 "specific", 934 "specifictype", 935 "sql", 936 "sql_bigint", 937 "sql_bit", 938 "sql_char", 939 "sql_date", 940 "sql_decimal", 941 "sql_double", 942 "sql_float", 943 "sql_integer", 944 "sql_longvarchar", 945 "sql_numeric", 946 "sql_preprocessor_script", 947 "sql_real", 948 "sql_smallint", 949 "sql_timestamp", 950 "sql_tinyint", 951 "sql_type_date", 952 "sql_type_timestamp", 953 "sql_varchar", 954 "sqlexception", 955 "sqlstate", 956 "sqlwarning", 957 "start", 958 "state", 959 "statement", 960 "static", 961 "structure", 962 "style", 963 "substring", 964 "subtype", 965 "sysdate", 966 "system", 967 "system_user", 968 "systimestamp", 969 "table", 970 "temporary", 971 "text", 972 "then", 973 "time", 974 "timestamp", 975 "timezone_hour", 976 "timezone_minute", 977 "tinyint", 978 "to", 979 "trailing", 980 "transaction", 981 "transform", 982 "transforms", 983 "translation", 984 "treat", 985 "trigger", 986 "trim", 987 "true", 988 "truncate", 989 "under", 990 "union", 991 "unique", 992 "unknown", 993 "unlink", 994 "unnest", 995 "until", 996 "update", 997 "usage", 998 "user", 999 "using", 1000 "value", 1001 "values", 1002 "varchar", 1003 "varchar2", 1004 "varray", 1005 "verify", 1006 "view", 1007 "when", 1008 "whenever", 1009 "where", 1010 "while", 1011 "window", 1012 "with", 1013 "within", 1014 "without", 1015 "work", 1016 "year", 1017 "yes", 1018 "zone", 1019 } 1020 1021 def converttimezone_sql(self, expression: exp.ConvertTimezone) -> str: 1022 from_tz = expression.args.get("source_tz") 1023 to_tz = expression.args.get("target_tz") 1024 datetime = expression.args.get("timestamp") 1025 options = expression.args.get("options") 1026 1027 return self.func("CONVERT_TZ", datetime, from_tz, to_tz, options) 1028 1029 def if_sql(self, expression: exp.If) -> str: 1030 this = self.sql(expression, "this") 1031 true = self.sql(expression, "true") 1032 false = self.sql(expression, "false") 1033 return f"IF {this} THEN {true} ELSE {false} ENDIF" 1034 1035 def collate_sql(self, expression: exp.Collate) -> str: 1036 return self.sql(expression.this)
NORMALIZATION_STRATEGY =
<NormalizationStrategy.UPPERCASE: 'UPPERCASE'>
Specifies the strategy according to which identifiers should be normalized.
NULL_ORDERING =
'nulls_are_last'
Default NULL ordering method to use if not explicitly set.
Possible values: "nulls_are_small", "nulls_are_large", "nulls_are_last"
CONCAT_COALESCE =
True
A NULL arg in CONCAT yields NULL by default, but in some dialects it yields an empty string.
TIME_MAPPING: Dict[str, str] =
{'yyyy': '%Y', 'YYYY': '%Y', 'yy': '%y', 'YY': '%y', 'mm': '%m', 'MM': '%m', 'MONTH': '%B', 'MON': '%b', 'dd': '%d', 'DD': '%d', 'DAY': '%A', 'DY': '%a', 'H12': '%I', 'H24': '%H', 'HH': '%H', 'ID': '%u', 'vW': '%V', 'IW': '%V', 'vYYY': '%G', 'IYYY': '%G', 'MI': '%M', 'SS': '%S', 'uW': '%W', 'UW': '%U', 'Z': '%z'}
Associates this dialect's time formats with their equivalent Python strftime formats.
tokenizer_class =
<class 'Exasol.Tokenizer'>
parser_class =
<class 'Exasol.Parser'>
generator_class =
<class 'Exasol.Generator'>
TIME_TRIE: Dict =
{'y': {'y': {'y': {'y': {0: True}}, 0: True}}, 'Y': {'Y': {'Y': {'Y': {0: True}}, 0: True}}, 'm': {'m': {0: True}}, 'M': {'M': {0: True}, 'O': {'N': {'T': {'H': {0: True}}, 0: True}}, 'I': {0: True}}, 'd': {'d': {0: True}}, 'D': {'D': {0: True}, 'A': {'Y': {0: True}}, 'Y': {0: True}}, 'H': {'1': {'2': {0: True}}, '2': {'4': {0: True}}, 'H': {0: True}}, 'I': {'D': {0: True}, 'W': {0: True}, 'Y': {'Y': {'Y': {0: True}}}}, 'v': {'W': {0: True}, 'Y': {'Y': {'Y': {0: True}}}}, 'S': {'S': {0: True}}, 'u': {'W': {0: True}}, 'U': {'W': {0: True}}, 'Z': {0: True}}
FORMAT_TRIE: Dict =
{'y': {'y': {'y': {'y': {0: True}}, 0: True}}, 'Y': {'Y': {'Y': {'Y': {0: True}}, 0: True}}, 'm': {'m': {0: True}}, 'M': {'M': {0: True}, 'O': {'N': {'T': {'H': {0: True}}, 0: True}}, 'I': {0: True}}, 'd': {'d': {0: True}}, 'D': {'D': {0: True}, 'A': {'Y': {0: True}}, 'Y': {0: True}}, 'H': {'1': {'2': {0: True}}, '2': {'4': {0: True}}, 'H': {0: True}}, 'I': {'D': {0: True}, 'W': {0: True}, 'Y': {'Y': {'Y': {0: True}}}}, 'v': {'W': {0: True}, 'Y': {'Y': {'Y': {0: True}}}}, 'S': {'S': {0: True}}, 'u': {'W': {0: True}}, 'U': {'W': {0: True}}, 'Z': {0: True}}
INVERSE_TIME_MAPPING: Dict[str, str] =
{'%Y': 'YYYY', '%y': 'YY', '%m': 'MM', '%B': 'MONTH', '%b': 'MON', '%d': 'DD', '%A': 'DAY', '%a': 'DY', '%I': 'H12', '%H': 'HH', '%u': 'ID', '%V': 'IW', '%G': 'IYYY', '%M': 'MI', '%S': 'SS', '%W': 'uW', '%U': 'UW', '%z': 'Z'}
INVERSE_TIME_TRIE: Dict =
{'%': {'Y': {0: True}, 'y': {0: True}, 'm': {0: True}, 'B': {0: True}, 'b': {0: True}, 'd': {0: True}, 'A': {0: True}, 'a': {0: True}, 'I': {0: True}, 'H': {0: True}, 'u': {0: True}, 'V': {0: True}, 'G': {0: True}, 'M': {0: True}, 'S': {0: True}, 'W': {0: True}, 'U': {0: True}, 'z': {0: True}}}
VALID_INTERVAL_UNITS: Set[str] =
{'WOY', 'DECADE', 'YR', 'QUARTERS', 'MON', 'DAYOFWEEK', 'TZH', 'MS', 'MILLENNIUM', 'NANOSECOND', 'MONTHS', 'EPOCH_MICROSECONDS', 'WEEKOFYEAR_ISO', 'C', 'SECONDS', 'WEEKOFYEAR', 'NS', 'EPOCH_MILLISECOND', 'Y', 'WK', 'WY', 'USECOND', 'EPOCH_MICROSECOND', 'MILLISEC', 'MONTH', 'YEAR', 'EPOCH_NANOSECONDS', 'MILS', 'DOY', 'NANOSEC', 'DOW_ISO', 'CENT', 'DAYS', 'MINS', 'SEC', 'MILLISECS', 'MI', 'Q', 'MICROSECS', 'DAYOFMONTH', 'WEEKOFYEARISO', 'DECADES', 'S', 'YRS', 'YYYY', 'WEEK', 'MINUTES', 'WEEKDAY', 'EPOCH', 'HOUR', 'YEARS', 'NSEC', 'MSECOND', 'USEC', 'DAYOFWEEK_ISO', 'CENTURIES', 'QTRS', 'MM', 'D', 'MILLISECONDS', 'DAYOFYEAR', 'WEEKISO', 'NANOSECS', 'CENTS', 'WEEKDAY_ISO', 'DAYOFWEEKISO', 'EPOCH_NANOSECOND', 'MICROSECONDS', 'DAY OF YEAR', 'EPOCH_MILLISECONDS', 'USECONDS', 'TIMEZONE_MINUTE', 'YY', 'HR', 'EPOCH_SECONDS', 'MILLENIA', 'W', 'MICROSECOND', 'DECS', 'MINUTE', 'CENTURY', 'MIN', 'YYY', 'MSECONDS', 'HH', 'DD', 'QTR', 'TIMEZONE_HOUR', 'DAY OF WEEK', 'DW', 'QUARTER', 'SECS', 'NSECONDS', 'DW_ISO', 'DAY', 'DY', 'SECOND', 'MILLISECON', 'MICROSEC', 'EPOCH_SECOND', 'HRS', 'HOURS', 'MIL', 'TZM', 'MSEC', 'H', 'DOW', 'MSECS', 'MILLISECOND', 'US', 'MONS', 'DEC', 'WEEK_ISO', 'NSECOND', 'USECS', 'M'}
294 class Tokenizer(tokens.Tokenizer): 295 IDENTIFIERS = ['"', ("[", "]")] 296 KEYWORDS = { 297 **tokens.Tokenizer.KEYWORDS, 298 "USER": TokenType.CURRENT_USER, 299 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/if.htm 300 "ENDIF": TokenType.END, 301 "LONG VARCHAR": TokenType.TEXT, 302 "SEPARATOR": TokenType.SEPARATOR, 303 "SYSTIMESTAMP": TokenType.SYSTIMESTAMP, 304 } 305 KEYWORDS.pop("DIV")
KEYWORDS =
{'{%': <TokenType.BLOCK_START: 70>, '{%+': <TokenType.BLOCK_START: 70>, '{%-': <TokenType.BLOCK_START: 70>, '%}': <TokenType.BLOCK_END: 71>, '+%}': <TokenType.BLOCK_END: 71>, '-%}': <TokenType.BLOCK_END: 71>, '{{+': <TokenType.BLOCK_START: 70>, '{{-': <TokenType.BLOCK_START: 70>, '+}}': <TokenType.BLOCK_END: 71>, '-}}': <TokenType.BLOCK_END: 71>, '/*+': <TokenType.HINT: 288>, '&<': <TokenType.AMP_LT: 60>, '&>': <TokenType.AMP_GT: 61>, '==': <TokenType.EQ: 27>, '::': <TokenType.DCOLON: 13>, '?::': <TokenType.QDCOLON: 360>, '||': <TokenType.DPIPE: 36>, '|>': <TokenType.PIPE_GT: 37>, '>=': <TokenType.GTE: 25>, '<=': <TokenType.LTE: 23>, '<>': <TokenType.NEQ: 28>, '!=': <TokenType.NEQ: 28>, ':=': <TokenType.COLON_EQ: 30>, '<=>': <TokenType.NULLSAFE_EQ: 29>, '->': <TokenType.ARROW: 44>, '->>': <TokenType.DARROW: 45>, '=>': <TokenType.FARROW: 46>, '#>': <TokenType.HASH_ARROW: 48>, '#>>': <TokenType.DHASH_ARROW: 49>, '<->': <TokenType.LR_ARROW: 50>, '&&': <TokenType.DAMP: 59>, '??': <TokenType.DQMARK: 17>, '~~~': <TokenType.GLOB: 282>, '~~': <TokenType.LIKE: 312>, '~~*': <TokenType.ILIKE: 290>, '~*': <TokenType.IRLIKE: 301>, '-|-': <TokenType.ADJACENT: 62>, 'ALL': <TokenType.ALL: 216>, 'AND': <TokenType.AND: 33>, 'ANTI': <TokenType.ANTI: 217>, 'ANY': <TokenType.ANY: 218>, 'ASC': <TokenType.ASC: 221>, 'AS': <TokenType.ALIAS: 214>, 'ASOF': <TokenType.ASOF: 222>, 'AUTOINCREMENT': <TokenType.AUTO_INCREMENT: 224>, 'AUTO_INCREMENT': <TokenType.AUTO_INCREMENT: 224>, 'BEGIN': <TokenType.BEGIN: 225>, 'BETWEEN': <TokenType.BETWEEN: 226>, 'CACHE': <TokenType.CACHE: 228>, 'UNCACHE': <TokenType.UNCACHE: 400>, 'CASE': <TokenType.CASE: 229>, 'CHARACTER SET': <TokenType.CHARACTER_SET: 230>, 'CLUSTER BY': <TokenType.CLUSTER_BY: 231>, 'COLLATE': <TokenType.COLLATE: 232>, 'COLUMN': <TokenType.COLUMN: 78>, 'COMMIT': <TokenType.COMMIT: 235>, 'CONNECT BY': <TokenType.CONNECT_BY: 236>, 'CONSTRAINT': <TokenType.CONSTRAINT: 237>, 'COPY': <TokenType.COPY: 238>, 'CREATE': <TokenType.CREATE: 239>, 'CROSS': <TokenType.CROSS: 240>, 'CUBE': <TokenType.CUBE: 241>, 'CURRENT_DATE': <TokenType.CURRENT_DATE: 242>, 'CURRENT_SCHEMA': <TokenType.CURRENT_SCHEMA: 244>, 'CURRENT_TIME': <TokenType.CURRENT_TIME: 245>, 'CURRENT_TIMESTAMP': <TokenType.CURRENT_TIMESTAMP: 246>, 'CURRENT_USER': <TokenType.CURRENT_USER: 247>, 'CURRENT_CATALOG': <TokenType.CURRENT_CATALOG: 249>, 'DATABASE': <TokenType.DATABASE: 77>, 'DEFAULT': <TokenType.DEFAULT: 251>, 'DELETE': <TokenType.DELETE: 252>, 'DESC': <TokenType.DESC: 253>, 'DESCRIBE': <TokenType.DESCRIBE: 254>, 'DISTINCT': <TokenType.DISTINCT: 257>, 'DISTRIBUTE BY': <TokenType.DISTRIBUTE_BY: 258>, 'DROP': <TokenType.DROP: 260>, 'ELSE': <TokenType.ELSE: 261>, 'END': <TokenType.END: 262>, 'ENUM': <TokenType.ENUM: 201>, 'ESCAPE': <TokenType.ESCAPE: 263>, 'EXCEPT': <TokenType.EXCEPT: 264>, 'EXECUTE': <TokenType.EXECUTE: 265>, 'EXISTS': <TokenType.EXISTS: 266>, 'FALSE': <TokenType.FALSE: 267>, 'FETCH': <TokenType.FETCH: 268>, 'FILTER': <TokenType.FILTER: 271>, 'FILE': <TokenType.FILE: 269>, 'FIRST': <TokenType.FIRST: 273>, 'FULL': <TokenType.FULL: 279>, 'FUNCTION': <TokenType.FUNCTION: 280>, 'FOR': <TokenType.FOR: 274>, 'FOREIGN KEY': <TokenType.FOREIGN_KEY: 276>, 'FORMAT': <TokenType.FORMAT: 277>, 'FROM': <TokenType.FROM: 278>, 'GEOGRAPHY': <TokenType.GEOGRAPHY: 168>, 'GEOMETRY': <TokenType.GEOMETRY: 171>, 'GLOB': <TokenType.GLOB: 282>, 'GROUP BY': <TokenType.GROUP_BY: 285>, 'GROUPING SETS': <TokenType.GROUPING_SETS: 286>, 'HAVING': <TokenType.HAVING: 287>, 'ILIKE': <TokenType.ILIKE: 290>, 'IN': <TokenType.IN: 291>, 'INDEX': <TokenType.INDEX: 292>, 'INET': <TokenType.INET: 196>, 'INNER': <TokenType.INNER: 294>, 'INSERT': <TokenType.INSERT: 295>, 'INTERVAL': <TokenType.INTERVAL: 298>, 'INTERSECT': <TokenType.INTERSECT: 297>, 'INTO': <TokenType.INTO: 299>, 'IS': <TokenType.IS: 302>, 'ISNULL': <TokenType.ISNULL: 303>, 'JOIN': <TokenType.JOIN: 304>, 'KEEP': <TokenType.KEEP: 306>, 'KILL': <TokenType.KILL: 308>, 'LATERAL': <TokenType.LATERAL: 310>, 'LEFT': <TokenType.LEFT: 311>, 'LIKE': <TokenType.LIKE: 312>, 'LIMIT': <TokenType.LIMIT: 313>, 'LOAD': <TokenType.LOAD: 315>, 'LOCALTIME': <TokenType.LOCALTIME: 175>, 'LOCALTIMESTAMP': <TokenType.LOCALTIMESTAMP: 176>, 'LOCK': <TokenType.LOCK: 316>, 'MERGE': <TokenType.MERGE: 322>, 'NAMESPACE': <TokenType.NAMESPACE: 426>, 'NATURAL': <TokenType.NATURAL: 325>, 'NEXT': <TokenType.NEXT: 326>, 'NOT': <TokenType.NOT: 26>, 'NOTNULL': <TokenType.NOTNULL: 328>, 'NULL': <TokenType.NULL: 329>, 'OBJECT': <TokenType.OBJECT: 195>, 'OFFSET': <TokenType.OFFSET: 331>, 'ON': <TokenType.ON: 332>, 'OR': <TokenType.OR: 34>, 'XOR': <TokenType.XOR: 63>, 'ORDER BY': <TokenType.ORDER_BY: 335>, 'ORDINALITY': <TokenType.ORDINALITY: 338>, 'OUT': <TokenType.OUT: 339>, 'OUTER': <TokenType.OUTER: 341>, 'OVER': <TokenType.OVER: 342>, 'OVERLAPS': <TokenType.OVERLAPS: 343>, 'OVERWRITE': <TokenType.OVERWRITE: 344>, 'PARTITION': <TokenType.PARTITION: 345>, 'PARTITION BY': <TokenType.PARTITION_BY: 346>, 'PARTITIONED BY': <TokenType.PARTITION_BY: 346>, 'PARTITIONED_BY': <TokenType.PARTITION_BY: 346>, 'PERCENT': <TokenType.PERCENT: 347>, 'PIVOT': <TokenType.PIVOT: 348>, 'PRAGMA': <TokenType.PRAGMA: 351>, 'PRIMARY KEY': <TokenType.PRIMARY_KEY: 353>, 'PROCEDURE': <TokenType.PROCEDURE: 354>, 'OPERATOR': <TokenType.OPERATOR: 334>, 'QUALIFY': <TokenType.QUALIFY: 358>, 'RANGE': <TokenType.RANGE: 361>, 'RECURSIVE': <TokenType.RECURSIVE: 362>, 'REGEXP': <TokenType.RLIKE: 370>, 'RENAME': <TokenType.RENAME: 364>, 'REPLACE': <TokenType.REPLACE: 365>, 'RETURNING': <TokenType.RETURNING: 366>, 'REFERENCES': <TokenType.REFERENCES: 368>, 'RIGHT': <TokenType.RIGHT: 369>, 'RLIKE': <TokenType.RLIKE: 370>, 'ROLLBACK': <TokenType.ROLLBACK: 371>, 'ROLLUP': <TokenType.ROLLUP: 372>, 'ROW': <TokenType.ROW: 373>, 'ROWS': <TokenType.ROWS: 374>, 'SCHEMA': <TokenType.SCHEMA: 80>, 'SELECT': <TokenType.SELECT: 375>, 'SEMI': <TokenType.SEMI: 376>, 'SESSION': <TokenType.SESSION: 56>, 'SESSION_USER': <TokenType.SESSION_USER: 58>, 'SET': <TokenType.SET: 380>, 'SETTINGS': <TokenType.SETTINGS: 381>, 'SHOW': <TokenType.SHOW: 382>, 'SIMILAR TO': <TokenType.SIMILAR_TO: 383>, 'SOME': <TokenType.SOME: 384>, 'SORT BY': <TokenType.SORT_BY: 385>, 'START WITH': <TokenType.START_WITH: 387>, 'STRAIGHT_JOIN': <TokenType.STRAIGHT_JOIN: 389>, 'TABLE': <TokenType.TABLE: 81>, 'TABLESAMPLE': <TokenType.TABLE_SAMPLE: 392>, 'TEMP': <TokenType.TEMPORARY: 394>, 'TEMPORARY': <TokenType.TEMPORARY: 394>, 'THEN': <TokenType.THEN: 396>, 'TRUE': <TokenType.TRUE: 397>, 'TRUNCATE': <TokenType.TRUNCATE: 398>, 'TRIGGER': <TokenType.TRIGGER: 399>, 'UNION': <TokenType.UNION: 401>, 'UNKNOWN': <TokenType.UNKNOWN: 210>, 'UNNEST': <TokenType.UNNEST: 402>, 'UNPIVOT': <TokenType.UNPIVOT: 403>, 'UPDATE': <TokenType.UPDATE: 404>, 'USE': <TokenType.USE: 405>, 'USING': <TokenType.USING: 406>, 'UUID': <TokenType.UUID: 167>, 'VALUES': <TokenType.VALUES: 407>, 'VIEW': <TokenType.VIEW: 409>, 'VOLATILE': <TokenType.VOLATILE: 411>, 'WHEN': <TokenType.WHEN: 412>, 'WHERE': <TokenType.WHERE: 413>, 'WINDOW': <TokenType.WINDOW: 414>, 'WITH': <TokenType.WITH: 415>, 'APPLY': <TokenType.APPLY: 219>, 'ARRAY': <TokenType.ARRAY: 220>, 'BIT': <TokenType.BIT: 93>, 'BOOL': <TokenType.BOOLEAN: 94>, 'BOOLEAN': <TokenType.BOOLEAN: 94>, 'BYTE': <TokenType.TINYINT: 95>, 'MEDIUMINT': <TokenType.MEDIUMINT: 99>, 'INT1': <TokenType.TINYINT: 95>, 'TINYINT': <TokenType.TINYINT: 95>, 'INT16': <TokenType.SMALLINT: 97>, 'SHORT': <TokenType.SMALLINT: 97>, 'SMALLINT': <TokenType.SMALLINT: 97>, 'HUGEINT': <TokenType.INT128: 106>, 'UHUGEINT': <TokenType.UINT128: 107>, 'INT2': <TokenType.SMALLINT: 97>, 'INTEGER': <TokenType.INT: 101>, 'INT': <TokenType.INT: 101>, 'INT4': <TokenType.INT: 101>, 'INT32': <TokenType.INT: 101>, 'INT64': <TokenType.BIGINT: 103>, 'INT128': <TokenType.INT128: 106>, 'INT256': <TokenType.INT256: 108>, 'LONG': <TokenType.BIGINT: 103>, 'BIGINT': <TokenType.BIGINT: 103>, 'INT8': <TokenType.TINYINT: 95>, 'UINT': <TokenType.UINT: 102>, 'UINT128': <TokenType.UINT128: 107>, 'UINT256': <TokenType.UINT256: 109>, 'DEC': <TokenType.DECIMAL: 113>, 'DECIMAL': <TokenType.DECIMAL: 113>, 'DECIMAL32': <TokenType.DECIMAL32: 114>, 'DECIMAL64': <TokenType.DECIMAL64: 115>, 'DECIMAL128': <TokenType.DECIMAL128: 116>, 'DECIMAL256': <TokenType.DECIMAL256: 117>, 'DECFLOAT': <TokenType.DECFLOAT: 118>, 'BIGDECIMAL': <TokenType.BIGDECIMAL: 120>, 'BIGNUMERIC': <TokenType.BIGDECIMAL: 120>, 'BIGNUM': <TokenType.BIGNUM: 105>, 'LIST': <TokenType.LIST: 314>, 'MAP': <TokenType.MAP: 317>, 'NULLABLE': <TokenType.NULLABLE: 170>, 'NUMBER': <TokenType.DECIMAL: 113>, 'NUMERIC': <TokenType.DECIMAL: 113>, 'FIXED': <TokenType.DECIMAL: 113>, 'REAL': <TokenType.FLOAT: 110>, 'FLOAT': <TokenType.FLOAT: 110>, 'FLOAT4': <TokenType.FLOAT: 110>, 'FLOAT8': <TokenType.DOUBLE: 111>, 'DOUBLE': <TokenType.DOUBLE: 111>, 'DOUBLE PRECISION': <TokenType.DOUBLE: 111>, 'JSON': <TokenType.JSON: 137>, 'JSONB': <TokenType.JSONB: 138>, 'CHAR': <TokenType.CHAR: 121>, 'CHARACTER': <TokenType.CHAR: 121>, 'CHAR VARYING': <TokenType.VARCHAR: 123>, 'CHARACTER VARYING': <TokenType.VARCHAR: 123>, 'NCHAR': <TokenType.NCHAR: 122>, 'VARCHAR': <TokenType.VARCHAR: 123>, 'VARCHAR2': <TokenType.VARCHAR: 123>, 'NVARCHAR': <TokenType.NVARCHAR: 124>, 'NVARCHAR2': <TokenType.NVARCHAR: 124>, 'BPCHAR': <TokenType.BPCHAR: 125>, 'STR': <TokenType.TEXT: 126>, 'STRING': <TokenType.TEXT: 126>, 'TEXT': <TokenType.TEXT: 126>, 'LONGTEXT': <TokenType.LONGTEXT: 128>, 'MEDIUMTEXT': <TokenType.MEDIUMTEXT: 127>, 'TINYTEXT': <TokenType.TINYTEXT: 133>, 'CLOB': <TokenType.TEXT: 126>, 'LONGVARCHAR': <TokenType.TEXT: 126>, 'BINARY': <TokenType.BINARY: 135>, 'BLOB': <TokenType.VARBINARY: 136>, 'LONGBLOB': <TokenType.LONGBLOB: 131>, 'MEDIUMBLOB': <TokenType.MEDIUMBLOB: 130>, 'TINYBLOB': <TokenType.TINYBLOB: 132>, 'BYTEA': <TokenType.VARBINARY: 136>, 'VARBINARY': <TokenType.VARBINARY: 136>, 'TIME': <TokenType.TIME: 139>, 'TIMETZ': <TokenType.TIMETZ: 140>, 'TIME_NS': <TokenType.TIME_NS: 141>, 'TIMESTAMP': <TokenType.TIMESTAMP: 142>, 'TIMESTAMPTZ': <TokenType.TIMESTAMPTZ: 143>, 'TIMESTAMPLTZ': <TokenType.TIMESTAMPLTZ: 144>, 'TIMESTAMP_LTZ': <TokenType.TIMESTAMPLTZ: 144>, 'TIMESTAMPNTZ': <TokenType.TIMESTAMPNTZ: 145>, 'TIMESTAMP_NTZ': <TokenType.TIMESTAMPNTZ: 145>, 'DATE': <TokenType.DATE: 153>, 'DATETIME': <TokenType.DATETIME: 149>, 'INT4RANGE': <TokenType.INT4RANGE: 155>, 'INT4MULTIRANGE': <TokenType.INT4MULTIRANGE: 156>, 'INT8RANGE': <TokenType.INT8RANGE: 157>, 'INT8MULTIRANGE': <TokenType.INT8MULTIRANGE: 158>, 'NUMRANGE': <TokenType.NUMRANGE: 159>, 'NUMMULTIRANGE': <TokenType.NUMMULTIRANGE: 160>, 'TSRANGE': <TokenType.TSRANGE: 161>, 'TSMULTIRANGE': <TokenType.TSMULTIRANGE: 162>, 'TSTZRANGE': <TokenType.TSTZRANGE: 163>, 'TSTZMULTIRANGE': <TokenType.TSTZMULTIRANGE: 164>, 'DATERANGE': <TokenType.DATERANGE: 165>, 'DATEMULTIRANGE': <TokenType.DATEMULTIRANGE: 166>, 'UNIQUE': <TokenType.UNIQUE: 416>, 'VECTOR': <TokenType.VECTOR: 211>, 'STRUCT': <TokenType.STRUCT: 390>, 'SEQUENCE': <TokenType.SEQUENCE: 378>, 'VARIANT': <TokenType.VARIANT: 194>, 'ALTER': <TokenType.ALTER: 215>, 'ANALYZE': <TokenType.ANALYZE: 425>, 'CALL': <TokenType.COMMAND: 233>, 'COMMENT': <TokenType.COMMENT: 234>, 'EXPLAIN': <TokenType.COMMAND: 233>, 'GRANT': <TokenType.GRANT: 284>, 'REVOKE': <TokenType.REVOKE: 367>, 'OPTIMIZE': <TokenType.COMMAND: 233>, 'PREPARE': <TokenType.COMMAND: 233>, 'VACUUM': <TokenType.COMMAND: 233>, 'USER-DEFINED': <TokenType.USERDEFINED: 189>, 'FOR VERSION': <TokenType.VERSION_SNAPSHOT: 420>, 'FOR TIMESTAMP': <TokenType.TIMESTAMP_SNAPSHOT: 421>, 'USER': <TokenType.CURRENT_USER: 247>, 'ENDIF': <TokenType.END: 262>, 'LONG VARCHAR': <TokenType.TEXT: 126>, 'SEPARATOR': <TokenType.SEPARATOR: 377>, 'SYSTIMESTAMP': <TokenType.SYSTIMESTAMP: 177>}
Inherited Members
- sqlglot.tokens.Tokenizer
- Tokenizer
- SINGLE_TOKENS
- BIT_STRINGS
- BYTE_STRINGS
- HEX_STRINGS
- RAW_STRINGS
- HEREDOC_STRINGS
- UNICODE_STRINGS
- QUOTES
- STRING_ESCAPES
- VAR_SINGLE_TOKENS
- ESCAPE_FOLLOW_CHARS
- IDENTIFIER_ESCAPES
- HEREDOC_TAG_IS_IDENTIFIER
- HEREDOC_STRING_ALTERNATIVE
- STRING_ESCAPES_ALLOWED_IN_RAW_STRINGS
- NESTED_COMMENTS
- HINT_START
- TOKENS_PRECEDING_HINT
- COMMANDS
- COMMAND_PREFIX_TOKENS
- NUMERIC_LITERALS
- COMMENTS
- dialect
- tokenize
- sql
- size
- tokens
307 class Parser(parser.Parser): 308 FUNCTIONS = { 309 **parser.Parser.FUNCTIONS, 310 **{ 311 f"ADD_{unit}S": build_date_delta(exp.DateAdd, default_unit=unit) 312 for unit in DATE_UNITS 313 }, 314 **{ 315 f"{unit}S_BETWEEN": build_date_delta(exp.DateDiff, default_unit=unit) 316 for unit in DATE_UNITS 317 }, 318 "APPROXIMATE_COUNT_DISTINCT": exp.ApproxDistinct.from_arg_list, 319 "BIT_AND": binary_from_function(exp.BitwiseAnd), 320 "BIT_OR": binary_from_function(exp.BitwiseOr), 321 "BIT_XOR": binary_from_function(exp.BitwiseXor), 322 "BIT_NOT": lambda args: exp.BitwiseNot(this=seq_get(args, 0)), 323 "BIT_LSHIFT": binary_from_function(exp.BitwiseLeftShift), 324 "BIT_RSHIFT": binary_from_function(exp.BitwiseRightShift), 325 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/convert_tz.htm 326 "CONVERT_TZ": lambda args: exp.ConvertTimezone( 327 source_tz=seq_get(args, 1), 328 target_tz=seq_get(args, 2), 329 timestamp=seq_get(args, 0), 330 options=seq_get(args, 3), 331 ), 332 "CURDATE": exp.CurrentDate.from_arg_list, 333 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/date_trunc.htm#DATE_TRUNC 334 "DATE_TRUNC": lambda args: exp.TimestampTrunc( 335 this=seq_get(args, 1), unit=seq_get(args, 0) 336 ), 337 "DIV": binary_from_function(exp.IntDiv), 338 "EVERY": lambda args: exp.All(this=seq_get(args, 0)), 339 "EDIT_DISTANCE": exp.Levenshtein.from_arg_list, 340 "HASH_SHA": exp.SHA.from_arg_list, 341 "HASH_SHA1": exp.SHA.from_arg_list, 342 "HASH_MD5": exp.MD5.from_arg_list, 343 "HASHTYPE_MD5": exp.MD5Digest.from_arg_list, 344 "HASH_SHA256": lambda args: exp.SHA2( 345 this=seq_get(args, 0), length=exp.Literal.number(256) 346 ), 347 "HASH_SHA512": lambda args: exp.SHA2( 348 this=seq_get(args, 0), length=exp.Literal.number(512) 349 ), 350 "NOW": exp.CurrentTimestamp.from_arg_list, 351 "NULLIFZERO": _build_nullifzero, 352 "REGEXP_SUBSTR": exp.RegexpExtract.from_arg_list, 353 "REGEXP_REPLACE": lambda args: exp.RegexpReplace( 354 this=seq_get(args, 0), 355 expression=seq_get(args, 1), 356 replacement=seq_get(args, 2), 357 position=seq_get(args, 3), 358 occurrence=seq_get(args, 4), 359 ), 360 "TRUNC": build_trunc, 361 "TRUNCATE": build_trunc, 362 "TO_CHAR": build_timetostr_or_tochar, 363 "TO_DATE": build_formatted_time(exp.TsOrDsToDate, "exasol"), 364 "USER": exp.CurrentUser.from_arg_list, 365 "VAR_POP": exp.VariancePop.from_arg_list, 366 "ZEROIFNULL": _build_zeroifnull, 367 } 368 CONSTRAINT_PARSERS = { 369 **parser.Parser.CONSTRAINT_PARSERS, 370 "COMMENT": lambda self: self.expression( 371 exp.CommentColumnConstraint, 372 this=self._match(TokenType.IS) and self._parse_string(), 373 ), 374 } 375 376 FUNC_TOKENS = { 377 *parser.Parser.FUNC_TOKENS, 378 TokenType.SYSTIMESTAMP, 379 } 380 381 NO_PAREN_FUNCTIONS = { 382 **parser.Parser.NO_PAREN_FUNCTIONS, 383 TokenType.SYSTIMESTAMP: exp.Systimestamp, 384 TokenType.CURRENT_SCHEMA: exp.CurrentSchema, 385 } 386 387 FUNCTION_PARSERS = { 388 **parser.Parser.FUNCTION_PARSERS, 389 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/listagg.htm 390 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/group_concat.htm 391 **dict.fromkeys(("GROUP_CONCAT", "LISTAGG"), lambda self: self._parse_group_concat()), 392 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/json_value.htm 393 "JSON_VALUE": lambda self: self._parse_json_value(), 394 } 395 396 def _parse_column(self) -> t.Optional[exp.Expression]: 397 column = super()._parse_column() 398 if not isinstance(column, exp.Column): 399 return column 400 table_ident = column.args.get("table") 401 if ( 402 isinstance(table_ident, exp.Identifier) 403 and table_ident.name.upper() == "LOCAL" 404 and not bool(table_ident.args.get("quoted")) 405 ): 406 column.set("table", None) 407 return column 408 409 ODBC_DATETIME_LITERALS = { 410 "d": exp.Date, 411 "ts": exp.Timestamp, 412 }
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': <function build_date_delta.<locals>._builder>, 'AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.And'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnonymousAggFunc'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.AnyValue'>>, 'APPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Apply'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'APPROX_PERCENTILE_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileAccumulate'>>, 'APPROX_PERCENTILE_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileCombine'>>, 'APPROX_PERCENTILE_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxPercentileEstimate'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantile'>>, 'APPROX_QUANTILES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxQuantiles'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopK'>>, 'APPROX_TOP_K_ACCUMULATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKAccumulate'>>, 'APPROX_TOP_K_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKCombine'>>, 'APPROX_TOP_K_ESTIMATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopKEstimate'>>, 'APPROX_TOP_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxTopSum'>>, 'APPROXIMATE_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, 'APPROXIMATE_JACCARD_INDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproximateSimilarity'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARGMAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'MAX_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMax'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARGMIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'MIN_BY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArgMin'>>, 'ARRAY': <function Parser.<lambda>>, 'ARRAY_AGG': <function Parser.<lambda>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAll'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayAny'>>, 'ARRAY_APPEND': <function build_array_append>, 'ARRAY_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayCompact'>>, 'ARRAY_CONCAT': <function build_array_concat>, 'ARRAY_CAT': <function build_array_concat>, 'ARRAY_CONCAT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConcatAgg'>>, 'ARRAY_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayConstructCompact'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_HAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContains'>>, 'ARRAY_CONTAINS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_HAS_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayContainsAll'>>, 'ARRAY_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayDistinct'>>, 'ARRAY_EXCEPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayExcept'>>, 'FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFilter'>>, 'ARRAY_FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayFirst'>>, 'ARRAY_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayInsert'>>, 'ARRAY_INTERSECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_INTERSECTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayIntersect'>>, 'ARRAY_LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayLast'>>, 'ARRAY_MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayMax'>>, 'ARRAY_MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayMin'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayOverlaps'>>, 'ARRAY_PREPEND': <function build_array_prepend>, 'ARRAY_REMOVE': <function build_array_remove>, 'ARRAY_REMOVE_AT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayRemoveAt'>>, 'ARRAY_REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayReverse'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySize'>>, 'ARRAY_SLICE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySlice'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySort'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraySum'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayToString'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUnionAgg'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArrayUniqueAgg'>>, 'ARRAYS_ZIP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ArraysZip'>>, 'ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ascii'>>, 'ASIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asin'>>, 'ASINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Asinh'>>, 'ATAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan'>>, 'ATAN2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atan2'>>, 'ATANH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Atanh'>>, 'AVG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Avg'>>, 'BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeBinary'>>, 'BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64DecodeString'>>, 'BASE64_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Base64Encode'>>, 'BIT_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitLength'>>, 'BITMAP_BIT_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBitPosition'>>, 'BITMAP_BUCKET_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapBucketNumber'>>, 'BITMAP_CONSTRUCT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapConstructAgg'>>, 'BITMAP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapCount'>>, 'BITMAP_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitmapOrAgg'>>, 'BITWISE_AND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseAndAgg'>>, 'BITWISE_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseCount'>>, 'BITWISE_OR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseOrAgg'>>, 'BITWISE_XOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BitwiseXorAgg'>>, 'BOOLAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Booland'>>, 'BOOLNOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolnot'>>, 'BOOLOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Boolor'>>, 'BOOLXOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.BoolxorAgg'>>, 'BYTE_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ByteLength'>>, 'CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Case'>>, 'CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cast'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CastToStrType'>>, 'CBRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cbrt'>>, 'CEIL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CEILING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ceil'>>, 'CHECK_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckJson'>>, 'CHECK_XML': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CheckXml'>>, 'CHR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'CHAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Chr'>>, 'COALESCE': <function build_coalesce>, 'IFNULL': <function build_coalesce>, 'NVL': <function build_coalesce>, 'CODE_POINTS_TO_BYTES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToBytes'>>, 'CODE_POINTS_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CodePointsToString'>>, 'COLLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collate'>>, 'COLLATION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Collation'>>, 'COLUMNS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Columns'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedAggFunc'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CombinedParameterizedAgg'>>, 'COMPRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Compress'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConnectByRoot'>>, 'CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Contains'>>, 'CONVERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Convert'>>, 'CONVERT_TIMEZONE': <function build_convert_timezone>, 'CONVERT_TO_CHARSET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ConvertToCharset'>>, 'CORR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Corr'>>, 'COS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cos'>>, 'COSH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cosh'>>, 'COSINE_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CosineDistance'>>, 'COT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Cot'>>, 'COTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Coth'>>, 'COUNT': <function Parser.<lambda>>, 'COUNT_IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COUNTIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CountIf'>>, 'COVAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarPop'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CovarSamp'>>, 'CSC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csc'>>, 'CSCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Csch'>>, 'CUME_DIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CumeDist'>>, 'CURRENT_ACCOUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccount'>>, 'CURRENT_ACCOUNT_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAccountName'>>, 'CURRENT_AVAILABLE_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentAvailableRoles'>>, 'CURRENT_CATALOG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentCatalog'>>, 'CURRENT_CLIENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentClient'>>, 'CURRENT_DATABASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatabase'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDatetime'>>, 'CURRENT_IP_ADDRESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentIpAddress'>>, 'CURRENT_ORGANIZATION_NAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationName'>>, 'CURRENT_ORGANIZATION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentOrganizationUser'>>, 'CURRENT_REGION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRegion'>>, 'CURRENT_ROLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRole'>>, 'CURRENT_ROLE_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentRoleType'>>, 'CURRENT_SCHEMA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchema'>>, 'CURRENT_SCHEMAS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSchemas'>>, 'CURRENT_SECONDARY_ROLES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSecondaryRoles'>>, 'CURRENT_SESSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentSession'>>, 'CURRENT_STATEMENT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentStatement'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTime'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'CURRENT_TIMESTAMP_L_T_Z': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestampLTZ'>>, 'CURRENT_TIMEZONE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimezone'>>, 'CURRENT_TRANSACTION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTransaction'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'CURRENT_VERSION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentVersion'>>, 'CURRENT_WAREHOUSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentWarehouse'>>, 'DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Date'>>, 'DATE_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateAdd'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateSub'>>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DateToDi'>>, 'DATE_TRUNC': <function Exasol.Parser.<lambda>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Day'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfMonth'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfWeek'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DayOfYear'>>, 'DAYNAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Dayname'>>, 'DECODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decode'>>, 'DECODE_CASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecodeCase'>>, 'DECOMPRESS_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressBinary'>>, 'DECOMPRESS_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecompressString'>>, 'DECRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Decrypt'>>, 'DECRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DecryptRaw'>>, 'DEGREES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Degrees'>>, 'DENSE_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DenseRank'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DiToDate'>>, 'DOT_PRODUCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.DotProduct'>>, 'ELT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Elt'>>, 'ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encode'>>, 'ENCRYPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Encrypt'>>, 'ENCRYPT_RAW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EncryptRaw'>>, 'ENDS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'ENDSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EndsWith'>>, 'EQUAL_NULL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EqualNull'>>, 'EUCLIDEAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.EuclideanDistance'>>, 'EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exists'>>, 'EXP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Exp'>>, 'EXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Explode'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodeOuter'>>, 'EXPLODING_GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ExplodingGenerateSeries'>>, 'EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Extract'>>, 'FACTORIAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Factorial'>>, 'FARM_FINGERPRINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FARMFINGERPRINT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FarmFingerprint'>>, 'FEATURES_AT_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FeaturesAtTime'>>, 'FIRST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.First'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FirstValue'>>, 'FLATTEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Flatten'>>, 'FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Float64'>>, 'FLOOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Floor'>>, 'FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Format'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase'>>, 'FROM_BASE32': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase32'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromBase64'>>, 'FROM_ISO8601_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.FromISO8601Timestamp'>>, 'GAP_FILL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GapFill'>>, 'GENERATE_DATE_ARRAY': <function Parser.<lambda>>, 'GENERATE_EMBEDDING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateEmbedding'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateSeries'>>, 'GENERATE_TIMESTAMP_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GenerateTimestampArray'>>, 'GENERATOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Generator'>>, 'GET_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GetExtract'>>, 'GETBIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GET_BIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Getbit'>>, 'GREATEST': <function Parser.<lambda>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupConcat'>>, 'GROUPING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Grouping'>>, 'GROUPING_ID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.GroupingId'>>, 'HASH_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HashAgg'>>, 'HEX': <function build_hex>, 'HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexDecodeString'>>, 'HEX_ENCODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.HexEncode'>>, 'HLL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hll'>>, 'HOST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Host'>>, 'HOUR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Hour'>>, 'IF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'IIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.If'>>, 'INITCAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Initcap'>>, 'INLINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Inline'>>, 'INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Int64'>>, 'IS_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsArray'>>, 'IS_ASCII': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsAscii'>>, 'IS_INF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'ISINF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsInf'>>, 'IS_NAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'ISNAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNan'>>, 'IS_NULL_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.IsNullValue'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArray'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAgg'>>, 'JSON_ARRAY_APPEND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayAppend'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayContains'>>, 'JSON_ARRAY_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONArrayInsert'>>, 'JSONB_CONTAINS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContains'>>, 'J_S_O_N_B_CONTAINS_ALL_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>>, 'J_S_O_N_B_CONTAINS_ANY_TOP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBContainsAnyTopKeys'>>, 'J_S_O_N_B_DELETE_AT_PATH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBDeleteAtPath'>>, 'JSONB_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExists'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtract'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBExtractScalar'>>, 'J_S_O_N_B_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBObjectAgg'>>, 'J_S_O_N_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONBool'>>, 'J_S_O_N_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONCast'>>, 'J_S_O_N_EXISTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExists'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONExtractArray'>>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONFormat'>>, 'JSON_KEYS': <function Parser.<lambda>>, 'J_S_O_N_KEYS_AT_DEPTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONKeysAtDepth'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObject'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONObjectAgg'>>, 'JSON_REMOVE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONRemove'>>, 'JSON_SET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONSet'>>, 'JSON_STRIP_NULLS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONStripNulls'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONTable'>>, 'JSON_TYPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONType'>>, 'J_S_O_N_VALUE_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JSONValueArray'>>, 'JAROWINKLER_SIMILARITY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JarowinklerSimilarity'>>, 'JUSTIFY_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyDays'>>, 'JUSTIFY_HOURS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyHours'>>, 'JUSTIFY_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.JustifyInterval'>>, 'KURTOSIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Kurtosis'>>, 'LAG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lag'>>, 'LAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Last'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastDay'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LastValue'>>, 'LAX_BOOL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxBool'>>, 'LAX_FLOAT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxFloat64'>>, 'LAX_INT64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxInt64'>>, 'LAX_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LaxString'>>, 'LEAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lead'>>, 'LEAST': <function Parser.<lambda>>, 'LEFT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Left'>>, 'LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHAR_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'CHARACTER_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Length'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'LIST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.List'>>, 'LN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ln'>>, 'LOCALTIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtime'>>, 'LOCALTIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Localtimestamp'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalAnd'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LogicalOr'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Lower'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.LowerHex'>>, 'MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'M_D5_NUMBER_LOWER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberLower64'>>, 'M_D5_NUMBER_UPPER64': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5NumberUpper64'>>, 'M_L_FORECAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLForecast'>>, 'M_L_TRANSLATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MLTranslate'>>, 'MAKE_INTERVAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MakeInterval'>>, 'MANHATTAN_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ManhattanDistance'>>, 'MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Map'>>, 'MAP_CAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapCat'>>, 'MAP_CONTAINS_KEY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapContainsKey'>>, 'MAP_DELETE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapDelete'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapFromEntries'>>, 'MAP_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapInsert'>>, 'MAP_KEYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapKeys'>>, 'MAP_PICK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapPick'>>, 'MAP_SIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MapSize'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MatchAgainst'>>, 'MAX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Max'>>, 'MEDIAN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Median'>>, 'MIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Min'>>, 'MINHASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Minhash'>>, 'MINHASH_COMBINE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MinhashCombine'>>, 'MINUTE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Minute'>>, 'MODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Mode'>>, 'MONTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Month'>>, 'MONTHNAME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Monthname'>>, 'MONTHS_BETWEEN': <function build_date_delta.<locals>._builder>, 'NET_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NetFunc'>>, 'NEXT_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextDay'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NextValueFor'>>, 'NORMAL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normal'>>, 'NORMALIZE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Normalize'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NthValue'>>, 'NTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Ntile'>>, 'NULLIF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nullif'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.NumberToStr'>>, 'NVL2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Nvl2'>>, 'OBJECT_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectAgg'>>, 'OBJECT_ID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectId'>>, 'OBJECT_INSERT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ObjectInsert'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.OpenJSON'>>, 'OR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Or'>>, 'OVERLAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Overlay'>>, 'PAD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pad'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParameterizedAgg'>>, 'PARSE_BIGNUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseBignumeric'>>, 'PARSE_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseDatetime'>>, 'PARSE_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseIp'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseJSON'>>, 'PARSE_NUMERIC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseNumeric'>>, 'PARSE_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseTime'>>, 'PARSE_URL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ParseUrl'>>, 'PERCENT_RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentRank'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileCont'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PercentileDisc'>>, 'PI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pi'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Posexplode'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PosexplodeOuter'>>, 'POWER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'POW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Pow'>>, 'PREDICT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Predict'>>, 'PREVIOUS_DAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.PreviousDay'>>, 'QUANTILE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quantile'>>, 'QUARTER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Quarter'>>, 'RADIANS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Radians'>>, 'RAND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDOM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rand'>>, 'RANDN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randn'>>, 'RANDSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Randstr'>>, 'RANGE_BUCKET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeBucket'>>, 'RANGE_N': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RangeN'>>, 'RANK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Rank'>>, 'READ_CSV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadCSV'>>, 'READ_PARQUET': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ReadParquet'>>, 'REDUCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reduce'>>, 'REG_DOMAIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegDomain'>>, 'REGEXP_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpCount'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'REGEXP_EXTRACT_ALL': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtractAll'>>, 'REGEXP_FULL_MATCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpFullMatch'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpILike'>>, 'REGEXP_INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpInstr'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpLike'>>, 'REGEXP_REPLACE': <function Exasol.Parser.<lambda>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpSplit'>>, 'REGR_AVGX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgx'>>, 'REGR_AVGY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrAvgy'>>, 'REGR_COUNT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrCount'>>, 'REGR_INTERCEPT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrIntercept'>>, 'REGR_R2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrR2'>>, 'REGR_SLOPE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSlope'>>, 'REGR_SXX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxx'>>, 'REGR_SXY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSxy'>>, 'REGR_SYY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrSyy'>>, 'REGR_VALX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValx'>>, 'REGR_VALY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegrValy'>>, 'REPEAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Repeat'>>, 'REPLACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Replace'>>, 'REVERSE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Reverse'>>, 'RIGHT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Right'>>, 'ROUND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Round'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RowNumber'>>, 'RTRIMMED_LENGTH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RtrimmedLength'>>, 'SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'S_H_A1_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA1Digest'>>, 'SHA2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2'>>, 'S_H_A2_DIGEST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA2Digest'>>, 'SAFE_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeAdd'>>, 'SAFE_CONVERT_BYTES_TO_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeConvertBytesToString'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeDivide'>>, 'SAFE_FUNC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeFunc'>>, 'SAFE_MULTIPLY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeMultiply'>>, 'SAFE_NEGATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeNegate'>>, 'SAFE_SUBTRACT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SafeSubtract'>>, 'SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Search'>>, 'SEARCH_IP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SearchIp'>>, 'SEC': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sec'>>, 'SECH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sech'>>, 'SECOND': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Second'>>, 'SEQ1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq1'>>, 'SEQ2': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq2'>>, 'SEQ4': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq4'>>, 'SEQ8': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Seq8'>>, 'SESSION_USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SessionUser'>>, 'SIGN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIGNUM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sign'>>, 'SIN': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sin'>>, 'SINH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sinh'>>, 'SKEWNESS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Skewness'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SortArray'>>, 'SOUNDEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Soundex'>>, 'SOUNDEX_P123': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SoundexP123'>>, 'SPACE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Space'>>, 'SPLIT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Split'>>, 'SPLIT_PART': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SplitPart'>>, 'SQRT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Sqrt'>>, 'ST_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StDistance'>>, 'ST_POINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'ST_MAKEPOINT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StPoint'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StandardHash'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StarMap'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StartsWith'>>, 'STDDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDEV': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Stddev'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevPop'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StddevSamp'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'STR_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrToDate'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TimestampDiff'>>, '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_timetostr_or_tochar>, 'TO_CODE_POINTS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToCodePoints'>>, 'TO_DAYS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ToDays'>>, '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'>>, 'TRUNC': <function build_trunc>, 'TRUNCATE': <function build_trunc>, 'TRY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Try'>>, 'TRY_BASE64_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeBinary'>>, 'TRY_BASE64_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryBase64DecodeString'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryCast'>>, 'TRY_HEX_DECODE_BINARY': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeBinary'>>, 'TRY_HEX_DECODE_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryHexDecodeString'>>, 'TRY_TO_DECFLOAT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TryToDecfloat'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDiToDi'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsAdd'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsDiff'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDate'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_DATETIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToDatetime'>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTime'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.TsOrDsToTimestamp'>>, 'TYPEOF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Typeof'>>, 'UNHEX': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unhex'>>, 'UNICODE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Unicode'>>, 'UNIFORM': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uniform'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixDate'>>, 'UNIX_MICROS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMicros'>>, 'UNIX_MILLIS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixMillis'>>, 'UNIX_SECONDS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixSeconds'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToStr'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTime'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UnixToTimeStr'>>, 'UNNEST': <function Parser.<lambda>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Upper'>>, 'UTC_DATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcDate'>>, 'UTC_TIME': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTime'>>, 'UTC_TIMESTAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.UtcTimestamp'>>, 'UUID': <function Parser.<lambda>>, 'GEN_RANDOM_UUID': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'GENERATE_UUID': <function Parser.<lambda>>, 'UUID_STRING': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Uuid'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Variance'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VAR_POP': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VariancePop'>>, 'VECTOR_SEARCH': <bound method Func.from_arg_list of <class 'sqlglot.expressions.VectorSearch'>>, 'WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Week'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.WeekOfYear'>>, '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': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Year'>>, 'YEAR_OF_WEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAROFWEEK': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeek'>>, 'YEAR_OF_WEEK_ISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'YEAROFWEEKISO': <bound method Func.from_arg_list of <class 'sqlglot.expressions.YearOfWeekIso'>>, 'ZIPF': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Zipf'>>, 'ARRAYAGG': <function Parser.<lambda>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_extract_json_with_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'LPAD': <function Parser.<lambda>>, 'LEFTPAD': <function Parser.<lambda>>, 'LTRIM': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'RIGHTPAD': <function Parser.<lambda>>, 'RPAD': <function Parser.<lambda>>, 'RTRIM': <function Parser.<lambda>>, 'SCOPE_RESOLUTION': <function Parser.<lambda>>, 'STRPOS': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'CHARINDEX': <function Parser.<lambda>>, 'INSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.StrPosition'>>, 'LOCATE': <function Parser.<lambda>>, 'TO_HEX': <function build_hex>, 'ADD_MINUTES': <function build_date_delta.<locals>._builder>, 'ADD_YEARS': <function build_date_delta.<locals>._builder>, 'ADD_HOURS': <function build_date_delta.<locals>._builder>, 'ADD_DAYS': <function build_date_delta.<locals>._builder>, 'ADD_SECONDS': <function build_date_delta.<locals>._builder>, 'ADD_WEEKS': <function build_date_delta.<locals>._builder>, 'MINUTES_BETWEEN': <function build_date_delta.<locals>._builder>, 'YEARS_BETWEEN': <function build_date_delta.<locals>._builder>, 'HOURS_BETWEEN': <function build_date_delta.<locals>._builder>, 'DAYS_BETWEEN': <function build_date_delta.<locals>._builder>, 'SECONDS_BETWEEN': <function build_date_delta.<locals>._builder>, 'WEEKS_BETWEEN': <function build_date_delta.<locals>._builder>, 'APPROXIMATE_COUNT_DISTINCT': <bound method Func.from_arg_list of <class 'sqlglot.expressions.ApproxDistinct'>>, 'BIT_AND': <function binary_from_function.<locals>.<lambda>>, 'BIT_OR': <function binary_from_function.<locals>.<lambda>>, 'BIT_XOR': <function binary_from_function.<locals>.<lambda>>, 'BIT_NOT': <function Exasol.Parser.<lambda>>, 'BIT_LSHIFT': <function binary_from_function.<locals>.<lambda>>, 'BIT_RSHIFT': <function binary_from_function.<locals>.<lambda>>, 'CONVERT_TZ': <function Exasol.Parser.<lambda>>, 'CURDATE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentDate'>>, 'DIV': <function binary_from_function.<locals>.<lambda>>, 'EVERY': <function Exasol.Parser.<lambda>>, 'EDIT_DISTANCE': <bound method Func.from_arg_list of <class 'sqlglot.expressions.Levenshtein'>>, 'HASH_SHA': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'HASH_SHA1': <bound method Func.from_arg_list of <class 'sqlglot.expressions.SHA'>>, 'HASH_MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5'>>, 'HASHTYPE_MD5': <bound method Func.from_arg_list of <class 'sqlglot.expressions.MD5Digest'>>, 'HASH_SHA256': <function Exasol.Parser.<lambda>>, 'HASH_SHA512': <function Exasol.Parser.<lambda>>, 'NOW': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentTimestamp'>>, 'NULLIFZERO': <function _build_nullifzero>, 'REGEXP_SUBSTR': <bound method Func.from_arg_list of <class 'sqlglot.expressions.RegexpExtract'>>, 'TO_DATE': <function build_formatted_time.<locals>._builder>, 'USER': <bound method Func.from_arg_list of <class 'sqlglot.expressions.CurrentUser'>>, 'ZEROIFNULL': <function _build_zeroifnull>}
CONSTRAINT_PARSERS =
{'AUTOINCREMENT': <function Parser.<lambda>>, 'AUTO_INCREMENT': <function Parser.<lambda>>, 'CASESPECIFIC': <function Parser.<lambda>>, 'CHARACTER SET': <function Parser.<lambda>>, 'CHECK': <function Parser.<lambda>>, 'COLLATE': <function Parser.<lambda>>, 'COMMENT': <function Exasol.Parser.<lambda>>, 'COMPRESS': <function Parser.<lambda>>, 'CLUSTERED': <function Parser.<lambda>>, 'NONCLUSTERED': <function Parser.<lambda>>, 'DEFAULT': <function Parser.<lambda>>, 'ENCODE': <function Parser.<lambda>>, 'EPHEMERAL': <function Parser.<lambda>>, 'EXCLUDE': <function Parser.<lambda>>, 'FOREIGN KEY': <function Parser.<lambda>>, 'FORMAT': <function Parser.<lambda>>, 'GENERATED': <function Parser.<lambda>>, 'IDENTITY': <function Parser.<lambda>>, 'INLINE': <function Parser.<lambda>>, 'LIKE': <function Parser.<lambda>>, 'NOT': <function Parser.<lambda>>, 'NULL': <function Parser.<lambda>>, 'ON': <function Parser.<lambda>>, 'PATH': <function Parser.<lambda>>, 'PERIOD': <function Parser.<lambda>>, 'PRIMARY KEY': <function Parser.<lambda>>, 'REFERENCES': <function Parser.<lambda>>, 'TITLE': <function Parser.<lambda>>, 'TTL': <function Parser.<lambda>>, 'UNIQUE': <function Parser.<lambda>>, 'UPPERCASE': <function Parser.<lambda>>, 'WITH': <function Parser.<lambda>>, 'BUCKET': <function Parser.<lambda>>, 'TRUNCATE': <function Parser.<lambda>>}
FUNC_TOKENS =
{<TokenType.SESSION_USER: 58>, <TokenType.XOR: 63>, <TokenType.IDENTIFIER: 76>, <TokenType.TABLE: 81>, <TokenType.VAR: 85>, <TokenType.BIT: 93>, <TokenType.BOOLEAN: 94>, <TokenType.TINYINT: 95>, <TokenType.UTINYINT: 96>, <TokenType.SMALLINT: 97>, <TokenType.USMALLINT: 98>, <TokenType.MEDIUMINT: 99>, <TokenType.UMEDIUMINT: 100>, <TokenType.INT: 101>, <TokenType.UINT: 102>, <TokenType.BIGINT: 103>, <TokenType.UBIGINT: 104>, <TokenType.BIGNUM: 105>, <TokenType.INT128: 106>, <TokenType.UINT128: 107>, <TokenType.INT256: 108>, <TokenType.UINT256: 109>, <TokenType.FLOAT: 110>, <TokenType.DOUBLE: 111>, <TokenType.UDOUBLE: 112>, <TokenType.DECIMAL: 113>, <TokenType.DECIMAL32: 114>, <TokenType.DECIMAL64: 115>, <TokenType.DECIMAL128: 116>, <TokenType.DECIMAL256: 117>, <TokenType.DECFLOAT: 118>, <TokenType.UDECIMAL: 119>, <TokenType.BIGDECIMAL: 120>, <TokenType.CHAR: 121>, <TokenType.NCHAR: 122>, <TokenType.VARCHAR: 123>, <TokenType.NVARCHAR: 124>, <TokenType.BPCHAR: 125>, <TokenType.TEXT: 126>, <TokenType.MEDIUMTEXT: 127>, <TokenType.LONGTEXT: 128>, <TokenType.BLOB: 129>, <TokenType.MEDIUMBLOB: 130>, <TokenType.LONGBLOB: 131>, <TokenType.TINYBLOB: 132>, <TokenType.TINYTEXT: 133>, <TokenType.NAME: 134>, <TokenType.BINARY: 135>, <TokenType.VARBINARY: 136>, <TokenType.JSON: 137>, <TokenType.JSONB: 138>, <TokenType.TIME: 139>, <TokenType.TIMETZ: 140>, <TokenType.TIME_NS: 141>, <TokenType.TIMESTAMP: 142>, <TokenType.TIMESTAMPTZ: 143>, <TokenType.TIMESTAMPLTZ: 144>, <TokenType.TIMESTAMPNTZ: 145>, <TokenType.TIMESTAMP_S: 146>, <TokenType.TIMESTAMP_MS: 147>, <TokenType.TIMESTAMP_NS: 148>, <TokenType.DATETIME: 149>, <TokenType.DATETIME2: 150>, <TokenType.DATETIME64: 151>, <TokenType.SMALLDATETIME: 152>, <TokenType.DATE: 153>, <TokenType.DATE32: 154>, <TokenType.INT4RANGE: 155>, <TokenType.INT4MULTIRANGE: 156>, <TokenType.INT8RANGE: 157>, <TokenType.INT8MULTIRANGE: 158>, <TokenType.NUMRANGE: 159>, <TokenType.NUMMULTIRANGE: 160>, <TokenType.TSRANGE: 161>, <TokenType.TSMULTIRANGE: 162>, <TokenType.TSTZRANGE: 163>, <TokenType.TSTZMULTIRANGE: 164>, <TokenType.DATERANGE: 165>, <TokenType.DATEMULTIRANGE: 166>, <TokenType.UUID: 167>, <TokenType.GEOGRAPHY: 168>, <TokenType.GEOGRAPHYPOINT: 169>, <TokenType.NULLABLE: 170>, <TokenType.GEOMETRY: 171>, <TokenType.POINT: 172>, <TokenType.RING: 173>, <TokenType.LINESTRING: 174>, <TokenType.LOCALTIME: 175>, <TokenType.LOCALTIMESTAMP: 176>, <TokenType.SYSTIMESTAMP: 177>, <TokenType.MULTILINESTRING: 178>, <TokenType.POLYGON: 179>, <TokenType.MULTIPOLYGON: 180>, <TokenType.HLLSKETCH: 181>, <TokenType.HSTORE: 182>, <TokenType.SUPER: 183>, <TokenType.SERIAL: 184>, <TokenType.SMALLSERIAL: 185>, <TokenType.BIGSERIAL: 186>, <TokenType.XML: 187>, <TokenType.YEAR: 188>, <TokenType.USERDEFINED: 189>, <TokenType.MONEY: 190>, <TokenType.SMALLMONEY: 191>, <TokenType.ROWVERSION: 192>, <TokenType.IMAGE: 193>, <TokenType.VARIANT: 194>, <TokenType.OBJECT: 195>, <TokenType.INET: 196>, <TokenType.IPADDRESS: 197>, <TokenType.IPPREFIX: 198>, <TokenType.IPV4: 199>, <TokenType.IPV6: 200>, <TokenType.ENUM: 201>, <TokenType.ENUM8: 202>, <TokenType.ENUM16: 203>, <TokenType.FIXEDSTRING: 204>, <TokenType.LOWCARDINALITY: 205>, <TokenType.NESTED: 206>, <TokenType.AGGREGATEFUNCTION: 207>, <TokenType.SIMPLEAGGREGATEFUNCTION: 208>, <TokenType.TDIGEST: 209>, <TokenType.UNKNOWN: 210>, <TokenType.VECTOR: 211>, <TokenType.DYNAMIC: 212>, <TokenType.VOID: 213>, <TokenType.ALL: 216>, <TokenType.ANY: 218>, <TokenType.ARRAY: 220>, <TokenType.COLLATE: 232>, <TokenType.COMMAND: 233>, <TokenType.CURRENT_DATE: 242>, <TokenType.CURRENT_DATETIME: 243>, <TokenType.CURRENT_SCHEMA: 244>, <TokenType.CURRENT_TIME: 245>, <TokenType.CURRENT_TIMESTAMP: 246>, <TokenType.CURRENT_USER: 247>, <TokenType.CURRENT_CATALOG: 249>, <TokenType.EXISTS: 266>, <TokenType.FILE: 269>, <TokenType.FILTER: 271>, <TokenType.FIRST: 273>, <TokenType.FORMAT: 277>, <TokenType.GET: 281>, <TokenType.GLOB: 282>, <TokenType.ILIKE: 290>, <TokenType.INDEX: 292>, <TokenType.INSERT: 295>, <TokenType.INTERVAL: 298>, <TokenType.ISNULL: 303>, <TokenType.LEFT: 311>, <TokenType.LIKE: 312>, <TokenType.LIST: 314>, <TokenType.MAP: 317>, <TokenType.MERGE: 322>, <TokenType.NEXT: 326>, <TokenType.NOTHING: 327>, <TokenType.NULL: 329>, <TokenType.OBJECT_IDENTIFIER: 330>, <TokenType.OFFSET: 331>, <TokenType.PRIMARY_KEY: 353>, <TokenType.PSEUDO_TYPE: 356>, <TokenType.RANGE: 361>, <TokenType.REPLACE: 365>, <TokenType.RIGHT: 369>, <TokenType.RLIKE: 370>, <TokenType.ROW: 373>, <TokenType.SEQUENCE: 378>, <TokenType.SOME: 384>, <TokenType.STRUCT: 390>, <TokenType.TRUNCATE: 398>, <TokenType.UNION: 401>, <TokenType.UNNEST: 402>, <TokenType.WINDOW: 414>, <TokenType.UTC_DATE: 417>, <TokenType.UTC_TIME: 418>, <TokenType.UTC_TIMESTAMP: 419>}
NO_PAREN_FUNCTIONS =
{<TokenType.CURRENT_DATE: 242>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_DATETIME: 243>: <class 'sqlglot.expressions.CurrentDate'>, <TokenType.CURRENT_TIME: 245>: <class 'sqlglot.expressions.CurrentTime'>, <TokenType.CURRENT_TIMESTAMP: 246>: <class 'sqlglot.expressions.CurrentTimestamp'>, <TokenType.CURRENT_USER: 247>: <class 'sqlglot.expressions.CurrentUser'>, <TokenType.CURRENT_ROLE: 248>: <class 'sqlglot.expressions.CurrentRole'>, <TokenType.SYSTIMESTAMP: 177>: <class 'sqlglot.expressions.Systimestamp'>, <TokenType.CURRENT_SCHEMA: 244>: <class 'sqlglot.expressions.CurrentSchema'>}
FUNCTION_PARSERS =
{'ARG_MAX': <function Parser.<dictcomp>.<lambda>>, 'ARGMAX': <function Parser.<dictcomp>.<lambda>>, 'MAX_BY': <function Parser.<dictcomp>.<lambda>>, 'ARG_MIN': <function Parser.<dictcomp>.<lambda>>, 'ARGMIN': <function Parser.<dictcomp>.<lambda>>, 'MIN_BY': <function Parser.<dictcomp>.<lambda>>, 'CAST': <function Parser.<lambda>>, 'CEIL': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'CHAR': <function Parser.<lambda>>, 'CHR': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'FLOOR': <function Parser.<lambda>>, 'GAP_FILL': <function Parser.<lambda>>, 'INITCAP': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'MATCH': <function Parser.<lambda>>, 'NORMALIZE': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'OVERLAY': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRIM': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>, 'XMLELEMENT': <function Parser.<lambda>>, 'XMLTABLE': <function Parser.<lambda>>, 'GROUP_CONCAT': <function Exasol.Parser.<lambda>>, 'LISTAGG': <function Exasol.Parser.<lambda>>, 'JSON_VALUE': <function Exasol.Parser.<lambda>>}
ODBC_DATETIME_LITERALS =
{'d': <class 'sqlglot.expressions.Date'>, 'ts': <class 'sqlglot.expressions.Timestamp'>}
ID_VAR_TOKENS =
{<TokenType.SESSION: 56>, <TokenType.SESSION_USER: 58>, <TokenType.IDENTIFIER: 76>, <TokenType.DATABASE: 77>, <TokenType.COLUMN: 78>, <TokenType.SCHEMA: 80>, <TokenType.TABLE: 81>, <TokenType.WAREHOUSE: 82>, <TokenType.STAGE: 83>, <TokenType.STREAMLIT: 84>, <TokenType.VAR: 85>, <TokenType.BIT: 93>, <TokenType.BOOLEAN: 94>, <TokenType.TINYINT: 95>, <TokenType.UTINYINT: 96>, <TokenType.SMALLINT: 97>, <TokenType.USMALLINT: 98>, <TokenType.MEDIUMINT: 99>, <TokenType.UMEDIUMINT: 100>, <TokenType.INT: 101>, <TokenType.UINT: 102>, <TokenType.BIGINT: 103>, <TokenType.UBIGINT: 104>, <TokenType.BIGNUM: 105>, <TokenType.INT128: 106>, <TokenType.UINT128: 107>, <TokenType.INT256: 108>, <TokenType.UINT256: 109>, <TokenType.FLOAT: 110>, <TokenType.DOUBLE: 111>, <TokenType.UDOUBLE: 112>, <TokenType.DECIMAL: 113>, <TokenType.DECIMAL32: 114>, <TokenType.DECIMAL64: 115>, <TokenType.DECIMAL128: 116>, <TokenType.DECIMAL256: 117>, <TokenType.DECFLOAT: 118>, <TokenType.UDECIMAL: 119>, <TokenType.BIGDECIMAL: 120>, <TokenType.CHAR: 121>, <TokenType.NCHAR: 122>, <TokenType.VARCHAR: 123>, <TokenType.NVARCHAR: 124>, <TokenType.BPCHAR: 125>, <TokenType.TEXT: 126>, <TokenType.MEDIUMTEXT: 127>, <TokenType.LONGTEXT: 128>, <TokenType.BLOB: 129>, <TokenType.MEDIUMBLOB: 130>, <TokenType.LONGBLOB: 131>, <TokenType.TINYBLOB: 132>, <TokenType.TINYTEXT: 133>, <TokenType.NAME: 134>, <TokenType.BINARY: 135>, <TokenType.VARBINARY: 136>, <TokenType.JSON: 137>, <TokenType.JSONB: 138>, <TokenType.TIME: 139>, <TokenType.TIMETZ: 140>, <TokenType.TIME_NS: 141>, <TokenType.TIMESTAMP: 142>, <TokenType.TIMESTAMPTZ: 143>, <TokenType.TIMESTAMPLTZ: 144>, <TokenType.TIMESTAMPNTZ: 145>, <TokenType.TIMESTAMP_S: 146>, <TokenType.TIMESTAMP_MS: 147>, <TokenType.TIMESTAMP_NS: 148>, <TokenType.DATETIME: 149>, <TokenType.DATETIME2: 150>, <TokenType.DATETIME64: 151>, <TokenType.SMALLDATETIME: 152>, <TokenType.DATE: 153>, <TokenType.DATE32: 154>, <TokenType.INT4RANGE: 155>, <TokenType.INT4MULTIRANGE: 156>, <TokenType.INT8RANGE: 157>, <TokenType.INT8MULTIRANGE: 158>, <TokenType.NUMRANGE: 159>, <TokenType.NUMMULTIRANGE: 160>, <TokenType.TSRANGE: 161>, <TokenType.TSMULTIRANGE: 162>, <TokenType.TSTZRANGE: 163>, <TokenType.TSTZMULTIRANGE: 164>, <TokenType.DATERANGE: 165>, <TokenType.DATEMULTIRANGE: 166>, <TokenType.UUID: 167>, <TokenType.GEOGRAPHY: 168>, <TokenType.GEOGRAPHYPOINT: 169>, <TokenType.NULLABLE: 170>, <TokenType.GEOMETRY: 171>, <TokenType.POINT: 172>, <TokenType.RING: 173>, <TokenType.LINESTRING: 174>, <TokenType.LOCALTIME: 175>, <TokenType.LOCALTIMESTAMP: 176>, <TokenType.MULTILINESTRING: 178>, <TokenType.POLYGON: 179>, <TokenType.MULTIPOLYGON: 180>, <TokenType.HLLSKETCH: 181>, <TokenType.HSTORE: 182>, <TokenType.SUPER: 183>, <TokenType.SERIAL: 184>, <TokenType.SMALLSERIAL: 185>, <TokenType.BIGSERIAL: 186>, <TokenType.XML: 187>, <TokenType.YEAR: 188>, <TokenType.USERDEFINED: 189>, <TokenType.MONEY: 190>, <TokenType.SMALLMONEY: 191>, <TokenType.ROWVERSION: 192>, <TokenType.IMAGE: 193>, <TokenType.VARIANT: 194>, <TokenType.OBJECT: 195>, <TokenType.INET: 196>, <TokenType.IPADDRESS: 197>, <TokenType.IPPREFIX: 198>, <TokenType.IPV4: 199>, <TokenType.IPV6: 200>, <TokenType.ENUM: 201>, <TokenType.ENUM8: 202>, <TokenType.ENUM16: 203>, <TokenType.FIXEDSTRING: 204>, <TokenType.LOWCARDINALITY: 205>, <TokenType.NESTED: 206>, <TokenType.AGGREGATEFUNCTION: 207>, <TokenType.SIMPLEAGGREGATEFUNCTION: 208>, <TokenType.TDIGEST: 209>, <TokenType.UNKNOWN: 210>, <TokenType.VECTOR: 211>, <TokenType.DYNAMIC: 212>, <TokenType.VOID: 213>, <TokenType.ALL: 216>, <TokenType.ANTI: 217>, <TokenType.ANY: 218>, <TokenType.APPLY: 219>, <TokenType.ARRAY: 220>, <TokenType.ASC: 221>, <TokenType.ASOF: 222>, <TokenType.ATTACH: 223>, <TokenType.AUTO_INCREMENT: 224>, <TokenType.BEGIN: 225>, <TokenType.CACHE: 228>, <TokenType.CASE: 229>, <TokenType.COLLATE: 232>, <TokenType.COMMAND: 233>, <TokenType.COMMENT: 234>, <TokenType.COMMIT: 235>, <TokenType.CONSTRAINT: 237>, <TokenType.COPY: 238>, <TokenType.CUBE: 241>, <TokenType.CURRENT_DATE: 242>, <TokenType.CURRENT_DATETIME: 243>, <TokenType.CURRENT_SCHEMA: 244>, <TokenType.CURRENT_TIME: 245>, <TokenType.CURRENT_TIMESTAMP: 246>, <TokenType.CURRENT_USER: 247>, <TokenType.CURRENT_ROLE: 248>, <TokenType.CURRENT_CATALOG: 249>, <TokenType.DEFAULT: 251>, <TokenType.DELETE: 252>, <TokenType.DESC: 253>, <TokenType.DESCRIBE: 254>, <TokenType.DETACH: 255>, <TokenType.DICTIONARY: 256>, <TokenType.DIV: 259>, <TokenType.END: 262>, <TokenType.ESCAPE: 263>, <TokenType.EXECUTE: 265>, <TokenType.EXISTS: 266>, <TokenType.FALSE: 267>, <TokenType.FILE: 269>, <TokenType.FILE_FORMAT: 270>, <TokenType.FILTER: 271>, <TokenType.FINAL: 272>, <TokenType.FIRST: 273>, <TokenType.FOREIGN_KEY: 276>, <TokenType.FORMAT: 277>, <TokenType.FULL: 279>, <TokenType.FUNCTION: 280>, <TokenType.GET: 281>, <TokenType.INDEX: 292>, <TokenType.INTERVAL: 298>, <TokenType.IS: 302>, <TokenType.ISNULL: 303>, <TokenType.KEEP: 306>, <TokenType.KILL: 308>, <TokenType.LEFT: 311>, <TokenType.LIMIT: 313>, <TokenType.LIST: 314>, <TokenType.LOAD: 315>, <TokenType.LOCK: 316>, <TokenType.MAP: 317>, <TokenType.MATCH: 318>, <TokenType.MERGE: 322>, <TokenType.MODEL: 324>, <TokenType.NATURAL: 325>, <TokenType.NEXT: 326>, <TokenType.NOTHING: 327>, <TokenType.NULL: 329>, <TokenType.OBJECT_IDENTIFIER: 330>, <TokenType.OFFSET: 331>, <TokenType.OPERATOR: 334>, <TokenType.ORDINALITY: 338>, <TokenType.INOUT: 340>, <TokenType.OVER: 342>, <TokenType.OVERLAPS: 343>, <TokenType.OVERWRITE: 344>, <TokenType.PARTITION: 345>, <TokenType.PERCENT: 347>, <TokenType.PIVOT: 348>, <TokenType.PRAGMA: 351>, <TokenType.PROCEDURE: 354>, <TokenType.PSEUDO_TYPE: 356>, <TokenType.PUT: 357>, <TokenType.RANGE: 361>, <TokenType.RECURSIVE: 362>, <TokenType.REFRESH: 363>, <TokenType.RENAME: 364>, <TokenType.REPLACE: 365>, <TokenType.REFERENCES: 368>, <TokenType.RIGHT: 369>, <TokenType.ROLLUP: 372>, <TokenType.ROW: 373>, <TokenType.ROWS: 374>, <TokenType.SEMI: 376>, <TokenType.SEQUENCE: 378>, <TokenType.SET: 380>, <TokenType.SETTINGS: 381>, <TokenType.SHOW: 382>, <TokenType.SOME: 384>, <TokenType.STORAGE_INTEGRATION: 388>, <TokenType.STRAIGHT_JOIN: 389>, <TokenType.STRUCT: 390>, <TokenType.TAG: 393>, <TokenType.TEMPORARY: 394>, <TokenType.TOP: 395>, <TokenType.TRUE: 397>, <TokenType.TRUNCATE: 398>, <TokenType.TRIGGER: 399>, <TokenType.UNNEST: 402>, <TokenType.UNPIVOT: 403>, <TokenType.UPDATE: 404>, <TokenType.USE: 405>, <TokenType.VIEW: 409>, <TokenType.SEMANTIC_VIEW: 410>, <TokenType.VOLATILE: 411>, <TokenType.WINDOW: 414>, <TokenType.UNIQUE: 416>, <TokenType.SINK: 423>, <TokenType.SOURCE: 424>, <TokenType.ANALYZE: 425>, <TokenType.NAMESPACE: 426>, <TokenType.EXPORT: 427>}
TABLE_ALIAS_TOKENS =
{<TokenType.SESSION: 56>, <TokenType.IDENTIFIER: 76>, <TokenType.DATABASE: 77>, <TokenType.COLUMN: 78>, <TokenType.SCHEMA: 80>, <TokenType.TABLE: 81>, <TokenType.WAREHOUSE: 82>, <TokenType.STAGE: 83>, <TokenType.STREAMLIT: 84>, <TokenType.VAR: 85>, <TokenType.BIT: 93>, <TokenType.BOOLEAN: 94>, <TokenType.TINYINT: 95>, <TokenType.UTINYINT: 96>, <TokenType.SMALLINT: 97>, <TokenType.USMALLINT: 98>, <TokenType.MEDIUMINT: 99>, <TokenType.UMEDIUMINT: 100>, <TokenType.INT: 101>, <TokenType.UINT: 102>, <TokenType.BIGINT: 103>, <TokenType.UBIGINT: 104>, <TokenType.BIGNUM: 105>, <TokenType.INT128: 106>, <TokenType.UINT128: 107>, <TokenType.INT256: 108>, <TokenType.UINT256: 109>, <TokenType.FLOAT: 110>, <TokenType.DOUBLE: 111>, <TokenType.UDOUBLE: 112>, <TokenType.DECIMAL: 113>, <TokenType.DECIMAL32: 114>, <TokenType.DECIMAL64: 115>, <TokenType.DECIMAL128: 116>, <TokenType.DECIMAL256: 117>, <TokenType.DECFLOAT: 118>, <TokenType.UDECIMAL: 119>, <TokenType.BIGDECIMAL: 120>, <TokenType.CHAR: 121>, <TokenType.NCHAR: 122>, <TokenType.VARCHAR: 123>, <TokenType.NVARCHAR: 124>, <TokenType.BPCHAR: 125>, <TokenType.TEXT: 126>, <TokenType.MEDIUMTEXT: 127>, <TokenType.LONGTEXT: 128>, <TokenType.BLOB: 129>, <TokenType.MEDIUMBLOB: 130>, <TokenType.LONGBLOB: 131>, <TokenType.TINYBLOB: 132>, <TokenType.TINYTEXT: 133>, <TokenType.NAME: 134>, <TokenType.BINARY: 135>, <TokenType.VARBINARY: 136>, <TokenType.JSON: 137>, <TokenType.JSONB: 138>, <TokenType.TIME: 139>, <TokenType.TIMETZ: 140>, <TokenType.TIME_NS: 141>, <TokenType.TIMESTAMP: 142>, <TokenType.TIMESTAMPTZ: 143>, <TokenType.TIMESTAMPLTZ: 144>, <TokenType.TIMESTAMPNTZ: 145>, <TokenType.TIMESTAMP_S: 146>, <TokenType.TIMESTAMP_MS: 147>, <TokenType.TIMESTAMP_NS: 148>, <TokenType.DATETIME: 149>, <TokenType.DATETIME2: 150>, <TokenType.DATETIME64: 151>, <TokenType.SMALLDATETIME: 152>, <TokenType.DATE: 153>, <TokenType.DATE32: 154>, <TokenType.INT4RANGE: 155>, <TokenType.INT4MULTIRANGE: 156>, <TokenType.INT8RANGE: 157>, <TokenType.INT8MULTIRANGE: 158>, <TokenType.NUMRANGE: 159>, <TokenType.NUMMULTIRANGE: 160>, <TokenType.TSRANGE: 161>, <TokenType.TSMULTIRANGE: 162>, <TokenType.TSTZRANGE: 163>, <TokenType.TSTZMULTIRANGE: 164>, <TokenType.DATERANGE: 165>, <TokenType.DATEMULTIRANGE: 166>, <TokenType.UUID: 167>, <TokenType.GEOGRAPHY: 168>, <TokenType.GEOGRAPHYPOINT: 169>, <TokenType.NULLABLE: 170>, <TokenType.GEOMETRY: 171>, <TokenType.POINT: 172>, <TokenType.RING: 173>, <TokenType.LINESTRING: 174>, <TokenType.LOCALTIME: 175>, <TokenType.LOCALTIMESTAMP: 176>, <TokenType.MULTILINESTRING: 178>, <TokenType.POLYGON: 179>, <TokenType.MULTIPOLYGON: 180>, <TokenType.HLLSKETCH: 181>, <TokenType.HSTORE: 182>, <TokenType.SUPER: 183>, <TokenType.SERIAL: 184>, <TokenType.SMALLSERIAL: 185>, <TokenType.BIGSERIAL: 186>, <TokenType.XML: 187>, <TokenType.YEAR: 188>, <TokenType.USERDEFINED: 189>, <TokenType.MONEY: 190>, <TokenType.SMALLMONEY: 191>, <TokenType.ROWVERSION: 192>, <TokenType.IMAGE: 193>, <TokenType.VARIANT: 194>, <TokenType.OBJECT: 195>, <TokenType.INET: 196>, <TokenType.IPADDRESS: 197>, <TokenType.IPPREFIX: 198>, <TokenType.IPV4: 199>, <TokenType.IPV6: 200>, <TokenType.ENUM: 201>, <TokenType.ENUM8: 202>, <TokenType.ENUM16: 203>, <TokenType.FIXEDSTRING: 204>, <TokenType.LOWCARDINALITY: 205>, <TokenType.NESTED: 206>, <TokenType.AGGREGATEFUNCTION: 207>, <TokenType.SIMPLEAGGREGATEFUNCTION: 208>, <TokenType.TDIGEST: 209>, <TokenType.UNKNOWN: 210>, <TokenType.VECTOR: 211>, <TokenType.DYNAMIC: 212>, <TokenType.VOID: 213>, <TokenType.ALL: 216>, <TokenType.ANTI: 217>, <TokenType.ANY: 218>, <TokenType.APPLY: 219>, <TokenType.ARRAY: 220>, <TokenType.ASC: 221>, <TokenType.ATTACH: 223>, <TokenType.AUTO_INCREMENT: 224>, <TokenType.BEGIN: 225>, <TokenType.CACHE: 228>, <TokenType.CASE: 229>, <TokenType.COLLATE: 232>, <TokenType.COMMAND: 233>, <TokenType.COMMENT: 234>, <TokenType.COMMIT: 235>, <TokenType.CONSTRAINT: 237>, <TokenType.COPY: 238>, <TokenType.CUBE: 241>, <TokenType.CURRENT_DATE: 242>, <TokenType.CURRENT_DATETIME: 243>, <TokenType.CURRENT_SCHEMA: 244>, <TokenType.CURRENT_TIME: 245>, <TokenType.CURRENT_TIMESTAMP: 246>, <TokenType.CURRENT_USER: 247>, <TokenType.CURRENT_ROLE: 248>, <TokenType.DEFAULT: 251>, <TokenType.DELETE: 252>, <TokenType.DESC: 253>, <TokenType.DESCRIBE: 254>, <TokenType.DETACH: 255>, <TokenType.DICTIONARY: 256>, <TokenType.DIV: 259>, <TokenType.END: 262>, <TokenType.ESCAPE: 263>, <TokenType.EXECUTE: 265>, <TokenType.EXISTS: 266>, <TokenType.FALSE: 267>, <TokenType.FILE: 269>, <TokenType.FILE_FORMAT: 270>, <TokenType.FILTER: 271>, <TokenType.FINAL: 272>, <TokenType.FIRST: 273>, <TokenType.FOREIGN_KEY: 276>, <TokenType.FORMAT: 277>, <TokenType.FUNCTION: 280>, <TokenType.GET: 281>, <TokenType.INDEX: 292>, <TokenType.INTERVAL: 298>, <TokenType.IS: 302>, <TokenType.ISNULL: 303>, <TokenType.KEEP: 306>, <TokenType.KILL: 308>, <TokenType.LIMIT: 313>, <TokenType.LIST: 314>, <TokenType.LOAD: 315>, <TokenType.MAP: 317>, <TokenType.MATCH: 318>, <TokenType.MERGE: 322>, <TokenType.MODEL: 324>, <TokenType.NEXT: 326>, <TokenType.NOTHING: 327>, <TokenType.NULL: 329>, <TokenType.OBJECT_IDENTIFIER: 330>, <TokenType.OFFSET: 331>, <TokenType.OPERATOR: 334>, <TokenType.ORDINALITY: 338>, <TokenType.INOUT: 340>, <TokenType.OVER: 342>, <TokenType.OVERLAPS: 343>, <TokenType.OVERWRITE: 344>, <TokenType.PARTITION: 345>, <TokenType.PERCENT: 347>, <TokenType.PIVOT: 348>, <TokenType.PRAGMA: 351>, <TokenType.PROCEDURE: 354>, <TokenType.PSEUDO_TYPE: 356>, <TokenType.PUT: 357>, <TokenType.RANGE: 361>, <TokenType.RECURSIVE: 362>, <TokenType.REFRESH: 363>, <TokenType.RENAME: 364>, <TokenType.REPLACE: 365>, <TokenType.REFERENCES: 368>, <TokenType.ROLLUP: 372>, <TokenType.ROW: 373>, <TokenType.ROWS: 374>, <TokenType.SEMI: 376>, <TokenType.SEQUENCE: 378>, <TokenType.SET: 380>, <TokenType.SETTINGS: 381>, <TokenType.SHOW: 382>, <TokenType.SOME: 384>, <TokenType.STORAGE_INTEGRATION: 388>, <TokenType.STRAIGHT_JOIN: 389>, <TokenType.STRUCT: 390>, <TokenType.TAG: 393>, <TokenType.TEMPORARY: 394>, <TokenType.TOP: 395>, <TokenType.TRUE: 397>, <TokenType.TRUNCATE: 398>, <TokenType.TRIGGER: 399>, <TokenType.UNNEST: 402>, <TokenType.UNPIVOT: 403>, <TokenType.UPDATE: 404>, <TokenType.USE: 405>, <TokenType.VIEW: 409>, <TokenType.SEMANTIC_VIEW: 410>, <TokenType.VOLATILE: 411>, <TokenType.UNIQUE: 416>, <TokenType.SINK: 423>, <TokenType.SOURCE: 424>, <TokenType.ANALYZE: 425>, <TokenType.NAMESPACE: 426>, <TokenType.EXPORT: 427>}
SET_TRIE: Dict =
{'GLOBAL': {0: True}, 'LOCAL': {0: True}, 'SESSION': {0: True}, 'TRANSACTION': {0: True}}
Inherited Members
- sqlglot.parser.Parser
- Parser
- STRUCT_TYPE_TOKENS
- NESTED_TYPE_TOKENS
- ENUM_TYPE_TOKENS
- AGGREGATE_TYPE_TOKENS
- TYPE_TOKENS
- SIGNED_TO_UNSIGNED_TYPE_TOKEN
- SUBQUERY_PREDICATES
- RESERVED_TOKENS
- DB_CREATABLES
- CREATABLES
- TRIGGER_EVENTS
- ALTERABLES
- ALIAS_TOKENS
- COLON_PLACEHOLDER_TOKENS
- ARRAY_CONSTRUCTORS
- COMMENT_TABLE_ALIAS_TOKENS
- UPDATE_ALIAS_TOKENS
- TRIM_TYPES
- CONJUNCTION
- ASSIGNMENT
- DISJUNCTION
- EQUALITY
- COMPARISON
- BITWISE
- TERM
- FACTOR
- EXPONENT
- TIMES
- TIMESTAMPS
- SET_OPERATIONS
- JOIN_METHODS
- JOIN_SIDES
- JOIN_KINDS
- JOIN_HINTS
- LAMBDAS
- COLUMN_OPERATORS
- CAST_COLUMN_OPERATORS
- EXPRESSION_PARSERS
- STATEMENT_PARSERS
- UNARY_PARSERS
- STRING_PARSERS
- NUMERIC_PARSERS
- PRIMARY_PARSERS
- PLACEHOLDER_PARSERS
- RANGE_PARSERS
- PIPE_SYNTAX_TRANSFORM_PARSERS
- PROPERTY_PARSERS
- ALTER_PARSERS
- ALTER_ALTER_PARSERS
- SCHEMA_UNNAMED_CONSTRAINTS
- NO_PAREN_FUNCTION_PARSERS
- INVALID_FUNC_NAME_TOKENS
- FUNCTIONS_WITH_ALIASED_ARGS
- KEY_VALUE_DEFINITIONS
- QUERY_MODIFIER_PARSERS
- QUERY_MODIFIER_TOKENS
- SET_PARSERS
- SHOW_PARSERS
- TYPE_LITERAL_PARSERS
- TYPE_CONVERTERS
- DDL_SELECT_TOKENS
- PRE_VOLATILE_TOKENS
- TRANSACTION_KIND
- TRANSACTION_CHARACTERISTICS
- CONFLICT_ACTIONS
- TRIGGER_TIMING
- TRIGGER_DEFERRABLE
- 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
- ON_CONDITION_TOKENS
- PRIVILEGE_FOLLOW_TOKENS
- DESCRIBE_STYLES
- SET_ASSIGNMENT_DELIMITERS
- ANALYZE_STYLES
- ANALYZE_EXPRESSION_PARSERS
- PARTITION_KEYWORDS
- AMBIGUOUS_ALIAS_TOKENS
- OPERATION_MODIFIERS
- RECURSIVE_CTE_SEARCH_KIND
- MODIFIABLES
- STRICT_CAST
- PREFIXED_PIVOT_COLUMNS
- IDENTIFY_PIVOT_STRINGS
- LOG_DEFAULTS_TO_LN
- TABLESAMPLE_CSV
- DEFAULT_SAMPLING_METHOD
- SET_REQUIRES_ASSIGNMENT_DELIMITER
- TRIM_PATTERN_FIRST
- STRING_ALIASES
- MODIFIERS_ATTACHED_TO_SET_OP
- SET_OP_MODIFIERS
- NO_PAREN_IF_COMMANDS
- JSON_ARROWS_REQUIRE_JSON_TYPE
- COLON_IS_VARIANT_EXTRACT
- VALUES_FOLLOWED_BY_PAREN
- SUPPORTS_IMPLICIT_UNNEST
- INTERVAL_SPANS
- SUPPORTS_PARTITION_SELECTION
- 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
- raise_error
- validate_expression
- reset
- errors
- error_level
- error_message_context
- max_errors
- dialect
- sql
- parse
- parse_into
- check_errors
- expression
- parse_set_operation
- build_cast
414 class Generator(generator.Generator): 415 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypedetails.htm#StringDataType 416 STRING_TYPE_MAPPING = { 417 exp.DataType.Type.BLOB: "VARCHAR", 418 exp.DataType.Type.LONGBLOB: "VARCHAR", 419 exp.DataType.Type.LONGTEXT: "VARCHAR", 420 exp.DataType.Type.MEDIUMBLOB: "VARCHAR", 421 exp.DataType.Type.MEDIUMTEXT: "VARCHAR", 422 exp.DataType.Type.TINYBLOB: "VARCHAR", 423 exp.DataType.Type.TINYTEXT: "VARCHAR", 424 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypealiases.htm 425 exp.DataType.Type.TEXT: "LONG VARCHAR", 426 exp.DataType.Type.VARBINARY: "VARCHAR", 427 } 428 429 # https://docs.exasol.com/db/latest/sql_references/data_types/datatypealiases.htm 430 TYPE_MAPPING = { 431 **generator.Generator.TYPE_MAPPING, 432 **STRING_TYPE_MAPPING, 433 exp.DataType.Type.TINYINT: "SMALLINT", 434 exp.DataType.Type.MEDIUMINT: "INT", 435 exp.DataType.Type.DECIMAL32: "DECIMAL", 436 exp.DataType.Type.DECIMAL64: "DECIMAL", 437 exp.DataType.Type.DECIMAL128: "DECIMAL", 438 exp.DataType.Type.DECIMAL256: "DECIMAL", 439 exp.DataType.Type.DATETIME: "TIMESTAMP", 440 exp.DataType.Type.TIMESTAMPTZ: "TIMESTAMP", 441 exp.DataType.Type.TIMESTAMPLTZ: "TIMESTAMP", 442 exp.DataType.Type.TIMESTAMPNTZ: "TIMESTAMP", 443 } 444 445 def datatype_sql(self, expression: exp.DataType) -> str: 446 # Exasol supports a fixed default precision of 3 for TIMESTAMP WITH LOCAL TIME ZONE 447 # and does not allow specifying a different custom precision 448 if expression.is_type(exp.DataType.Type.TIMESTAMPLTZ): 449 return "TIMESTAMP WITH LOCAL TIME ZONE" 450 451 return super().datatype_sql(expression) 452 453 TRANSFORMS = { 454 **generator.Generator.TRANSFORMS, 455 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/every.htm 456 exp.All: rename_func("EVERY"), 457 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_and.htm 458 exp.BitwiseAnd: rename_func("BIT_AND"), 459 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_or.htm 460 exp.BitwiseOr: rename_func("BIT_OR"), 461 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_not.htm 462 exp.BitwiseNot: rename_func("BIT_NOT"), 463 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_lshift.htm 464 exp.BitwiseLeftShift: rename_func("BIT_LSHIFT"), 465 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_rshift.htm 466 exp.BitwiseRightShift: rename_func("BIT_RSHIFT"), 467 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/bit_xor.htm 468 exp.BitwiseXor: rename_func("BIT_XOR"), 469 exp.CurrentSchema: lambda *_: "CURRENT_SCHEMA", 470 exp.DateDiff: _date_diff_sql, 471 exp.DateAdd: _add_date_sql, 472 exp.TsOrDsAdd: _add_date_sql, 473 exp.DateSub: _add_date_sql, 474 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/div.htm#DIV 475 exp.IntDiv: rename_func("DIV"), 476 exp.TsOrDsDiff: _date_diff_sql, 477 exp.DateTrunc: _date_trunc_sql, 478 exp.DayOfWeek: lambda self, e: f"CAST(TO_CHAR({self.sql(e, 'this')}, 'D') AS INTEGER)", 479 exp.DatetimeTrunc: timestamptrunc_sql(), 480 exp.GroupConcat: lambda self, e: groupconcat_sql( 481 self, e, func_name="LISTAGG", within_group=True 482 ), 483 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/edit_distance.htm#EDIT_DISTANCE 484 exp.Levenshtein: unsupported_args("ins_cost", "del_cost", "sub_cost", "max_dist")( 485 rename_func("EDIT_DISTANCE") 486 ), 487 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/mod.htm 488 exp.Mod: rename_func("MOD"), 489 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/rank.htm 490 exp.Rank: unsupported_args("expressions")(lambda *_: "RANK()"), 491 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/dense_rank.htm 492 exp.DenseRank: unsupported_args("expressions")(lambda *_: "DENSE_RANK()"), 493 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/regexp_substr.htm 494 exp.RegexpExtract: unsupported_args("parameters", "group")( 495 rename_func("REGEXP_SUBSTR") 496 ), 497 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/regexp_replace.htm 498 exp.RegexpReplace: unsupported_args("modifiers")(rename_func("REGEXP_REPLACE")), 499 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/var_pop.htm 500 exp.VariancePop: rename_func("VAR_POP"), 501 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/approximate_count_distinct.htm 502 exp.ApproxDistinct: unsupported_args("accuracy")( 503 rename_func("APPROXIMATE_COUNT_DISTINCT") 504 ), 505 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_char%20(datetime).htm 506 exp.ToChar: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 507 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_date.htm 508 exp.TsOrDsToDate: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 509 exp.TimeToStr: lambda self, e: self.func("TO_CHAR", e.this, self.format_time(e)), 510 exp.TimeStrToTime: timestrtotime_sql, 511 exp.TimestampTrunc: _timestamp_trunc_sql, 512 exp.StrToTime: lambda self, e: self.func("TO_DATE", e.this, self.format_time(e)), 513 exp.CurrentUser: lambda *_: "CURRENT_USER", 514 exp.AtTimeZone: lambda self, e: self.func( 515 "CONVERT_TZ", 516 e.this, 517 "'UTC'", 518 e.args.get("zone"), 519 ), 520 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/instr.htm 521 exp.StrPosition: lambda self, e: ( 522 strposition_sql( 523 self, e, func_name="INSTR", supports_position=True, supports_occurrence=True 524 ) 525 ), 526 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha%5B1%5D.htm#HASH_SHA%5B1%5D 527 exp.SHA: rename_func("HASH_SHA"), 528 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha256.htm 529 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hash_sha512.htm 530 exp.SHA2: _sha2_sql, 531 exp.MD5: rename_func("HASH_MD5"), 532 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/hashtype_md5.htm 533 exp.MD5Digest: rename_func("HASHTYPE_MD5"), 534 # https://docs.exasol.com/db/latest/sql/create_view.htm 535 exp.CommentColumnConstraint: lambda self, e: f"COMMENT IS {self.sql(e, 'this')}", 536 exp.Select: transforms.preprocess( 537 [ 538 _qualify_unscoped_star, 539 _add_local_prefix_for_aliases, 540 ] 541 ), 542 exp.SubstringIndex: _substring_index_sql, 543 exp.WeekOfYear: rename_func("WEEK"), 544 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_date.htm 545 exp.Date: rename_func("TO_DATE"), 546 # https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/to_timestamp.htm 547 exp.Timestamp: rename_func("TO_TIMESTAMP"), 548 exp.Quarter: lambda self, e: f"CEIL(MONTH(TO_DATE({self.sql(e, 'this')}))/3)", 549 exp.LastDay: no_last_day_sql, 550 } 551 552 # https://docs.exasol.com/db/7.1/sql_references/system_tables/metadata/exa_sql_keywords.htm 553 RESERVED_KEYWORDS = { 554 "absolute", 555 "action", 556 "add", 557 "after", 558 "all", 559 "allocate", 560 "alter", 561 "and", 562 "any", 563 "append", 564 "are", 565 "array", 566 "as", 567 "asc", 568 "asensitive", 569 "assertion", 570 "at", 571 "attribute", 572 "authid", 573 "authorization", 574 "before", 575 "begin", 576 "between", 577 "bigint", 578 "binary", 579 "bit", 580 "blob", 581 "blocked", 582 "bool", 583 "boolean", 584 "both", 585 "by", 586 "byte", 587 "call", 588 "called", 589 "cardinality", 590 "cascade", 591 "cascaded", 592 "case", 593 "casespecific", 594 "cast", 595 "catalog", 596 "chain", 597 "char", 598 "character", 599 "character_set_catalog", 600 "character_set_name", 601 "character_set_schema", 602 "characteristics", 603 "check", 604 "checked", 605 "clob", 606 "close", 607 "coalesce", 608 "collate", 609 "collation", 610 "collation_catalog", 611 "collation_name", 612 "collation_schema", 613 "column", 614 "commit", 615 "condition", 616 "connect_by_iscycle", 617 "connect_by_isleaf", 618 "connect_by_root", 619 "connection", 620 "constant", 621 "constraint", 622 "constraint_state_default", 623 "constraints", 624 "constructor", 625 "contains", 626 "continue", 627 "control", 628 "convert", 629 "corresponding", 630 "create", 631 "cs", 632 "csv", 633 "cube", 634 "current", 635 "current_cluster", 636 "current_cluster_uid", 637 "current_date", 638 "current_path", 639 "current_role", 640 "current_schema", 641 "current_session", 642 "current_statement", 643 "current_time", 644 "current_timestamp", 645 "current_user", 646 "cursor", 647 "cycle", 648 "data", 649 "datalink", 650 "datetime_interval_code", 651 "datetime_interval_precision", 652 "day", 653 "dbtimezone", 654 "deallocate", 655 "dec", 656 "decimal", 657 "declare", 658 "default", 659 "default_like_escape_character", 660 "deferrable", 661 "deferred", 662 "defined", 663 "definer", 664 "delete", 665 "deref", 666 "derived", 667 "desc", 668 "describe", 669 "descriptor", 670 "deterministic", 671 "disable", 672 "disabled", 673 "disconnect", 674 "dispatch", 675 "distinct", 676 "dlurlcomplete", 677 "dlurlpath", 678 "dlurlpathonly", 679 "dlurlscheme", 680 "dlurlserver", 681 "dlvalue", 682 "do", 683 "domain", 684 "double", 685 "drop", 686 "dynamic", 687 "dynamic_function", 688 "dynamic_function_code", 689 "each", 690 "else", 691 "elseif", 692 "elsif", 693 "emits", 694 "enable", 695 "enabled", 696 "end", 697 "end-exec", 698 "endif", 699 "enforce", 700 "equals", 701 "errors", 702 "escape", 703 "except", 704 "exception", 705 "exec", 706 "execute", 707 "exists", 708 "exit", 709 "export", 710 "external", 711 "extract", 712 "false", 713 "fbv", 714 "fetch", 715 "file", 716 "final", 717 "first", 718 "float", 719 "following", 720 "for", 721 "forall", 722 "force", 723 "format", 724 "found", 725 "free", 726 "from", 727 "fs", 728 "full", 729 "function", 730 "general", 731 "generated", 732 "geometry", 733 "get", 734 "global", 735 "go", 736 "goto", 737 "grant", 738 "granted", 739 "group", 740 "group_concat", 741 "grouping", 742 "groups", 743 "hashtype", 744 "hashtype_format", 745 "having", 746 "high", 747 "hold", 748 "hour", 749 "identity", 750 "if", 751 "ifnull", 752 "immediate", 753 "impersonate", 754 "implementation", 755 "import", 756 "in", 757 "index", 758 "indicator", 759 "inner", 760 "inout", 761 "input", 762 "insensitive", 763 "insert", 764 "instance", 765 "instantiable", 766 "int", 767 "integer", 768 "integrity", 769 "intersect", 770 "interval", 771 "into", 772 "inverse", 773 "invoker", 774 "is", 775 "iterate", 776 "join", 777 "key_member", 778 "key_type", 779 "large", 780 "last", 781 "lateral", 782 "ldap", 783 "leading", 784 "leave", 785 "left", 786 "level", 787 "like", 788 "limit", 789 "listagg", 790 "localtime", 791 "localtimestamp", 792 "locator", 793 "log", 794 "longvarchar", 795 "loop", 796 "low", 797 "map", 798 "match", 799 "matched", 800 "merge", 801 "method", 802 "minus", 803 "minute", 804 "mod", 805 "modifies", 806 "modify", 807 "module", 808 "month", 809 "names", 810 "national", 811 "natural", 812 "nchar", 813 "nclob", 814 "new", 815 "next", 816 "nls_date_format", 817 "nls_date_language", 818 "nls_first_day_of_week", 819 "nls_numeric_characters", 820 "nls_timestamp_format", 821 "no", 822 "nocycle", 823 "nologging", 824 "none", 825 "not", 826 "null", 827 "nullif", 828 "number", 829 "numeric", 830 "nvarchar", 831 "nvarchar2", 832 "object", 833 "of", 834 "off", 835 "old", 836 "on", 837 "only", 838 "open", 839 "option", 840 "options", 841 "or", 842 "order", 843 "ordering", 844 "ordinality", 845 "others", 846 "out", 847 "outer", 848 "output", 849 "over", 850 "overlaps", 851 "overlay", 852 "overriding", 853 "pad", 854 "parallel_enable", 855 "parameter", 856 "parameter_specific_catalog", 857 "parameter_specific_name", 858 "parameter_specific_schema", 859 "parquet", 860 "partial", 861 "path", 862 "permission", 863 "placing", 864 "plus", 865 "preceding", 866 "preferring", 867 "prepare", 868 "preserve", 869 "prior", 870 "privileges", 871 "procedure", 872 "profile", 873 "qualify", 874 "random", 875 "range", 876 "read", 877 "reads", 878 "real", 879 "recovery", 880 "recursive", 881 "ref", 882 "references", 883 "referencing", 884 "refresh", 885 "regexp_like", 886 "relative", 887 "release", 888 "rename", 889 "repeat", 890 "replace", 891 "restore", 892 "restrict", 893 "result", 894 "return", 895 "returned_length", 896 "returned_octet_length", 897 "returns", 898 "revoke", 899 "right", 900 "rollback", 901 "rollup", 902 "routine", 903 "row", 904 "rows", 905 "rowtype", 906 "savepoint", 907 "schema", 908 "scope", 909 "scope_user", 910 "script", 911 "scroll", 912 "search", 913 "second", 914 "section", 915 "security", 916 "select", 917 "selective", 918 "self", 919 "sensitive", 920 "separator", 921 "sequence", 922 "session", 923 "session_user", 924 "sessiontimezone", 925 "set", 926 "sets", 927 "shortint", 928 "similar", 929 "smallint", 930 "some", 931 "source", 932 "space", 933 "specific", 934 "specifictype", 935 "sql", 936 "sql_bigint", 937 "sql_bit", 938 "sql_char", 939 "sql_date", 940 "sql_decimal", 941 "sql_double", 942 "sql_float", 943 "sql_integer", 944 "sql_longvarchar", 945 "sql_numeric", 946 "sql_preprocessor_script", 947 "sql_real", 948 "sql_smallint", 949 "sql_timestamp", 950 "sql_tinyint", 951 "sql_type_date", 952 "sql_type_timestamp", 953 "sql_varchar", 954 "sqlexception", 955 "sqlstate", 956 "sqlwarning", 957 "start", 958 "state", 959 "statement", 960 "static", 961 "structure", 962 "style", 963 "substring", 964 "subtype", 965 "sysdate", 966 "system", 967 "system_user", 968 "systimestamp", 969 "table", 970 "temporary", 971 "text", 972 "then", 973 "time", 974 "timestamp", 975 "timezone_hour", 976 "timezone_minute", 977 "tinyint", 978 "to", 979 "trailing", 980 "transaction", 981 "transform", 982 "transforms", 983 "translation", 984 "treat", 985 "trigger", 986 "trim", 987 "true", 988 "truncate", 989 "under", 990 "union", 991 "unique", 992 "unknown", 993 "unlink", 994 "unnest", 995 "until", 996 "update", 997 "usage", 998 "user", 999 "using", 1000 "value", 1001 "values", 1002 "varchar", 1003 "varchar2", 1004 "varray", 1005 "verify", 1006 "view", 1007 "when", 1008 "whenever", 1009 "where", 1010 "while", 1011 "window", 1012 "with", 1013 "within", 1014 "without", 1015 "work", 1016 "year", 1017 "yes", 1018 "zone", 1019 } 1020 1021 def converttimezone_sql(self, expression: exp.ConvertTimezone) -> str: 1022 from_tz = expression.args.get("source_tz") 1023 to_tz = expression.args.get("target_tz") 1024 datetime = expression.args.get("timestamp") 1025 options = expression.args.get("options") 1026 1027 return self.func("CONVERT_TZ", datetime, from_tz, to_tz, options) 1028 1029 def if_sql(self, expression: exp.If) -> str: 1030 this = self.sql(expression, "this") 1031 true = self.sql(expression, "true") 1032 false = self.sql(expression, "false") 1033 return f"IF {this} THEN {true} ELSE {false} ENDIF" 1034 1035 def collate_sql(self, expression: exp.Collate) -> str: 1036 return self.sql(expression.this)
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
STRING_TYPE_MAPPING =
{<Type.BLOB: 'BLOB'>: 'VARCHAR', <Type.LONGBLOB: 'LONGBLOB'>: 'VARCHAR', <Type.LONGTEXT: 'LONGTEXT'>: 'VARCHAR', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'VARCHAR', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'VARCHAR', <Type.TINYBLOB: 'TINYBLOB'>: 'VARCHAR', <Type.TINYTEXT: 'TINYTEXT'>: 'VARCHAR', <Type.TEXT: 'TEXT'>: 'LONG VARCHAR', <Type.VARBINARY: 'VARBINARY'>: 'VARCHAR'}
TYPE_MAPPING =
{<Type.DATETIME2: 'DATETIME2'>: 'TIMESTAMP', <Type.NCHAR: 'NCHAR'>: 'CHAR', <Type.NVARCHAR: 'NVARCHAR'>: 'VARCHAR', <Type.MEDIUMTEXT: 'MEDIUMTEXT'>: 'VARCHAR', <Type.LONGTEXT: 'LONGTEXT'>: 'VARCHAR', <Type.TINYTEXT: 'TINYTEXT'>: 'VARCHAR', <Type.BLOB: 'BLOB'>: 'VARCHAR', <Type.MEDIUMBLOB: 'MEDIUMBLOB'>: 'VARCHAR', <Type.LONGBLOB: 'LONGBLOB'>: 'VARCHAR', <Type.TINYBLOB: 'TINYBLOB'>: 'VARCHAR', <Type.INET: 'INET'>: 'INET', <Type.ROWVERSION: 'ROWVERSION'>: 'VARBINARY', <Type.SMALLDATETIME: 'SMALLDATETIME'>: 'TIMESTAMP', <Type.TEXT: 'TEXT'>: 'LONG VARCHAR', <Type.VARBINARY: 'VARBINARY'>: 'VARCHAR', <Type.TINYINT: 'TINYINT'>: 'SMALLINT', <Type.MEDIUMINT: 'MEDIUMINT'>: 'INT', <Type.DECIMAL32: 'DECIMAL32'>: 'DECIMAL', <Type.DECIMAL64: 'DECIMAL64'>: 'DECIMAL', <Type.DECIMAL128: 'DECIMAL128'>: 'DECIMAL', <Type.DECIMAL256: 'DECIMAL256'>: 'DECIMAL', <Type.DATETIME: 'DATETIME'>: 'TIMESTAMP', <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>: 'TIMESTAMP', <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>: 'TIMESTAMP', <Type.TIMESTAMPNTZ: 'TIMESTAMPNTZ'>: 'TIMESTAMP'}
445 def datatype_sql(self, expression: exp.DataType) -> str: 446 # Exasol supports a fixed default precision of 3 for TIMESTAMP WITH LOCAL TIME ZONE 447 # and does not allow specifying a different custom precision 448 if expression.is_type(exp.DataType.Type.TIMESTAMPLTZ): 449 return "TIMESTAMP WITH LOCAL TIME ZONE" 450 451 return super().datatype_sql(expression)
TRANSFORMS =
{<class 'sqlglot.expressions.JSONPathFilter'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathKey'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathRecursive'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathRoot'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathScript'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSelector'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSlice'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathSubscript'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathUnion'>: <function <lambda>>, <class 'sqlglot.expressions.JSONPathWildcard'>: <function <lambda>>, <class 'sqlglot.expressions.Adjacent'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AllowedValuesProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeColumns'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AnalyzeWith'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayContainsAll'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ArrayOverlaps'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.AutoRefreshProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.BackupProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CaseSpecificColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Ceil'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CharacterSetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CollateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.CommentColumnConstraint'>: <function Exasol.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 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.EndStatement'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EnviromentProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.EphemeralColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExcludeColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExecuteAsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Except'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExternalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Floor'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Get'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.GlobalProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.HeapProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IcebergProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InheritsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InlineLengthColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.InputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Intersect'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.IntervalSpan'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Int64'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContainsAnyTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBContainsAllTopKeys'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.JSONBDeleteAtPath'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LanguageProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LocationProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.LogProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.MaterializedProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NetFunc'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NonClusteredColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NoPrimaryIndexProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.NotForReplicationColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnCommitProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OnUpdateColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Operator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.OutputModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExtendsLeft'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ExtendsRight'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PathColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionedByBucket'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PartitionByTruncate'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PivotAny'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.PositionalColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ProjectionPolicyColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ZeroFillColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Put'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.RemoteWithConnectionModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ReturnsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SafeFunc'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SampleProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecureProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetConfigProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SetProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SettingsProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SharingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlReadWriteProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SqlSecurityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StabilityProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Stream'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StreamingTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.StrictProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.SwapTable'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TableColumn'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Tags'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TemporaryProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TitleColumnConstraint'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ToTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransformModelProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TransientProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.TriggerExecute'>: <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 Generator.<lambda>>, <class 'sqlglot.expressions.UtcTimestamp'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.Variadic'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VarMap'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ViewAttributeProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.VolatileProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithJournalTableProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithProcedureOptions'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithSchemaBindingProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.WithOperator'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.ForceProperty'>: <function Generator.<lambda>>, <class 'sqlglot.expressions.All'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseAnd'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseOr'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseNot'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseLeftShift'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseRightShift'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.BitwiseXor'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.CurrentSchema'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.DateDiff'>: <function _date_diff_sql>, <class 'sqlglot.expressions.DateAdd'>: <function _add_date_sql>, <class 'sqlglot.expressions.TsOrDsAdd'>: <function _add_date_sql>, <class 'sqlglot.expressions.DateSub'>: <function _add_date_sql>, <class 'sqlglot.expressions.IntDiv'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.TsOrDsDiff'>: <function _date_diff_sql>, <class 'sqlglot.expressions.DateTrunc'>: <function _date_trunc_sql>, <class 'sqlglot.expressions.DayOfWeek'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.DatetimeTrunc'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class 'sqlglot.expressions.GroupConcat'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.Levenshtein'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Mod'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Rank'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.DenseRank'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.RegexpExtract'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.RegexpReplace'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.VariancePop'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ApproxDistinct'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.ToChar'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.TsOrDsToDate'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.TimeToStr'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.TimeStrToTime'>: <function timestrtotime_sql>, <class 'sqlglot.expressions.TimestampTrunc'>: <function _timestamp_trunc_sql>, <class 'sqlglot.expressions.StrToTime'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.CurrentUser'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.AtTimeZone'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.StrPosition'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.SHA'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.SHA2'>: <function _sha2_sql>, <class 'sqlglot.expressions.MD5'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.MD5Digest'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Select'>: <function preprocess.<locals>._to_sql>, <class 'sqlglot.expressions.SubstringIndex'>: <function _substring_index_sql>, <class 'sqlglot.expressions.WeekOfYear'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Date'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Timestamp'>: <function rename_func.<locals>.<lambda>>, <class 'sqlglot.expressions.Quarter'>: <function Exasol.Generator.<lambda>>, <class 'sqlglot.expressions.LastDay'>: <function no_last_day_sql>}
RESERVED_KEYWORDS =
{'constructor', 'unknown', 'rollback', 'shortint', 'union', 'checked', 'until', 'over', 'asensitive', 'section', 'extract', 'current_role', 'deallocate', 'timezone_minute', 'number', 'nullif', 'text', 'scope_user', 'privileges', 'parameter', 'sql_tinyint', 'after', 'character_set_catalog', 'integrity', 'sql_longvarchar', 'range', 'begin', 'partial', 'sql_numeric', 'continue', 'parameter_specific_name', 'integer', 'regexp_like', 'insert', 'rollup', 'sensitive', 'module', 'assertion', 'exit', 'cs', 'deterministic', 'default_like_escape_character', 'source', 'level', 'deferrable', 'descriptor', 'nvarchar2', 'replace', 'character_set_name', 'commit', 'current_user', 'format', 'random', 'next', 'prior', 'system_user', 'nclob', 'merge', 'statement', 'input', 'dynamic', 'map', 'nvarchar', 'from', 'sql', 'state', 'time', 'ldap', 'are', 'bigint', 'nls_numeric_characters', 'call', 'inner', 'nocycle', 'fs', 'csv', 'current_time', 'equals', 'import', 'append', 'where', 'nls_date_language', 'character', 'domain', 'declare', 'alter', 'int', 'natural', 'sql_bit', 'order', 'group', 'by', 'nls_timestamp_format', 'new', 'parallel_enable', 'reads', 'array', 'returned_length', 'start', 'insensitive', 'leading', 'day', 'systimestamp', 'deref', 'month', 'values', 'matched', 'sessiontimezone', 'full', 'trim', 'sql_float', 'invoker', 'cardinality', 'sql_smallint', 'dlurlcomplete', 'clob', 'minus', 'and', 'substring', 'current_schema', 'value', 'drop', 'current_date', 'old', 'localtimestamp', 'all', 'character_set_schema', 'constraint', 'to', 'rename', 'derived', 'outer', 'preserve', 'free', 'modifies', 'path', 'defined', 'absolute', 'current_cluster_uid', 'case', 'as', 'distinct', 'instantiable', 'nls_date_format', 'high', 'intersect', 'within', 'file', 'desc', 'option', 'instance', 'cursor', 'verify', 'byte', 'boolean', 'modify', 'connection', 'transforms', 'both', 'having', 'varchar2', 'hashtype', 'sqlstate', 'in', 'parameter_specific_schema', 'float', 'elsif', 'log', 'definer', 'sql_double', 'qualify', 'sql_integer', 'real', 'current_session', 'specific', 'for', 'of', 'varray', 'exec', 'connect_by_root', 'relative', 'session_user', 'right', 'returns', 'not', 'catalog', 'chain', 'collation', 'sqlwarning', 'is', 'treat', 'get', 'object', 'dlurlpathonly', 'low', 'forall', 'ref', 'into', 'second', 'emits', 'inout', 'timezone_hour', 'loop', 'fetch', 'select', 'errors', 'translation', 'grant', 'sql_date', 'sysdate', 'routine', 'dlurlscheme', 'inverse', 'profile', 'deferred', 'sql_char', 'left', 'identity', 'static', 'large', 'attribute', 'search', 'action', 'default', 'dlurlserver', 'transform', 'update', 'nchar', 'blob', 'no', 'space', 'sql_real', 'grouping', 'cast', 'force', 'localtime', 'temporary', 'returned_octet_length', 'refresh', 'end', 'options', 'sql_timestamp', 'escape', 'condition', 'describe', 'do', 'release', 'collation_catalog', 'fbv', 'savepoint', 'rows', 'year', 'sql_preprocessor_script', 'general', 'script', 'unnest', 'generated', 'restrict', 'parquet', 'hold', 'collation_name', 'constraint_state_default', 'go', 'casespecific', 'dec', 'yes', 'unlink', 'disconnect', 'connect_by_isleaf', 'separator', 'varchar', 'while', 'else', 'parameter_specific_catalog', 'char', 'match', 'implementation', 'procedure', 'check', 'groups', 'output', 'connect_by_iscycle', 'dispatch', 'without', 'trigger', 'allocate', 'plus', 'sequence', 'create', 'exists', 'preceding', 'unique', 'referencing', 'pad', 'revoke', 'schema', 'on', 'only', 'binary', 'dbtimezone', 'enabled', 'lateral', 'export', 'prepare', 'row', 'except', 'leave', 'style', 'permission', 'longvarchar', 'elseif', 'mod', 'called', 'others', 'view', 'collation_schema', 'listagg', 'dynamic_function', 'key_member', 'preferring', 'datetime_interval_code', 'sql_decimal', 'overlaps', 'exception', 'at', 'result', 'null', 'sql_type_date', 'selective', 'disable', 'locator', 'before', 'tinyint', 'found', 'references', 'true', 'convert', 'datetime_interval_precision', 'placing', 'subtype', 'current', 'datalink', 'return', 'characteristics', 'coalesce', 'overlay', 'current_cluster', 'geometry', 'cascaded', 'nls_first_day_of_week', 'group_concat', 'session', 'final', 'sql_varchar', 'sql_type_timestamp', 'scope', 'limit', 'then', 'cycle', 'corresponding', 'decimal', 'table', 'smallint', 'rowtype', 'close', 'contains', 'method', 'specifictype', 'current_path', 'enforce', 'enable', 'goto', 'first', 'nologging', 'ordinality', 'external', 'some', 'collate', 'control', 'authid', 'system', 'end-exec', 'security', 'false', 'or', 'similar', 'usage', 'truncate', 'index', 'cube', 'sqlexception', 'asc', 'overriding', 'names', 'recovery', 'none', 'granted', 'between', 'recursive', 'out', 'function', 'immediate', 'constraints', 'dynamic_function_code', 'ordering', 'work', 'scroll', 'restore', 'national', 'using', 'trailing', 'following', 'iterate', 'numeric', 'endif', 'under', 'when', 'repeat', 'set', 'structure', 'constant', 'self', 'delete', 'sql_bigint', 'sets', 'dlvalue', 'disabled', 'cascade', 'key_type', 'zone', 'transaction', 'impersonate', 'hashtype_format', 'with', 'indicator', 'bit', 'user', 'interval', 'data', 'authorization', 'whenever', 'hour', 'open', 'timestamp', 'last', 'like', 'double', 'off', 'current_statement', 'any', 'read', 'add', 'bool', 'window', 'ifnull', 'join', 'column', 'if', 'current_timestamp', 'each', 'global', 'minute', 'execute', 'blocked', 'dlurlpath'}
1021 def converttimezone_sql(self, expression: exp.ConvertTimezone) -> str: 1022 from_tz = expression.args.get("source_tz") 1023 to_tz = expression.args.get("target_tz") 1024 datetime = expression.args.get("timestamp") 1025 options = expression.args.get("options") 1026 1027 return self.func("CONVERT_TZ", datetime, from_tz, to_tz, options)
AFTER_HAVING_MODIFIER_TRANSFORMS =
{'windows': <function Generator.<lambda>>, 'qualify': <function Generator.<lambda>>}
Inherited Members
- sqlglot.generator.Generator
- Generator
- NULL_ORDERING_SUPPORTED
- IGNORE_NULLS_IN_FUNC
- LOCKING_READS_SUPPORTED
- EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE
- WRAP_DERIVED_VALUES
- CREATE_FUNCTION_RETURN_AS
- MATCHED_BY_SOURCE
- SINGLE_STRING_INTERVAL
- INTERVAL_ALLOWS_PLURAL_FORM
- LIMIT_FETCH
- LIMIT_ONLY_LITERALS
- RENAME_TABLE_WITH_DB
- GROUPINGS_SEP
- INDEX_ON
- INOUT_SEPARATOR
- JOIN_HINTS
- DIRECTED_JOINS
- TABLE_HINTS
- QUERY_HINTS
- QUERY_HINT_SEP
- IS_BOOL_ALLOWED
- DUPLICATE_KEY_UPDATE_WITH_SET
- LIMIT_IS_TOP
- RETURNING_END
- EXTRACT_ALLOWS_QUOTES
- TZ_TO_WITH_TIME_ZONE
- NVL2_SUPPORTED
- VALUES_AS_TABLE
- 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
- LAST_DAY_SUPPORTS_DATE_PART
- SUPPORTS_TABLE_ALIAS_COLUMNS
- UNPIVOT_ALIASES_ARE_IDENTIFIERS
- JSON_KEY_VALUE_PAIR_SEP
- INSERT_OVERWRITE
- SUPPORTS_SELECT_INTO
- SUPPORTS_UNLOGGED_TABLES
- SUPPORTS_CREATE_TABLE_LIKE
- LIKE_PROPERTY_INSIDE_SCHEMA
- MULTI_ARG_DISTINCT
- JSON_TYPE_REQUIRED_FOR_EXTRACTION
- JSON_PATH_BRACKETED_KEY_SUPPORTED
- JSON_PATH_SINGLE_QUOTE_ESCAPE
- SUPPORTED_JSON_PATH_PARTS
- CAN_IMPLEMENT_ARRAY_ANY
- SUPPORTS_TO_NUMBER
- SUPPORTS_WINDOW_EXCLUDE
- SET_OP_MODIFIERS
- COPY_PARAMS_ARE_WRAPPED
- COPY_PARAMS_EQ_REQUIRED
- COPY_HAS_INTO_KEYWORD
- UNICODE_SUBSTITUTE
- STAR_EXCEPT
- HEX_FUNC
- WITH_PROPERTIES_PREFIX
- QUOTE_JSON_PATH
- PAD_FILL_PATTERN_IS_REQUIRED
- SUPPORTS_EXPLODING_PROJECTIONS
- ARRAY_CONCAT_IS_VAR_LEN
- SUPPORTS_CONVERT_TIMEZONE
- SUPPORTS_MEDIAN
- SUPPORTS_UNIX_SECONDS
- ALTER_SET_WRAPPED
- NORMALIZE_EXTRACT_DATE_PARTS
- PARSE_JSON_NAME
- ARRAY_SIZE_NAME
- ALTER_SET_TYPE
- ARRAY_SIZE_DIM_REQUIRED
- SUPPORTS_BETWEEN_FLAGS
- SUPPORTS_LIKE_QUANTIFIERS
- MATCH_AGAINST_TABLE_PREFIX
- SET_ASSIGNMENT_REQUIRES_VARIABLE_KEYWORD
- DECLARE_DEFAULT_ASSIGNMENT
- UPDATE_STATEMENT_SUPPORTS_FROM
- STAR_EXCLUDE_REQUIRES_DERIVED_TABLE
- UNSUPPORTED_TYPES
- TIME_PART_SINGULARS
- TOKEN_MAPPING
- STRUCT_DELIMITER
- PARAMETER_TOKEN
- NAMED_PLACEHOLDER_TOKEN
- EXPRESSION_PRECEDES_PROPERTIES_CREATABLES
- PROPERTIES_LOCATION
- 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
- computedcolumnconstraint_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
- triggerproperties_sql
- triggerreferencing_sql
- triggerevent_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
- rollupindex_sql
- rollupproperty_sql
- cube_sql
- group_sql
- having_sql
- connect_sql
- prior_sql
- join_sql
- lambda_sql
- lateral_op
- lateral_sql
- limit_sql
- offset_sql
- setitem_sql
- set_sql
- queryband_sql
- pragma_sql
- lock_sql
- literal_sql
- escape_str
- loaddata_sql
- null_sql
- boolean_sql
- booland_sql
- boolor_sql
- order_sql
- withfill_sql
- cluster_sql
- distribute_sql
- sort_sql
- ordered_sql
- matchrecognizemeasure_sql
- matchrecognize_sql
- query_modifiers
- options_modifier
- for_modifiers
- queryoption_sql
- offset_limit_modifiers
- after_limit_modifiers
- select_sql
- schema_sql
- schema_columns_sql
- star_sql
- parameter_sql
- sessionparameter_sql
- placeholder_sql
- subquery_sql
- qualify_sql
- unnest_sql
- prewhere_sql
- where_sql
- window_sql
- partition_by_sql
- windowspec_sql
- withingroup_sql
- between_sql
- bracket_offset_expressions
- bracket_sql
- all_sql
- any_sql
- exists_sql
- case_sql
- constraint_sql
- nextvaluefor_sql
- extract_sql
- trim_sql
- convert_concat_args
- concat_sql
- concatws_sql
- check_sql
- foreignkey_sql
- primarykey_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
- attimezone_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
- cast_sql
- strtotime_sql
- currentdate_sql
- command_sql
- comment_sql
- mergetreettlaction_sql
- mergetreettl_sql
- transaction_sql
- commit_sql
- rollback_sql
- altercolumn_sql
- alterindex_sql
- alterdiststyle_sql
- altersortkey_sql
- alterrename_sql
- renamecolumn_sql
- alterset_sql
- alter_sql
- altersession_sql
- add_column_sql
- droppartition_sql
- addconstraint_sql
- addpartition_sql
- distinct_sql
- ignorenulls_sql
- respectnulls_sql
- havingmax_sql
- intdiv_sql
- dpipe_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
- truncatetable_sql
- convert_sql
- copyparameter_sql
- credentials_sql
- copy_sql
- semicolon_sql
- datadeletionproperty_sql
- maskingpolicycolumnconstraint_sql
- gapfill_sql
- scope_resolution
- scoperesolution_sql
- parsejson_sql
- rand_sql
- changes_sql
- pad_sql
- summarize_sql
- explodinggenerateseries_sql
- json_sql
- jsonvalue_sql
- conditionalinsert_sql
- multitableinserts_sql
- oncondition_sql
- jsonextractquote_sql
- jsonexists_sql
- arrayagg_sql
- slice_sql
- apply_sql
- grant_sql
- revoke_sql
- grantprivilege_sql
- grantprincipal_sql
- columns_sql
- overlay_sql
- todouble_sql
- string_sql
- median_sql
- overflowtruncatebehavior_sql
- unixseconds_sql
- arraysize_sql
- attach_sql
- detach_sql
- attachoption_sql
- watermarkcolumnconstraint_sql
- encodeproperty_sql
- includeproperty_sql
- xmlelement_sql
- xmlkeyvalueoption_sql
- 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
- show_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
- block_sql
- storedprocedure_sql
- ifblock_sql
- whileblock_sql
- execute_sql
- executesql_sql