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:20:48 -0400
commitb92007da7d9cd7453a2da9f1767e8a988f05acb7 (patch)
tree8995ad4e01d445092982bd1881f408c5ba5c4fb5 /lib/sqlalchemy
parent9d3e2206363d819ad334d7893c700b861fdc5b57 (diff)
downloadsqlalchemy-b92007da7d9cd7453a2da9f1767e8a988f05acb7.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]
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 54f5d7393..bd3ee8f72 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 [