summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index a81507acb..1e090ef10 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1787,6 +1787,8 @@ class SQLCompiler(Compiled):
if toplevel and not self.compile_state:
self.compile_state = compile_state
+ compound_stmt = compile_state.statement
+
entry = self._default_stack_entry if toplevel else self.stack[-1]
need_result_map = toplevel or (
not compound_index
@@ -1807,6 +1809,10 @@ class SQLCompiler(Compiled):
}
)
+ if compound_stmt._independent_ctes:
+ for cte in compound_stmt._independent_ctes:
+ cte._compiler_dispatch(self, **kwargs)
+
keyword = self.compound_keywords.get(cs.keyword)
text = (" " + keyword + " ").join(