From 8ebc8ee5bae0f4bef465e8b5b4b46609cfdebc10 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 3 Nov 2007 23:17:34 +0000 Subject: - eager loading with LIMIT/OFFSET applied no longer adds the primary table joined to a limited subquery of itself; the eager loads now join directly to the subquery which also provides the primary table's columns to the result set. This eliminates a JOIN from all eager loads with LIMIT/OFFSET. [ticket:843] --- lib/sqlalchemy/sql/visitors.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index bf15c2b7e..9bc5d2479 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -29,6 +29,14 @@ class ClauseVisitor(object): if meth: return meth(obj, **kwargs) + def traverse_chained(self, obj, **kwargs): + v = self + while v is not None: + meth = getattr(self, "visit_%s" % obj.__visit_name__, None) + if meth: + meth(obj, **kwargs) + v = getattr(v, '_next', None) + def iterate(self, obj, stop_on=None): stack = [obj] traversal = [] -- cgit v1.2.1