summaryrefslogtreecommitdiffstats
path: root/sqlglot/executor
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/executor')
-rw-r--r--sqlglot/executor/__init__.py4
-rw-r--r--sqlglot/executor/python.py2
2 files changed, 2 insertions, 4 deletions
diff --git a/sqlglot/executor/__init__.py b/sqlglot/executor/__init__.py
index c3d2701..a676e7d 100644
--- a/sqlglot/executor/__init__.py
+++ b/sqlglot/executor/__init__.py
@@ -62,10 +62,8 @@ def execute(
if tables_.supported_table_args and tables_.supported_table_args != schema.supported_table_args:
raise ExecuteError("Tables must support the same table args as schema")
- expression = maybe_parse(sql, dialect=read)
-
now = time.time()
- expression = optimize(expression, schema, leave_tables_isolated=True)
+ expression = optimize(sql, schema, leave_tables_isolated=True, dialect=read)
logger.debug("Optimization finished: %f", time.time() - now)
logger.debug("Optimized SQL: %s", expression.sql(pretty=True))
diff --git a/sqlglot/executor/python.py b/sqlglot/executor/python.py
index de570b0..d417328 100644
--- a/sqlglot/executor/python.py
+++ b/sqlglot/executor/python.py
@@ -376,7 +376,7 @@ def _rename(self, e):
this = self.sql(e, "this")
this = f"{this}, " if this else ""
return f"{e.key.upper()}({this}{self.expressions(e)})"
- return f"{e.key.upper()}({self.format_args(*e.args.values())})"
+ return self.func(e.key, *e.args.values())
except Exception as ex:
raise Exception(f"Could not rename {repr(e)}") from ex