From 24d6ea362e757c79b3bada663cf6fc9f262dae4f Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 1 May 2015 09:20:10 -0400 Subject: - 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 --- lib/sqlalchemy/__init__.py | 2 +- lib/sqlalchemy/orm/query.py | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index 153b10a2b..6f7a4f723 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -120,7 +120,7 @@ from .schema import ( from .inspection import inspect from .engine import create_engine, engine_from_config -__version__ = '1.0.3' +__version__ = '1.0.4' def __go(lcls): 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): -- cgit v1.2.1