summaryrefslogtreecommitdiffstats
path: root/sqlglot/expressions.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/expressions.py')
-rw-r--r--sqlglot/expressions.py32
1 files changed, 27 insertions, 5 deletions
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index 00a3b45..085871e 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -1031,7 +1031,7 @@ class Constraint(Expression):
class Delete(Expression):
- arg_types = {"with": False, "this": False, "using": False, "where": False}
+ arg_types = {"with": False, "this": False, "using": False, "where": False, "returning": False}
class Drop(Expression):
@@ -1132,6 +1132,7 @@ class Insert(Expression):
"with": False,
"this": True,
"expression": False,
+ "returning": False,
"overwrite": False,
"exists": False,
"partition": False,
@@ -1139,6 +1140,10 @@ class Insert(Expression):
}
+class Returning(Expression):
+ arg_types = {"expressions": True}
+
+
# https://dev.mysql.com/doc/refman/8.0/en/charset-introducer.html
class Introducer(Expression):
arg_types = {"this": True, "expression": True}
@@ -1747,6 +1752,7 @@ QUERY_MODIFIERS = {
"limit": False,
"offset": False,
"lock": False,
+ "sample": False,
}
@@ -1895,6 +1901,7 @@ class Update(Expression):
"expressions": True,
"from": False,
"where": False,
+ "returning": False,
}
@@ -2401,6 +2408,18 @@ class Select(Subqueryable):
**opts,
)
+ def qualify(self, *expressions, append=True, dialect=None, copy=True, **opts) -> Select:
+ return _apply_conjunction_builder(
+ *expressions,
+ instance=self,
+ arg="qualify",
+ append=append,
+ into=Qualify,
+ dialect=dialect,
+ copy=copy,
+ **opts,
+ )
+
def distinct(self, distinct=True, copy=True) -> Select:
"""
Set the OFFSET expression.
@@ -2531,6 +2550,7 @@ class TableSample(Expression):
"rows": False,
"size": False,
"seed": False,
+ "kind": False,
}
@@ -3423,7 +3443,7 @@ class JSONBExtractScalar(JSONExtract):
class Least(Func):
- arg_types = {"this": True, "expressions": False}
+ arg_types = {"expressions": False}
is_var_len_args = True
@@ -3485,11 +3505,13 @@ class Matches(Func):
class Max(AggFunc):
- arg_types = {"this": True, "expression": False}
+ arg_types = {"this": True, "expressions": False}
+ is_var_len_args = True
class Min(AggFunc):
- arg_types = {"this": True, "expression": False}
+ arg_types = {"this": True, "expressions": False}
+ is_var_len_args = True
class Month(Func):
@@ -3764,7 +3786,7 @@ class Merge(Expression):
class When(Func):
- arg_types = {"this": True, "then": True}
+ arg_types = {"matched": True, "source": False, "condition": False, "then": True}
def _norm_args(expression):