From: Eric Masseran Date: Fri, 10 Sep 2021 12:27:21 +0000 (+0200) Subject: Fix nesting ctes inconsistent order in p2.7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6709%2Fhead;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix nesting ctes inconsistent order in p2.7 --- diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index ad53eaa9db..2228d63de9 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -3476,7 +3476,7 @@ class SQLCompiler(Compiled): return "" if nesting_level and nesting_level > 1: - ctes = {} + ctes = util.OrderedDict() for cte in list(self.ctes.keys()): cte_level = self.level_by_ctes[cte] is_rendered_level = cte_level == nesting_level or (