diff options
Diffstat (limited to '')
-rw-r--r-- | sqlglot/executor/__init__.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sqlglot/executor/__init__.py b/sqlglot/executor/__init__.py index bca9f3e..e765616 100644 --- a/sqlglot/executor/__init__.py +++ b/sqlglot/executor/__init__.py @@ -3,17 +3,11 @@ import time from sqlglot import parse_one from sqlglot.executor.python import PythonExecutor -from sqlglot.optimizer import RULES, optimize -from sqlglot.optimizer.merge_derived_tables import merge_derived_tables +from sqlglot.optimizer import optimize from sqlglot.planner import Plan logger = logging.getLogger("sqlglot") -OPTIMIZER_RULES = list(RULES) - -# The executor needs isolated table selects -OPTIMIZER_RULES.remove(merge_derived_tables) - def execute(sql, schema, read=None): """ @@ -34,7 +28,7 @@ def execute(sql, schema, read=None): """ expression = parse_one(sql, read=read) now = time.time() - expression = optimize(expression, schema, rules=OPTIMIZER_RULES) + expression = optimize(expression, schema, leave_tables_isolated=True) logger.debug("Optimization finished: %f", time.time() - now) logger.debug("Optimized SQL: %s", expression.sql(pretty=True)) plan = Plan(expression) |