summaryrefslogtreecommitdiff
path: root/test/orm/inheritance
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-03-10 18:23:23 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-03-10 18:23:23 -0400
commit201ba16fc88439fa100023369dfdfe22625253c9 (patch)
tree66737cff2b959230969580d1cbbb3b921c778179 /test/orm/inheritance
parent66fa5b50a53ebe234f19e23b7dfa6ff310969996 (diff)
downloadsqlalchemy-201ba16fc88439fa100023369dfdfe22625253c9.tar.gz
- The subquery wrapping which occurs when joined eager loading
is used with a one-to-many query that also features LIMIT, OFFSET, or DISTINCT has been disabled in the case of a one-to-one relationship, that is a one-to-many with :paramref:`.relationship.uselist` set to False. This will produce more efficient queries in these cases. fixes #3249
Diffstat (limited to 'test/orm/inheritance')
-rw-r--r--test/orm/inheritance/test_relationship.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/orm/inheritance/test_relationship.py b/test/orm/inheritance/test_relationship.py
index 3c671c9c1..b1d99415d 100644
--- a/test/orm/inheritance/test_relationship.py
+++ b/test/orm/inheritance/test_relationship.py
@@ -571,20 +571,20 @@ class SelfReferentialM2MTest(fixtures.MappedTest, AssertsCompiledSQL):
# test that the splicing of the join works here, doesn't break in
# the middle of "parent join child1"
q = sess.query(Child1).options(joinedload('left_child2'))
- self.assert_compile(q.limit(1).with_labels().statement,
- "SELECT anon_1.child1_id AS anon_1_child1_id, anon_1.parent_id "
- "AS anon_1_parent_id, anon_1.parent_cls AS anon_1_parent_cls, "
- "child2_1.id AS child2_1_id, parent_1.id AS "
- "parent_1_id, parent_1.cls AS parent_1_cls FROM "
- "(SELECT child1.id AS child1_id, parent.id AS parent_id, "
- "parent.cls AS parent_cls "
+ self.assert_compile(
+ q.limit(1).with_labels().statement,
+ "SELECT child1.id AS child1_id, parent.id AS parent_id, "
+ "parent.cls AS parent_cls, child2_1.id AS child2_1_id, "
+ "parent_1.id AS parent_1_id, parent_1.cls AS parent_1_cls "
"FROM parent JOIN child1 ON parent.id = child1.id "
- "LIMIT :param_1) AS anon_1 LEFT OUTER JOIN "
- "(secondary AS secondary_1 JOIN "
+ "LEFT OUTER JOIN (secondary AS secondary_1 JOIN "
"(parent AS parent_1 JOIN child2 AS child2_1 "
- "ON parent_1.id = child2_1.id) ON parent_1.id = secondary_1.left_id) "
- "ON anon_1.parent_id = secondary_1.right_id",
- {'param_1':1})
+ "ON parent_1.id = child2_1.id) "
+ "ON parent_1.id = secondary_1.left_id) "
+ "ON parent.id = secondary_1.right_id "
+ "LIMIT :param_1",
+ checkparams={'param_1': 1}
+ )
# another way to check
assert q.limit(1).with_labels().subquery().count().scalar() == 1