Book-keeping for UOW about dirty elements
Issue #998
resolved
This is a note I took when working on SA during the PyCon 2008 sprint. We found that it is very expensive for the UOW to find out which objects are dirty. We thought it might be worthwhile to make the UOW do some book-keeping to allow answering the question faster.
Comments (5)
-
repo owner -
repo owner the implementation is completed as of 27960c946389971d7a9681bb8d5a4e1a8154d61d on the branch. can close this ticket when the branch is merged to trunk.
-
- changed milestone to 0.5.0
-
repo owner - changed status to resolved
0.5 is merged.
-
repo owner - removed milestone
Removing milestone: 0.5.0 (automated comment)
- Log in to comment
yeah....we're going to do what you recommended. The current logic that flips "state.modified" will be converted to a descriptor on
InstanceState
that flips a similar flag on the parent identity map object (currentlyWeakInstanceDict
/StrongInstanceDict
).UnitOfWork
will use this flag for an immediate "dirty" check.For "mutable" attributes, the
InstanceState
will also get a list over to the identity map which stores all the "mutable" properties, possibly as a dict ofMutableScalarAttributeImpl
objects to sets ofInstanceState
objects which require a check on that attribute. this is a reasonably clean place to put it sinceInstanceState
is already managing itself w.r.t the identity map.I think I also might want to lock down the API on the identity map classes, such that we do something like:
they will still be dicts from the "get" side but we have all the "set" methods raise
NotImplementedError
.