From 70580de8bd51834e39712c09fadb64ac8559ae65 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 30 Oct 2005 02:50:52 +0000 Subject: [PATCH] --- lib/sqlalchemy/sql.py | 13 ++++++++----- lib/sqlalchemy/util.py | 7 ------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index c3071e0b0c..6262cc3ad5 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -556,14 +556,17 @@ class Join(Selectable): engine = property(lambda s:s.left.engine or s.right.engine) + class JoinMarker(FromClause): + def __init__(self, id, join): + FromClause.__init__(self, from_key=id) + self.join = join + def _process_from_dict(self, data, asfrom): for f in self.onclause._get_from_objects(): data[f.id] = f for f in self.left._get_from_objects() + self.right._get_from_objects(): - # mark the object as a "blank" from that wont be printed - # TODO: now, when one of the existing froms is also a join that should be - # joined to us, join up to it. - data[f.id] = FromClause(from_key=f.id) + # mark the object as a "blank" "from" that wont be printed + data[f.id] = Join.JoinMarker(f.id, self) # a JOIN always impacts the final FROM list of a select statement data[self.id] = self @@ -700,7 +703,7 @@ class Select(Selectable): self.columns = util.OrderedProperties() self.froms = util.OrderedDict() self.use_labels = use_labels - self.id = id(self) + self.id = "Select(%d)" % id(self) self.name = None self.whereclause = whereclause self._engine = engine diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index 3b006c2207..2276ef5544 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -337,11 +337,6 @@ class DependencySorter(object): self.children = HashSet() self.parent = None self.circular = False - def append(self, node): - if node.parent is not None: - del node.parent.children[node] - self.children.append(node) - node.parent = self def __str__(self): return self.safestr({}) def safestr(self, hash, indent = 0): @@ -392,13 +387,11 @@ class DependencySorter(object): del parentnode.children[c] root.parent = parentnode parentnode.children.append(root) - print str(parentnode) # now we have a collection of subtrees which represent dependencies. # go through the collection root nodes wire them together into one tree head = None for node in nodes.values(): - print "hi1:" + str(node) if node.parent is None: if head is not None: head.append(node) -- 2.47.2