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

Method test_select_from_alias

test/orm/test_query.py:6492–6507  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

6490 )
6491
6492 def test_select_from_alias(self):
6493 User, Address = self.classes.User, self.classes.Address
6494
6495 sess = fixture_session()
6496 u1 = sess.get(User, 7)
6497 a1 = aliased(Address)
6498 q = sess.query(a1).filter(with_parent(u1, User.addresses.of_type(a1)))
6499 self.assert_compile(
6500 q,
6501 "SELECT addresses_1.id AS addresses_1_id, "
6502 "addresses_1.user_id AS addresses_1_user_id, "
6503 "addresses_1.email_address AS addresses_1_email_address "
6504 "FROM addresses AS addresses_1 "
6505 "WHERE :param_1 = addresses_1.user_id",
6506 {"param_1": 7},
6507 )
6508
6509 def test_select_from_alias_from_entity(self):
6510 User, Address = self.classes.User, self.classes.Address

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
aliasedFunction · 0.90
with_parentFunction · 0.90
assert_compileMethod · 0.80
getMethod · 0.45
filterMethod · 0.45
queryMethod · 0.45
of_typeMethod · 0.45

Tested by

no test coverage detected