Compared to the existing entry for ``"type"``, it will always be
a mapped entity, even if extracted from a column expression, or
None if the given expression is a pure core expression.
+ See also :ticket:`3403` which repaired a regression in this feature
+ which was unreleased in 0.9.10 but was released in the 1.0 version.
+
.. changelog::
:version: 0.9.9
.. changelog::
:version: 1.0.3
+ .. change::
+ :tags: bug, orm
+ :tickets: 3403, 3320
+
+ Fixed regression from as yet unreleased 0.9.10 where the new addition
+ of ``entity`` to the :attr:`.Query.column_descriptions` accessor
+ would fail if the target entity was produced from a core selectable
+ such as a :class:`.Table` or :class:`.CTE` object.
+
.. change::
:tags: feature, sql
'expr': ent.expr,
'entity':
ent.entity_zero.entity if ent.entity_zero is not None
+ and not inspect(ent.entity_zero).is_selectable
else None
}
for ent in self._entities
if 'parententity' in elem._annotations
and actual_froms.intersection(elem._from_objects)
])
-
if self.entities:
self.entity_zero = self.entities[0]
elif self.namespace is not None:
fn = func.count(User.id)
name_label = User.name.label('uname')
bundle = Bundle('b1', User.id, User.name)
+ cte = sess.query(User.id).cte()
for q, asserted in [
(
sess.query(User),
'expr': fn, 'entity': User},
]
),
+ (
+ sess.query(cte),
+ [
+ {
+ 'aliased': False,
+ 'expr': cte.c.id, 'type': cte.c.id.type,
+ 'name': 'id', 'entity': None
+ }]
+ ),
+ (
+ sess.query(users),
+ [
+ {'aliased': False,
+ 'expr': users.c.id, 'type': users.c.id.type,
+ 'name': 'id', 'entity': None},
+ {'aliased': False,
+ 'expr': users.c.name, 'type': users.c.name.type,
+ 'name': 'name', 'entity': None}
+ ]
+ ),
(
sess.query(users.c.name),
[{