summaryrefslogtreecommitdiffstats
path: root/sqlglot/expressions.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/expressions.py')
-rw-r--r--sqlglot/expressions.py29
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()