]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
that was easy
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 23 Mar 2010 15:14:02 +0000 (11:14 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 23 Mar 2010 15:14:02 +0000 (11:14 -0400)
lib/sqlalchemy/orm/strategies.py
test/orm/test_subquery_relations.py

index db3d565c461de516ab4434980f1a19ef1d8a454f..46cfdbe61c27168af11012a705a2a2c1c4b21f56 100644 (file)
@@ -704,24 +704,9 @@ class SubqueryLoader(AbstractRelationshipLoader):
 
         q = q.order_by(*local_attr)
         
-        # place loaderstrategy tokens in the new query
-        # so that further loader strategy options take effect.
-        # TODO: use the actual options in the parent query, 
-        # figure out how to achieve the path-manipulation
-        # (should probably use _current_path).
-        # some of these options may be user-defined so they
-        # must propagate.
-        # consider adding a new call to MapperOption that is
-        # specific to subquery loads.
-        for attr in context.attributes:
-            strat, opt_path = attr
-            if strat == "loaderstrategy":
-                # TODO: make sure we understand this part
-                #opt_path = opt_path[len(path):] # works, i think this 
-                                                # leaves excess tho
-                opt_path = opt_path[2:] # also works
-                q._attributes[("loaderstrategy", opt_path)] =\
-                    context.query._attributes[attr]
+        # propagate loader options etc. to the new query
+        q = q._with_current_path(subq_path)
+        q = q._conditional_options(*orig_query._with_options)
         
         if self.parent_property.order_by:
             q = q.order_by(*self.parent_property.order_by)
index c379e7489125b016919ec9177fa8a32874ec60a2..efa589f3c65522ddcdbee52644d43d47563347e8 100644 (file)
@@ -174,6 +174,7 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
         ("subqueryload", "subqueryload", "eagerload", 3),
     ]
 #    _pathing_runs = [("subqueryload", "subqueryload", "eagerload", 3)]
+#    _pathing_runs = [("subqueryload", "subqueryload", "subqueryload", 4)]
 
     def test_options_pathing(self):
         self._do_options_test(self._pathing_runs)