[Sqlalchemy-tickets] Issue #3117: AttributeError: 'Child' object has no attribute 'parent_id' (zzze
Brought to you by:
zzzeek
|
From: Gabriel B. <iss...@bi...> - 2014-07-08 22:19:13
|
New issue 3117: AttributeError: 'Child' object has no attribute 'parent_id' https://bitbucket.org/zzzeek/sqlalchemy/issue/3117/attributeerror-child-object-has-no Gabriel Becedillas: I get an error when executing an update ONLY after eager loading an association object. I can reproduce this on 0.9.4 and 0.9.6. In order to reproduce it you need to create a database named 'bugtest'. The output should look like this: ``` #!python Insert data Update ok Update fails on 0.9.4 Traceback (most recent call last): File "bugtest.py", line 73, in <module> trigger_bug(True) File "bugtest.py", line 64, in trigger_bug offending_update(session, parent) File "bugtest.py", line 52, in offending_update Child.name: "Doe", File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2748, in update update_op.exec_() File "/Library/Python/2.7/site-packages/sqlalchemy/orm/persistence.py", line 887, in exec_ self._do_pre_synchronize() File "/Library/Python/2.7/site-packages/sqlalchemy/orm/persistence.py", line 948, in _do_pre_synchronize eval_condition(obj)] File "/Library/Python/2.7/site-packages/sqlalchemy/orm/evaluator.py", line 72, in evaluate value = sub_evaluate(obj) File "/Library/Python/2.7/site-packages/sqlalchemy/orm/evaluator.py", line 97, in evaluate left_val = eval_left(obj) File "/Library/Python/2.7/site-packages/sqlalchemy/orm/evaluator.py", line 54, in <lambda> return lambda obj: get_corresponding_attr(obj) AttributeError: 'Child' object has no attribute 'parent_id' ``` |