summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-10-05 16:55:43 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-11-10 16:30:11 -0500
commitc9d8a67b52d1f86e694fab4ccab357432941334b (patch)
tree3d9be2867d41eb37b90b92cc3daa0b19d0a4cb6a /lib/sqlalchemy
parentd1e31ab1582e2d9275c70a89b72efc2a8651df3f (diff)
downloadsqlalchemy-c9d8a67b52d1f86e694fab4ccab357432941334b.tar.gz
Consider version_id_prop when emitting bulk UPDATE
The version id needs to be part of _changed_dict() so that the value is present to send to _emit_update_statements() Change-Id: Ia85f0ef7714296a75cdc6c88674805afbbe752c8 Fixes: #3781
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/persistence.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index bf51a2a83..2f7acba3a 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -84,11 +84,16 @@ def _bulk_update(mapper, mappings, session_transaction,
cached_connections = _cached_connection_dict(base_mapper)
+ search_keys = mapper._primary_key_propkeys
+ if mapper._version_id_prop:
+ search_keys = set([mapper._version_id_prop.key]).union(search_keys)
+
def _changed_dict(mapper, state):
return dict(
(k, v)
for k, v in state.dict.items() if k in state.committed_state or k
- in mapper._primary_key_propkeys
+ in search_keys
+
)
if isstates: