MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_joinedload

Method test_joinedload

test/orm/test_ac_relationships.py:281–301  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

279 )
280
281 def test_joinedload(self):
282 A, B = self.classes("A", "B")
283
284 sess = fixture_session()
285
286 with self.sql_execution_asserter() as asserter:
287 # note this is many-to-one. use_get is unconditionally turned
288 # off for relationship to aliased class for now.
289 a1 = sess.query(A).options(joinedload(A.b)).first()
290 eq_(a1.b, B(id=1))
291
292 asserter.assert_(
293 CompiledSQL(
294 "SELECT a.id AS a_id, a.b_id AS a_b_id, b_1.id AS b_1_id "
295 "FROM a LEFT OUTER JOIN (b AS b_1 "
296 "JOIN d AS d_1 ON d_1.b_id = b_1.id "
297 "JOIN c AS c_1 ON c_1.id = d_1.c_id) ON a.b_id = b_1.id "
298 "LIMIT :param_1",
299 [{"param_1": 1}],
300 )
301 )
302
303 def test_selectinload(self):
304 A, B = self.classes("A", "B")

Callers

nothing calls this directly

Calls 10

fixture_sessionFunction · 0.90
joinedloadFunction · 0.90
eq_Function · 0.90
CompiledSQLClass · 0.90
BClass · 0.70
firstMethod · 0.45
optionsMethod · 0.45
queryMethod · 0.45
assert_Method · 0.45

Tested by

no test coverage detected