diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 18:46:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 18:46:57 +0000 |
commit | caf48491ccffa709546a473d36df6a4444164ad1 (patch) | |
tree | e803e4a815a9a39695e6161ec4feb55f295f4942 /sqlglot/executor | |
parent | Releasing debian version 16.4.0-1. (diff) | |
download | sqlglot-caf48491ccffa709546a473d36df6a4444164ad1.tar.xz sqlglot-caf48491ccffa709546a473d36df6a4444164ad1.zip |
Merging upstream version 16.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/executor')
-rw-r--r-- | sqlglot/executor/env.py | 2 | ||||
-rw-r--r-- | sqlglot/executor/python.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/sqlglot/executor/env.py b/sqlglot/executor/env.py index d2c4e72..5300224 100644 --- a/sqlglot/executor/env.py +++ b/sqlglot/executor/env.py @@ -163,6 +163,7 @@ ENV = { "IF": lambda predicate, true, false: true if predicate else false, "INTDIV": null_if_any(lambda e, this: e // this), "INTERVAL": interval, + "LEFT": null_if_any(lambda this, e: this[:e]), "LIKE": null_if_any( lambda this, e: bool(re.match(e.replace("_", ".").replace("%", ".*"), this)) ), @@ -176,6 +177,7 @@ ENV = { "ORD": null_if_any(ord), "ORDERED": ordered, "POW": pow, + "RIGHT": null_if_any(lambda this, e: this[-e:]), "STRPOSITION": str_position, "SUB": null_if_any(lambda e, this: e - this), "SUBSTRING": substring, diff --git a/sqlglot/executor/python.py b/sqlglot/executor/python.py index 3f96f90..635ec2c 100644 --- a/sqlglot/executor/python.py +++ b/sqlglot/executor/python.py @@ -420,7 +420,7 @@ class Python(Dialect): exp.Column: lambda self, e: f"scope[{self.sql(e, 'table') or None}][{self.sql(e.this)}]", exp.Distinct: lambda self, e: f"set({self.sql(e, 'this')})", exp.Extract: lambda self, e: f"EXTRACT('{e.name.lower()}', {self.sql(e, 'expression')})", - exp.In: lambda self, e: f"{self.sql(e, 'this')} in ({self.expressions(e, flat=True)})", + exp.In: lambda self, e: f"{self.sql(e, 'this')} in {{{self.expressions(e, flat=True)}}}", exp.Interval: lambda self, e: f"INTERVAL({self.sql(e.this)}, '{self.sql(e.unit)}')", exp.Is: lambda self, e: self.binary(e, "is"), exp.Lambda: _lambda_sql, |