diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-03 22:13:17 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-03 22:13:17 +0000 |
| commit | 0af3f8f35b5e46f749d328e6fae90f6ff4915e97 (patch) | |
| tree | 8773ab5842f1b3ff39a2e05a9e5fc2ea132ec680 /lib/sqlalchemy/sql/visitors.py | |
| parent | 784eaa108a543602e4e7ad42828e8720106fd26d (diff) | |
| download | sqlalchemy-0af3f8f35b5e46f749d328e6fae90f6ff4915e97.tar.gz | |
- rewritten ClauseAdapter merged from the eager_minus_join branch; this is a much simpler
and "correct" version which will copy all elements exactly once, except for those which were
replaced with target elements. It also can match a wider variety of target elements including
joins and selects on identity alone.
Diffstat (limited to 'lib/sqlalchemy/sql/visitors.py')
| -rw-r--r-- | lib/sqlalchemy/sql/visitors.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 98e4de6c3..bf15c2b7e 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -1,8 +1,7 @@ class ClauseVisitor(object): - """A class that knows how to traverse and visit - ``ClauseElements``. + """Traverses and visits ``ClauseElement`` structures. - Calls visit_XXX() methods dynamically generated for each particualr + Calls visit_XXX() methods dynamically generated for each particular ``ClauseElement`` subclass encountered. Traversal of a hierarchy of ``ClauseElements`` is achieved via the ``traverse()`` method, which is passed the lead @@ -40,7 +39,7 @@ class ClauseVisitor(object): traversal.insert(0, t) for c in t.get_children(**self.__traverse_options__): stack.append(c) - + def traverse(self, obj, stop_on=None, clone=False): if clone: obj = obj._clone() @@ -75,13 +74,10 @@ class ClauseVisitor(object): return self class NoColumnVisitor(ClauseVisitor): - """a ClauseVisitor that will not traverse the exported Column - collections on Table, Alias, Select, and CompoundSelect objects - (i.e. their 'columns' or 'c' attribute). + """ClauseVisitor with 'column_collections' set to False; will not + traverse the front-facing Column collections on Table, Alias, Select, + and CompoundSelect objects. - this is useful because most traversals don't need those columns, or - in the case of DefaultCompiler it traverses them explicitly; so - skipping their traversal here greatly cuts down on method call overhead. """ __traverse_options__ = {'column_collections':False} |
