summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-12-03 17:28:36 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-12-03 17:28:36 +0000
commit0410eae36b36dc8ea7e747c4b81c7ec9de5f2da4 (patch)
tree86a53b2b2c33a3348d6aca9c7bc825315816748f /lib/sqlalchemy/sql/util.py
parent851a14aa1a0e7a734a6f810f0e6e5c39d8e63b1b (diff)
downloadsqlalchemy-0410eae36b36dc8ea7e747c4b81c7ec9de5f2da4.tar.gz
- Two fixes to help prevent out-of-band columns from
being rendered in polymorphic_union inheritance scenarios (which then causes extra tables to be rendered in the FROM clause causing cartesian products): - improvements to "column adaption" for a->b->c inheritance situations to better locate columns that are related to one another via multiple levels of indirection, rather than rendering the non-adapted column. - the "polymorphic discriminator" column is only rendered for the actual mapper being queried against. The column won't be "pulled in" from a subclass or superclass mapper since it's not needed.
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r--lib/sqlalchemy/sql/util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index d5f2417c2..1bd4dd857 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -439,12 +439,12 @@ class ClauseAdapter(visitors.ReplacingCloningVisitor):
self.exclude = exclude
self.equivalents = equivalents or {}
- def _corresponding_column(self, col, require_embedded):
+ def _corresponding_column(self, col, require_embedded, _seen=util.EMPTY_SET):
newcol = self.selectable.corresponding_column(col, require_embedded=require_embedded)
- if not newcol and col in self.equivalents:
+ if not newcol and col in self.equivalents and col not in _seen:
for equiv in self.equivalents[col]:
- newcol = self.selectable.corresponding_column(equiv, require_embedded=require_embedded)
+ newcol = self._corresponding_column(equiv, require_embedded=require_embedded, _seen=_seen.union([col]))
if newcol:
return newcol
return newcol