diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2021-07-12 21:53:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-07-12 21:53:11 +0000 |
commit | 18dba87757097b87495aed0ca9fc345a040da1f1 (patch) | |
tree | 9343faefb05f72d8c08d5f69897a76b85d2b1bae /lib/sqlalchemy/sql/compiler.py | |
parent | b7791290ed5499542d2e6d7bdfac252f7648f5fc (diff) | |
parent | 204ff1f60cf911b00b7494942fc58bc715dddeed (diff) | |
download | sqlalchemy-18dba87757097b87495aed0ca9fc345a040da1f1.tar.gz |
Merge "implement independent CTEs"
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index e92ffcd9a..e31a3839e 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2314,8 +2314,7 @@ class SQLCompiler(Compiled): ) and not existing.proxy_set.intersection(bindparam.proxy_set): raise exc.CompileError( "Bind parameter '%s' conflicts with " - "unique bind parameter of the same name" - % bindparam.key + "unique bind parameter of the same name" % name ) elif existing._is_crud or bindparam._is_crud: raise exc.CompileError( @@ -3076,6 +3075,10 @@ class SQLCompiler(Compiled): else: byfrom = None + if select_stmt._independent_ctes: + for cte in select_stmt._independent_ctes: + cte._compiler_dispatch(self, **kwargs) + if select_stmt._prefixes: text += self._generate_prefixes( select_stmt, select_stmt._prefixes, **kwargs @@ -3552,6 +3555,10 @@ class SQLCompiler(Compiled): if insert_stmt._hints: _, table_text = self._setup_crud_hints(insert_stmt, table_text) + if insert_stmt._independent_ctes: + for cte in insert_stmt._independent_ctes: + cte._compiler_dispatch(self, **kw) + text += table_text if crud_params_single or not supports_default_values: @@ -3701,6 +3708,10 @@ class SQLCompiler(Compiled): else: dialect_hints = None + if update_stmt._independent_ctes: + for cte in update_stmt._independent_ctes: + cte._compiler_dispatch(self, **kw) + text += table_text text += " SET " @@ -3809,6 +3820,10 @@ class SQLCompiler(Compiled): else: dialect_hints = None + if delete_stmt._independent_ctes: + for cte in delete_stmt._independent_ctes: + cte._compiler_dispatch(self, **kw) + text += table_text if delete_stmt._returning: |