diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-17 00:30:29 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-17 00:37:47 -0400 |
| commit | 901f7a2b534e4bbc88d7c6894541223cb0dd968d (patch) | |
| tree | 6a647d3a18a771855d876a6c358fd9241213a219 /lib/sqlalchemy/dialects/mysql/base.py | |
| parent | b73fc8f874da94c9c5b2d94feb6b1b45b7f4f02b (diff) | |
| download | sqlalchemy-901f7a2b534e4bbc88d7c6894541223cb0dd968d.tar.gz | |
pass asfrom correctly in compilers
Fixed an argument error in the default and PostgreSQL compilers that
would interfere with an UPDATE..FROM or DELETE..FROM..USING statement
that was then SELECTed from as a CTE.
The incorrect pattern was also fixed in the mysql and sybase dialects.
MySQL supports CTEs but not "returning".
Fixes: #6303
Change-Id: Ic94805611a5ec443749fb6b1fd8a1326b0d83ef7
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index c5113b054..d4c70a78e 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -1783,8 +1783,9 @@ class MySQLCompiler(compiler.SQLCompiler): return None def update_tables_clause(self, update_stmt, from_table, extra_froms, **kw): + kw["asfrom"] = True return ", ".join( - t._compiler_dispatch(self, asfrom=True, **kw) + t._compiler_dispatch(self, **kw) for t in [from_table] + list(extra_froms) ) @@ -1806,8 +1807,9 @@ class MySQLCompiler(compiler.SQLCompiler): self, delete_stmt, from_table, extra_froms, from_hints, **kw ): """Render the DELETE .. USING clause specific to MySQL.""" + kw["asfrom"] = True return "USING " + ", ".join( - t._compiler_dispatch(self, asfrom=True, fromhints=from_hints, **kw) + t._compiler_dispatch(self, fromhints=from_hints, **kw) for t in [from_table] + extra_froms ) |
