[Sqlalchemy-tickets] Issue #3811: Eager load does not work as expected under special circumstances
Brought to you by:
zzzeek
From: ddzialak <iss...@bi...> - 2016-10-03 16:59:57
|
New issue 3811: Eager load does not work as expected under special circumstances https://bitbucket.org/zzzeek/sqlalchemy/issues/3811/eager-load-does-not-work-as-expected-under ddzialak: My postgresql database keep huge tree thus I have to use yield_per and I want to use eager load to make sure there is no separated query for parent. Unfortunately eager load does not work if parent will be returned in next `yield_per` portion (see attached script). Attached script is reproducing that bug with `SQLAlchemy==1.1.0b3` I've used that version as I've though that issue is fixed by: https://bitbucket.org/zzzeek/sqlalchemy/issues/3431/object-eager-loaded-on-scalar-relationship Currectly output is: ``` delete from create_all SELECT parent_1.id AS parent_1_id, parent_1.name AS parent_1_name, parent_1.parent_id AS parent_1_parent_id, parent.id AS parent_id_1, parent.name AS parent_name, parent.parent_id AS parent_parent_id FROM parent LEFT OUTER JOIN parent AS parent_1 ON parent_1.id = parent.parent_id Parent(11, name) has parent parent 33 ------- ERR: 'Parent.parent' is not available due to lazy='raise' Parent(22, p2) has parent None ------- WITH: None Parent(33, p3) has parent parent 22 ------- WITH: Parent(22, p2) has parent None ``` Responsible: zzzeek |