MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_select_from_alias

Method test_select_from_alias

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

Source from the content-addressed store, hash-verified

5965 )
5966
5967 def test_select_from_alias(self):
5968 User, Address = self.classes.User, self.classes.Address
5969
5970 sess = fixture_session()
5971 u1 = sess.get(User, 7)
5972 a1 = aliased(Address)
5973 q = sess.query(a1).filter(with_parent(u1, User.addresses.of_type(a1)))
5974 self.assert_compile(
5975 q,
5976 "SELECT addresses_1.id AS addresses_1_id, "
5977 "addresses_1.user_id AS addresses_1_user_id, "
5978 "addresses_1.email_address AS addresses_1_email_address "
5979 "FROM addresses AS addresses_1 "
5980 "WHERE :param_1 = addresses_1.user_id",
5981 {"param_1": 7},
5982 )
5983
5984 def test_select_from_alias_from_entity(self):
5985 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