summaryrefslogtreecommitdiffstats
path: root/sqlglot/executor
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/executor')
-rw-r--r--sqlglot/executor/env.py2
-rw-r--r--sqlglot/executor/python.py2
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,