]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- restore the approach we have for pk_params, but in order
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Jun 2015 00:27:06 +0000 (20:27 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Jun 2015 00:27:06 +0000 (20:27 -0400)
to suit #3451 exclude these columns from the "params"
dictionary in the first place, revises pr github:181

lib/sqlalchemy/orm/persistence.py

index 254d3bf09a65cf2cac374133f39cd3220d251622..a42ed2f7c2f052fa1871a1bd9025ffc4e05c0d94 100644 (file)
@@ -443,7 +443,8 @@ def _collect_update_commands(
             params = dict(
                 (propkey_to_col[propkey].key, state_dict[propkey])
                 for propkey in
-                set(propkey_to_col).intersection(state_dict)
+                set(propkey_to_col).intersection(state_dict).difference(
+                    mapper._pk_keys_by_table[table])
             )
         else:
             params = {}
@@ -472,11 +473,12 @@ def _collect_update_commands(
             continue
 
         if bulk:
-            pk_params = {}
-            for propkey in set(propkey_to_col).intersection(mapper._pk_keys_by_table[table]):
-              col = propkey_to_col[propkey]
-              pk_params[col._label] = state_dict.get(propkey)
-              params.pop(col.key, None)
+            pk_params = dict(
+                (propkey_to_col[propkey]._label, state_dict.get(propkey))
+                for propkey in
+                set(propkey_to_col).
+                intersection(mapper._pk_keys_by_table[table])
+            )
         else:
             pk_params = {}
             for col in pks: