with_parent() doesnt work w/ aliased class
Issue #3607
resolved
continuation of #3606
this would need a lot more tinkering with the with_parent constructs
+ @testing.fails("")
+ def test_select_from_alias(self):
+ User, Address = self.classes.User, self.classes.Address
+
+ sess = create_session()
+ u1 = sess.query(User).get(7)
+ a1 = aliased(Address)
+ q = sess.query(a1).with_parent(u1)
+ self.assert_compile(
+ q,
+ "SELECT addresses_1.id AS addresses_1_id, "
+ "addresses_1.user_id AS addresses_1_user_id, "
+ "addresses_1.email_address AS addresses_1_email_address "
+ "FROM addresses AS addresses_1 "
+ "WHERE :param_1 = addresses_1.user_id",
+ {'param_1': 7}
+ )
Comments (2)
-
reporter -
reporter - changed status to resolved
Add clause adaptation for AliasedClass to with_parent()
Fixed bug where :meth:
.Query.with_parent
would not work if the :class:.Query
were against an :func:.aliased
construct rather than a regular mapped class. Also adds a new parameter :paramref:.util.with_parent.from_entity
to the standalone :func:.util.with_parent
function as well as :meth:.Query.with_parent
.Change-Id: Ic684dd63cc90b582c7580c9bba3c92fa3f286da7 Fixes:
#3607→ <<cset 1c692f019b16>>
- Log in to comment
https://gerrit.sqlalchemy.org/410