is_modified fails if the mapped class has a synonym attribute
Issue #1550
resolved
In SQLAlchemy 0.4.8, the is_modified function of session is failing when the mapped class has a synonym attribute.
Note that the bug is not present in SA 0.5.6.
The attached program reproduce the problem and has the following output :
$ python sabug_is_modified_fails_with_synonym.py Traceback (most recent call last):
File "sabug_is_modified_fails_with_synonym.py", line 34, in <module>
print object_session(instance).is_modified(instance, include_collections=False)
File "/home/cdevienne/tmp/sa05/lib/python2.5/site-packages/SQLAlchemy-0.4.8-py2.5.egg/sqlalchemy/orm/session.py", line 1195, in is_modified
(added, unchanged, deleted) = attr.get_history(instance)
File "/home/cdevienne/tmp/sa05/lib/python2.5/site-packages/SQLAlchemy-0.4.8-py2.5.egg/sqlalchemy/orm/attributes.py", line 47, in get_history
return self.impl.get_history(instance._state, **kwargs)
AttributeError: 'ProxyImpl' object has no attribute 'get_history'
Comments (5)
-
Account Deleted -
Account Deleted - attached workaround.py
A monkey patch that solve the issue
-
repo owner we've stopped releasing 0.4 so your best bet is to upgrade onto 0.5.
-
repo owner - changed status to wontfix
-
repo owner - removed milestone
Removing milestone: 0.4.xx (automated comment)
- Log in to comment
Forgot to add my mail as a CC... I am Christophe de Vienne, and my email is cdevienne@gmail.com if you have any question.
Christophe