summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/expression.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-12-16 02:54:42 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-12-16 02:54:42 +0000
commit6c179ff694b7908484455b36426c4cde496eb677 (patch)
tree3bcebabec86da8f0f1a612bfe6f8a94b0139cd77 /lib/sqlalchemy/sql/expression.py
parent66e1cdd1d923435e130431ff4123327e13ced0fa (diff)
downloadsqlalchemy-6c179ff694b7908484455b36426c4cde496eb677.tar.gz
moved hide_froms and aggregate_hide_froms to be only on FromClause
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r--lib/sqlalchemy/sql/expression.py47
1 files changed, 19 insertions, 28 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index dabc10dec..a4d8fa6a0 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -873,21 +873,6 @@ class ClauseElement(object):
raise NotImplementedError(repr(self))
- def _aggregate_hide_froms(self, **modifiers):
- """Return a list of ``FROM`` clause elements which this ``ClauseElement`` replaces, taking into account
- previous ClauseElements which this ClauseElement is a clone of."""
-
- s = self
- while s is not None:
- for h in s._hide_froms(**modifiers):
- yield h
- s = getattr(s, '_is_clone_of', None)
-
- def _hide_froms(self, **modifiers):
- """Return a list of ``FROM`` clause elements which this ``ClauseElement`` replaces."""
-
- return []
-
def unique_params(self, *optionaldict, **kwargs):
"""Return a copy with ``bindparam()`` elments replaced.
@@ -1663,6 +1648,22 @@ class FromClause(Selectable):
"""
return getattr(self, 'name', self.__class__.__name__ + " object")
description = property(description)
+
+ def _aggregate_hide_froms(self, **modifiers):
+ """Return a list of ``FROM`` clause elements which this ``FromClause`` replaces, taking into account
+ the element which this element was cloned from (and so on until the orginal is reached).
+ """
+
+ s = self
+ while s is not None:
+ for h in s._hide_froms(**modifiers):
+ yield h
+ s = getattr(s, '_is_clone_of', None)
+
+ def _hide_froms(self, **modifiers):
+ """Return a list of ``FROM`` clause elements which this ``FromClause`` replaces."""
+
+ return []
def _clone_from_clause(self):
# delete all the "generated" collections of columns for a
@@ -2218,9 +2219,6 @@ class _Exists(_UnaryExpression):
e.element = self.element.where(clause).self_group()
return e
- def _hide_froms(self, **modifiers):
- return self._get_from_objects(**modifiers)
-
class Join(FromClause):
"""represent a ``JOIN`` construct between two ``FromClause`` elements.
@@ -2504,9 +2502,6 @@ class _ColumnElementAdapter(ColumnElement):
def get_children(self, **kwargs):
return self.elem,
- def _hide_froms(self, **modifiers):
- return self.elem._hide_froms(**modifiers)
-
def _get_from_objects(self, **modifiers):
return self.elem._get_from_objects(**modifiers)
@@ -2586,9 +2581,6 @@ class _Label(ColumnElement):
def _get_from_objects(self, **modifiers):
return self.obj._get_from_objects(**modifiers)
- def _hide_froms(self, **modifiers):
- return self.obj._hide_froms(**modifiers)
-
def _make_proxy(self, selectable, name = None):
if isinstance(self.obj, (Selectable, ColumnElement)):
return self.obj._make_proxy(selectable, name=self.name)
@@ -3077,7 +3069,6 @@ class Select(_SelectBaseMixin, FromClause):
hide_froms = util.Set()
for col in self._raw_columns:
- hide_froms.update(col._aggregate_hide_froms())
froms.update(col._get_from_objects())
if self._whereclause is not None:
@@ -3085,9 +3076,9 @@ class Select(_SelectBaseMixin, FromClause):
if self._froms:
froms.update(self._froms)
- for elem in self._froms:
- hide_froms.update(elem._aggregate_hide_froms())
-
+
+ for f in froms:
+ hide_froms.update(f._aggregate_hide_froms())
froms = froms.difference(hide_froms)
if len(froms) > 1: