diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-04-28 12:07:09 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-05-09 10:08:52 -0400 |
commit | 4a62625d99470c8928422c4822df5234b93b6bb8 (patch) | |
tree | 280182818aea6846f1294705357b6a0754d51df4 /lib/sqlalchemy/dialects | |
parent | 39c8e95b1f50190ff30a836b2bcf13ba2cacc052 (diff) | |
download | sqlalchemy-4a62625d99470c8928422c4822df5234b93b6bb8.tar.gz |
implement FromLinter for UPDATE, DELETE statements
Implemented the "cartesian product warning" for UPDATE and DELETE
statements, those which include multiple tables that are not correlated
together in some way.
Fixed issue where :func:`_dml.update` construct that included multiple
tables and no VALUES clause would raise with an internal error. Current
behavior for :class:`_dml.Update` with no values is to generate a SQL
UPDATE statement with an empty "set" clause, so this has been made
consistent for this specific sub-case.
Fixes: #9721
Change-Id: I556639811cc930d2e37532965d2ae751882af921
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index b33ce4aec..aa319e239 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -2425,13 +2425,13 @@ class MSSQLCompiler(compiler.SQLCompiler): for t in [from_table] + extra_froms ) - def delete_table_clause(self, delete_stmt, from_table, extra_froms): + def delete_table_clause(self, delete_stmt, from_table, extra_froms, **kw): """If we have extra froms make sure we render any alias as hint.""" ashint = False if extra_froms: ashint = True return from_table._compiler_dispatch( - self, asfrom=True, iscrud=True, ashint=ashint + self, asfrom=True, iscrud=True, ashint=ashint, **kw ) def delete_extra_from_clause( diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 2ed2bbc7a..ae40fea99 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -1657,13 +1657,13 @@ class MySQLCompiler(compiler.SQLCompiler): ): return None - def delete_table_clause(self, delete_stmt, from_table, extra_froms): + def delete_table_clause(self, delete_stmt, from_table, extra_froms, **kw): """If we have extra froms make sure we render any alias as hint.""" ashint = False if extra_froms: ashint = True return from_table._compiler_dispatch( - self, asfrom=True, iscrud=True, ashint=ashint + self, asfrom=True, iscrud=True, ashint=ashint, **kw ) def delete_extra_from_clause( |