- changed milestone to 0.9.10
- changed title to 0.9.10 / 1.0 regression re: column_descriptions w/ CTE
- edited description
0.9.10 / 1.0 regression re: column_descriptions w/ CTE
Issue #3403
resolved
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import aliased
Base = declarative_base()
class Part(Base):
__tablename__ = 'part'
part = Column(String, primary_key=True)
sub_part = Column(String, primary_key=True)
quantity = Column(Integer)
e = create_engine("postgresql://scott:tiger@localhost/test", echo=True)
Base.metadata.create_all(e)
session = Session(e)
included_parts = session.query(
Part.sub_part,
Part.part,
Part.quantity).\
filter(Part.part=="our part").\
cte(name="included_parts", recursive=True)
incl_alias = aliased(included_parts, name="pr")
parts_alias = aliased(Part, name="p")
included_parts = included_parts.union_all(
session.query(
parts_alias.sub_part,
parts_alias.part,
parts_alias.quantity).\
filter(parts_alias.part==incl_alias.c.sub_part)
)
q = session.query(included_parts)
print q.column_descriptions
#!
Traceback (most recent call last):
File "test.py", line 40, in <module>
print q.column_descriptions
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/query.py", line 2582, in column_descriptions
for ent in self._entities
AttributeError: 'CTE' object has no attribute 'entity'
Comments (3)
-
reporter -
reporter - changed status to resolved
- 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. fixes#3403references#3320
→ <<cset 20e3df602846>>
-
reporter - 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. fixes#3403references#3320
(cherry picked from commit 20e3df602846bb1d8940b5138f21ef203c99bade)
→ <<cset de8a9fd81408>>
- Fixed regression from as yet unreleased 0.9.10 where the new addition
of
- Log in to comment
woop! it's an 0.9 regression from b815e9483319b93f98bef11c7d
#3320