From: Mike Bayer Date: Sun, 14 Jun 2015 00:27:06 +0000 (-0400) Subject: - restore the approach we have for pk_params, but in order X-Git-Tag: rel_1_0_6~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcbfcca2360a58ec1b5a9da1b2c45e8781904b82;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - restore the approach we have for pk_params, but in order to suit #3451 exclude these columns from the "params" dictionary in the first place, revises pr github:181 --- diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py index 254d3bf09a..a42ed2f7c2 100644 --- a/lib/sqlalchemy/orm/persistence.py +++ b/lib/sqlalchemy/orm/persistence.py @@ -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: