summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-07-18 14:58:26 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-07-18 15:02:39 -0400
commit3d41ea09a899b06feedd02864a69b8dc833f5a6b (patch)
tree1a1008d7ee2435de90b14abae32e7ade9cd8c845 /test
parent32f67637cd705840751bd1d8d37db87df5823a4b (diff)
downloadsqlalchemy-3d41ea09a899b06feedd02864a69b8dc833f5a6b.tar.gz
Check for non-entity when inspecting for subqueryload
Fixed issue where adding additional non-entity columns to a query that includes an entity with subqueryload relationships would fail, due to an inspection added in 1.1.11 as a result of :ticket:`4011`. Change-Id: I8ef082be649125bdc07b428cb9b0a77a65d73671 Fixes: #4033
Diffstat (limited to 'test')
-rw-r--r--test/orm/test_subquery_relations.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/orm/test_subquery_relations.py b/test/orm/test_subquery_relations.py
index 7561c0f7c..606beb5aa 100644
--- a/test/orm/test_subquery_relations.py
+++ b/test/orm/test_subquery_relations.py
@@ -540,6 +540,25 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
eq_(self.static.user_address_result,
sess.query(User).order_by(User.id).all())
+ def test_add_arbitrary_exprs(self):
+ Address, addresses, users, User = (self.classes.Address,
+ self.tables.addresses,
+ self.tables.users,
+ self.classes.User)
+
+ mapper(Address, addresses)
+ mapper(User, users, properties=dict(
+ addresses=relationship(Address, lazy='subquery')
+ ))
+
+ sess = create_session()
+
+ self.assert_compile(
+ sess.query(User, '1'),
+ "SELECT users.id AS users_id, users.name AS users_name, "
+ "1 FROM users"
+ )
+
def test_double(self):
"""Eager loading with two relationships simultaneously,
from the same table, using aliases."""