summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-05-01 09:20:10 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-05-01 09:20:10 -0400
commit24d6ea362e757c79b3bada663cf6fc9f262dae4f (patch)
tree405dd515e99e9be734a37125166d230db3b9c4b0 /lib/sqlalchemy/orm/query.py
parent3cfda0a3c9026f0a80a9763fe12b9d61b3ad2910 (diff)
downloadsqlalchemy-24d6ea362e757c79b3bada663cf6fc9f262dae4f.tar.gz
- Repaired / added to tests yet more expressions that were reported
as failing with the new 'entity' key value added to :attr:`.Query.column_descriptions`, the logic to discover the "from" clause is again reworked to accommodate columns from aliased classes, as well as to report the correct value for the "aliased" flag in these cases. fixes #3409
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
-rw-r--r--lib/sqlalchemy/orm/query.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index f4b04b078..8421e42ac 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -2569,18 +2569,27 @@ class Query(object):
]
"""
+
return [
{
'name': ent._label_name,
'type': ent.type,
- 'aliased': getattr(ent, 'is_aliased_class', False),
+ 'aliased': getattr(insp_ent, 'is_aliased_class', False),
'expr': ent.expr,
'entity':
- ent.entity_zero.entity if ent.entity_zero is not None
- and not inspect(ent.entity_zero).is_selectable
+ getattr(insp_ent, "entity", None)
+ if ent.entity_zero is not None
+ and not insp_ent.is_clause_element
else None
}
- for ent in self._entities
+ for ent, insp_ent in [
+ (
+ _ent,
+ (inspect(_ent.entity_zero)
+ if _ent.entity_zero is not None else None)
+ )
+ for _ent in self._entities
+ ]
]
def instances(self, cursor, __context=None):