diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-08-03 16:55:23 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-08-05 12:53:35 -0400 |
| commit | 9f992e42189746a7aff497abcf6ea9c08ab79e97 (patch) | |
| tree | e2929beb07c29813c16bac05060a89e112166ab9 /lib/sqlalchemy/engine | |
| parent | 0027b3a4bc54599ac8102a4a3d81d8007738903e (diff) | |
| download | sqlalchemy-9f992e42189746a7aff497abcf6ea9c08ab79e97.tar.gz | |
translate joined inheritance cols in UPDATE/DELETE
Fixed issue in ORM enabled UPDATE when the statement is created against a
joined-inheritance subclass, updating only local table columns, where the
"fetch" synchronization strategy would not render the correct RETURNING
clause for databases that use RETURNING for fetch synchronization.
Also adjusts the strategy used for RETURNING in UPDATE FROM and
DELETE FROM statements.
Also fixes MariaDB which does not support RETURNING with
DELETE..USING. this was not caught in tests because
"fetch" strategy wasn't tested. so also adjust the ORMDMLState
classes to look for "extra froms" first before adding
RETURNING, add new parameters to interfaces for
"update_returning_multitable" and "delete_returning_multitable".
A new execution option is_delete_using=True, described in the
changelog message, is added to allow the ORM to know up front
if a certain statement should have a SELECT up front
for "fetch" strategy.
Fixes: #8344
Change-Id: I3dcdb68e6e97ab0807a573c2fdb3d53c16d063ba
Diffstat (limited to 'lib/sqlalchemy/engine')
| -rw-r--r-- | lib/sqlalchemy/engine/default.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/interfaces.py | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 4b312dceb..80e687c32 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -143,6 +143,8 @@ class DefaultDialect(Dialect): insert_null_pk_still_autoincrements = False update_returning = False delete_returning = False + update_returning_multifrom = False + delete_returning_multifrom = False insert_returning = False insert_executemany_returning = False diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index 208c4f6b0..778c07592 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -781,6 +781,13 @@ class Dialect(EventTarget): """ + update_returning_multifrom: bool + """if the dialect supports RETURNING with UPDATE..FROM + + .. versionadded:: 2.0 + + """ + delete_returning: bool """if the dialect supports RETURNING with DELETE @@ -788,6 +795,13 @@ class Dialect(EventTarget): """ + delete_returning_multifrom: bool + """if the dialect supports RETURNING with DELETE..FROM + + .. versionadded:: 2.0 + + """ + favor_returning_over_lastrowid: bool """for backends that support both a lastrowid and a RETURNING insert strategy, favor RETURNING for simple single-int pk inserts. |
