- attached mapper_extension_test.py
InstrumentationManager causes problems with session if a mapper extension is in use.
class DummyInstrumentation(interfaces.InstrumentationManager): pass
sqlalchemy.orm.attributes.instrumentation_finders.append( lambda cls: DummyInstrumentation)
We get very odd results when using an instrumentation manager and a session extension even with dummy implementations. The problem can be reproduced by the code in the attachment against 5.3. The problem does not appear to be in 0.5.4p2 or against a checked out of the main trunk at r6099.
I guess that I am filing this for reference purposes only as we will upgrade to 0.5.4p2 to workaround the problem.
Comments (3)
-
reporter -
repo owner the default
InstrumentationManager
in 0.5.3 and earlier has a bug. this fixes it:Index: lib/sqlalchemy/orm/attributes.py =================================================================== --- lib/sqlalchemy/orm/attributes.py (revision 6099) +++ lib/sqlalchemy/orm/attributes.py (working copy) @@ -1444,7 +1444,7 @@ # the given instance is assumed to have no state self._adapted.install_state(self.class_, instance, state) - state.dict = self._adapted.get_instance_dict(self.class_, instance) + #state.dict = self._adapted.get_instance_dict(self.class_, instance) return state def teardown_instance(self, instance):
the error occurs since the merge sequence causes the object to be garbage collected, then resurrected, but using the wrong dictionary due to the line above, which then makes it look like the attributes have been blanked out (hence the update).
after 0.5.3 the attributes system was overhauled, and the "resurrection" system is no longer used except in the case of mutable attributes.
-
repo owner - removed milestone
Removing milestone: 0.5.4 (automated comment)
- Log in to comment
program that demonstrates problem with instrumentation and mapper extension