CachingQuery fails merging objects without any obvious pattern
Traceback (most recent call last): File "/home/errormator/errormator/errormator/security.py", line 22, in init self.application = Resource.by_resource_id(application_id) File "/home/errormator/errormator/errormator/models.py", line 609, in by_resource_id return q.first() File "/home/errormator/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1677, in first ret = list(self0:1) File "/home/errormator/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1574, in getitem return list(res) File "/home/errormator/errormator/errormator/lib/sqlalchemy_ext/init.py", line 83, in iter return self.get_value(createfunc=lambda: list(Query.iter(self))) File "/home/errormator/errormator/errormator/lib/sqlalchemy_ext/init.py", line 103, in get_value ret = self.merge_result(ret, load=False) File "/home/errormator/python/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1914, in merge_result for instance in iterator] File "/home/errormator/python/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1249, in _merge "merge() with load=False option does not support " InvalidRequestError: merge() with load=False option does not support objects marked as 'dirty'. flush() all changes on mapped instances before merging with load=False.
Comments (3)
-
Account Deleted -
repo owner - changed status to invalid
The pattern is, objects in the cache can't have any pending changes on them when load=False. If you throw a pdb.set_trace() into your iter() method, take a look at session.is_modified(obj), attributes.get_history(obj, attrname), that will reveal what modifications have occurred on the objects.
K guess we're talking on irc, there's likely no bug here
-
repo owner - changed milestone to 1.x.xx
- Log in to comment
this error happens in other places too, i should note that i tried testing something in my app and:
session shows that object is not marked as dirty
IdentitySet([]) IdentitySet( IdentitySet([)) 2011-02-14 06:02:00,917 ERROR errormator.handlers.util5 Traceback (most recent call last): ...SNAP....
InvalidRequestError: merge() with load=False option does not support objects marked as 'dirty'. flush() all changes on mapped instances before merging with load=False.