- changed status to resolved
eagerload() needs to target its parent class more closely
Issue #1461
resolved
i.e. in test_mapper - the below query should not eagerload:
@testing.resolve_artifact_names
def test_eagerload_on_other(self):
sess = create_session()
child1s = sess.query(Child1).join(Child1.related).options(sa.orm.eagerload(Child1.related)).order_by(Child1.id)
def go():
eq_(
child1s.all(),
[related=Related(id=1)), Child1(id=2, related=Related(id=2)), Child1(id=3, related=Related(id=3))](Child1(id=1,)
)
self.assert_sql_count(testing.db, go, 1)
c1 = child1s[0](0)
# this eagerloads, but should not. it's a bug that will require a rewrite
# of interfaces.PropertyOption.__get_paths
self.assert_sql_execution(
testing.db,
lambda: c1.child2,
CompiledSQL(
"SELECT base.id AS base_id, child2.id AS child2_id, base.type AS base_type, "
"related_1.id AS related_1_id FROM base JOIN child2 ON base.id = child2.id "
"LEFT OUTER JOIN related AS related_1 ON base.id = related_1.id WHERE base.id = :param_1",
{'param_1':4}
)
)
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.5.xx (automated comment)
- Log in to comment
5045bf4f4bae769743bc3bef4ec85453caf0fa41