]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- rename mapper._primary_key_props to mapper._identity_key_props
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 19 Aug 2014 22:26:11 +0000 (18:26 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 19 Aug 2014 22:26:11 +0000 (18:26 -0400)
- ensure bulk update is using all PK cols for all tables

lib/sqlalchemy/orm/mapper.py

index 63d23e31d1c538877cad8fb7abc45db1ec921619..31c17e69ef58c9287f5b4859c429ffc46228af4c 100644 (file)
@@ -1244,7 +1244,7 @@ class Mapper(InspectionAttr):
         self._readonly_props = set(
             self._columntoproperty[col]
             for col in self._columntoproperty
-            if self._columntoproperty[col] not in self._primary_key_props and
+            if self._columntoproperty[col] not in self._identity_key_props and
             (not hasattr(col, 'table') or
                 col.table not in self._cols_by_table))
 
@@ -2359,19 +2359,23 @@ class Mapper(InspectionAttr):
             manager[prop.key].
             impl.get(state, dict_,
                      attributes.PASSIVE_RETURN_NEVER_SET)
-            for prop in self._primary_key_props
+            for prop in self._identity_key_props
         ]
 
     @_memoized_configured_property
-    def _primary_key_props(self):
-        # TODO: this should really be called "identity key props",
-        # as it does not necessarily include primary key columns within
-        # individual tables
+    def _identity_key_props(self):
         return [self._columntoproperty[col] for col in self.primary_key]
 
+    @_memoized_configured_property
+    def _all_pk_props(self):
+        collection = set()
+        for table in self.tables:
+            collection.update(self._pks_by_table[table])
+        return collection
+
     @_memoized_configured_property
     def _primary_key_propkeys(self):
-        return set([prop.key for prop in self._primary_key_props])
+        return set([prop.key for prop in self._all_pk_props])
 
     def _get_state_attr_by_column(
             self, state, dict_, column,