if primary_key is not None:
# set primary key attributes
- for i, col in enumerate(mapper._pks_by_table[table]):
- if mapper._get_state_attr_by_column(
- state, state_dict, col) \
- is None and len(primary_key) > i:
- mapper._set_state_attr_by_column(
- state, state_dict, col,
- primary_key[i])
+ for pk, col in zip(primary_key, mapper._pks_by_table[table]):
+ # TODO: make sure this inlined code is OK
+ # with composites
+ prop = mapper._columntoproperty[col]
+ if state_dict.get(prop.key) is None:
+ # TODO: would rather say:
+ # state_dict[prop.key] = pk
+ # here, one test fails
+ prop._setattr(state, state_dict, pk, col)
mapper._postfetch(uowtransaction, table,
state, state_dict, c,
get_committed_value(state, dict_, passive=passive)
def _setattr(self, state, dict_, value, column):
- state.get_impl(self.key).set(state, dict_, value, None)
+ state.manager[self.key].impl.set(state, dict_, value, None)
def merge(self, session, source_state, source_dict, dest_state,
dest_dict, load, _recursive):
# using sqlite3 the C extension took it back up to approx. 1257
# (py2.6)
- @profiling.function_call_count(1257, versions={'2.4': 807})
+ @profiling.function_call_count(1257,
+ versions={'2.6+cextension':1194, '2.4': 807}
+ )
def go():
p2 = sess2.merge(p1)
go()