summaryrefslogtreecommitdiffstats
path: root/sqlglot/expressions.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/expressions.py')
-rw-r--r--sqlglot/expressions.py85
1 files changed, 80 insertions, 5 deletions
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index f9751ca..7c1a116 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -230,6 +230,7 @@ class Expression(metaclass=_Expression):
Returns a deep copy of the expression.
"""
new = deepcopy(self)
+ new.parent = self.parent
for item, parent, _ in new.bfs():
if isinstance(item, Expression) and parent:
item.parent = parent
@@ -759,6 +760,10 @@ class Create(Expression):
"this": True,
"kind": True,
"expression": False,
+ "set": False,
+ "multiset": False,
+ "global_temporary": False,
+ "volatile": False,
"exists": False,
"properties": False,
"temporary": False,
@@ -1082,7 +1087,7 @@ class LoadData(Expression):
class Partition(Expression):
- pass
+ arg_types = {"expressions": True}
class Fetch(Expression):
@@ -1232,6 +1237,18 @@ class Lateral(UDTF):
arg_types = {"this": True, "view": False, "outer": False, "alias": False}
+class MatchRecognize(Expression):
+ arg_types = {
+ "partition_by": False,
+ "order": False,
+ "measures": False,
+ "rows": False,
+ "after": False,
+ "pattern": False,
+ "define": False,
+ }
+
+
# Clickhouse FROM FINAL modifier
# https://clickhouse.com/docs/en/sql-reference/statements/select/from/#final-modifier
class Final(Expression):
@@ -1357,8 +1374,58 @@ class SerdeProperties(Property):
arg_types = {"expressions": True}
+class FallbackProperty(Property):
+ arg_types = {"no": True, "protection": False}
+
+
+class WithJournalTableProperty(Property):
+ arg_types = {"this": True}
+
+
+class LogProperty(Property):
+ arg_types = {"no": True}
+
+
+class JournalProperty(Property):
+ arg_types = {"no": True, "dual": False, "before": False}
+
+
+class AfterJournalProperty(Property):
+ arg_types = {"no": True, "dual": False, "local": False}
+
+
+class ChecksumProperty(Property):
+ arg_types = {"on": False, "default": False}
+
+
+class FreespaceProperty(Property):
+ arg_types = {"this": True, "percent": False}
+
+
+class MergeBlockRatioProperty(Property):
+ arg_types = {"this": False, "no": False, "default": False, "percent": False}
+
+
+class DataBlocksizeProperty(Property):
+ arg_types = {"size": False, "units": False, "min": False, "default": False}
+
+
+class BlockCompressionProperty(Property):
+ arg_types = {"autotemp": False, "always": False, "default": True, "manual": True, "never": True}
+
+
+class IsolatedLoadingProperty(Property):
+ arg_types = {
+ "no": True,
+ "concurrent": True,
+ "for_all": True,
+ "for_insert": True,
+ "for_none": True,
+ }
+
+
class Properties(Expression):
- arg_types = {"expressions": True}
+ arg_types = {"expressions": True, "before": False}
NAME_TO_PROPERTY = {
"AUTO_INCREMENT": AutoIncrementProperty,
@@ -1510,6 +1577,7 @@ class Subqueryable(Unionable):
QUERY_MODIFIERS = {
+ "match": False,
"laterals": False,
"joins": False,
"pivots": False,
@@ -2459,6 +2527,10 @@ class AddConstraint(Expression):
arg_types = {"this": False, "expression": False, "enforced": False}
+class DropPartition(Expression):
+ arg_types = {"expressions": True, "exists": False}
+
+
# Binary expressions like (ADD a b)
class Binary(Expression):
arg_types = {"this": True, "expression": True}
@@ -2540,6 +2612,10 @@ class Escape(Binary):
pass
+class Glob(Binary, Predicate):
+ pass
+
+
class GT(Binary, Predicate):
pass
@@ -3126,8 +3202,7 @@ class Posexplode(Func):
pass
-class Pow(Func):
- arg_types = {"this": True, "power": True}
+class Pow(Binary, Func):
_sql_names = ["POWER", "POW"]
@@ -3361,7 +3436,7 @@ class Year(Func):
class Use(Expression):
- pass
+ arg_types = {"this": True, "kind": False}
class Merge(Expression):