diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-06 07:28:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-06 07:28:12 +0000 |
commit | 374a0f6318bcf423b1b784d30b25a8327c65cb24 (patch) | |
tree | 9303a1cbdba85b5d9781ebef32eb1902d3790c99 /sqlglot/expressions.py | |
parent | Releasing debian version 16.7.7-1. (diff) | |
download | sqlglot-374a0f6318bcf423b1b784d30b25a8327c65cb24.tar.xz sqlglot-374a0f6318bcf423b1b784d30b25a8327c65cb24.zip |
Merging upstream version 17.2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/expressions.py')
-rw-r--r-- | sqlglot/expressions.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py index cdb93db..fdf02c8 100644 --- a/sqlglot/expressions.py +++ b/sqlglot/expressions.py @@ -102,13 +102,10 @@ class Expression(metaclass=_Expression): @property def hashable_args(self) -> t.Any: - args = (self.args.get(k) for k in self.arg_types) - - return tuple( - (tuple(_norm_arg(a) for a in arg) if arg else None) - if type(arg) is list - else (_norm_arg(arg) if arg is not None and arg is not False else None) - for arg in args + return frozenset( + (k, tuple(_norm_arg(a) for a in v) if type(v) is list else _norm_arg(v)) + for k, v in self.args.items() + if not (v is None or v is False or (type(v) is list and not v)) ) def __hash__(self) -> int: @@ -1304,6 +1301,7 @@ class Delete(Expression): "where": False, "returning": False, "limit": False, + "tables": False, # Multiple-Table Syntax (MySQL) } def delete( @@ -1490,9 +1488,7 @@ class Identifier(Expression): @property def hashable_args(self) -> t.Any: - if self.quoted and any(char.isupper() for char in self.this): - return (self.this, self.quoted) - return self.this.lower() + return (self.this, self.quoted) @property def output_name(self) -> str: @@ -1525,6 +1521,7 @@ class Insert(Expression): "partition": False, "alternative": False, "where": False, + "ignore": False, } def with_( @@ -1620,6 +1617,7 @@ class Group(Expression): "cube": False, "rollup": False, "totals": False, + "all": False, } @@ -4135,9 +4133,9 @@ class DateToDi(Func): pass +# https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date class Date(Func): - arg_types = {"expressions": True} - is_var_len_args = True + arg_types = {"this": True, "zone": False} class Day(Func): @@ -4245,6 +4243,11 @@ class JSONFormat(Func): _sql_names = ["JSON_FORMAT"] +# https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#operator_member-of +class JSONArrayContains(Binary, Predicate, Func): + _sql_names = ["JSON_ARRAY_CONTAINS"] + + class Least(Func): arg_types = {"expressions": False} is_var_len_args = True @@ -4475,7 +4478,7 @@ class StrToDate(Func): class StrToTime(Func): - arg_types = {"this": True, "format": True} + arg_types = {"this": True, "format": True, "zone": False} # Spark allows unix_timestamp() |