summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-06-15 15:20:48 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-06-15 15:29:00 -0400
commitaee826890c7570fcf397c53794ff2b7418e24a97 (patch)
treec3f69a4e1236ab46fe19b6b9a74ebc1f31e73c56 /lib/sqlalchemy
parent0b2c7765a0a2344e9c933a0450c4a4b188d7aaec (diff)
downloadsqlalchemy-aee826890c7570fcf397c53794ff2b7418e24a97.tar.gz
Fixed bug in polymorphic SQL generation where multiple joined-inheritance
entities against the same base class joined to each other as well would not track columns on the base table independently of each other if the string of joins were more than two entities long. Also in 0.8.2. [ticket:2759] Conflicts: doc/build/changelog/changelog_09.rst
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/query.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index c2ec72c51..13699316f 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -203,17 +203,22 @@ class Query(object):
self._polymorphic_adapters.pop(m.local_table, None)
def _adapt_polymorphic_element(self, element):
+ if "parententity" in element._annotations:
+ search = element._annotations['parententity']
+ alias = self._polymorphic_adapters.get(search, None)
+ if alias:
+ return alias.adapt_clause(element)
+
if isinstance(element, expression.FromClause):
search = element
elif hasattr(element, 'table'):
search = element.table
else:
- search = None
+ return None
- if search is not None:
- alias = self._polymorphic_adapters.get(search, None)
- if alias:
- return alias.adapt_clause(element)
+ alias = self._polymorphic_adapters.get(search, None)
+ if alias:
+ return alias.adapt_clause(element)
def _adapt_col_list(self, cols):
return [