MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / go

Method go

test/orm/test_cache_key.py:1212–1234  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1210 A, B = self.classes("A", "B")
1211
1212 def go(value):
1213 with Session(testing.db) as sess:
1214 objects = sess.execute(
1215 select(A).options(
1216 loadopt(A.bs).options(
1217 with_expression(B.boolean, B.data == value)
1218 )
1219 )
1220 ).scalars()
1221 if loadopt is joinedload:
1222 objects = objects.unique()
1223 eq_(
1224 objects.all(),
1225 [
1226 A(
1227 bs=[
1228 B(data="a", boolean=value == "a"),
1229 B(data="b", boolean=value == "b"),
1230 B(data="c", boolean=value == "c"),
1231 ]
1232 )
1233 ],
1234 )
1235
1236 go("b")
1237 go("c")

Callers

nothing calls this directly

Calls 11

SessionClass · 0.90
selectFunction · 0.90
with_expressionFunction · 0.90
eq_Function · 0.90
AClass · 0.70
BClass · 0.70
scalarsMethod · 0.45
executeMethod · 0.45
optionsMethod · 0.45
uniqueMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected