- changed milestone to 0.6.8
column selection in nested selects overzealously skips down the chain of labels
Issue #2167
resolved
which means nothing. here's what it means:
from sqlalchemy.sql import table, column, select
t1 = table('t1', column('a'), column('b'))
s = select([ select([(t1.c.a + t1.c.b).label('q')](
)).label('y'),
])
#assert s.c.q is not None
assert s.c.y is not None
it puts it in as "q" and not "y". very strange ! At the ORM level you can test this via column_property() derived from another column_property().
Comments (4)
-
reporter -
reporter here's an ORM test too:
from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Author(Base): __tablename__ = 'authors' id = Column(Integer, primary_key=True) first_name = Column(String(50), nullable=False) last_name = Column(String(50), nullable=False) name = column_property((first_name + ' ' + last_name).label('name')) class Book(Base): __tablename__ = 'books' id = Column(Integer, primary_key=True) author_id = Column(Integer, ForeignKey('authors.id')) author_name = column_property( select( [Author.name](Author.name), author_id == Author.id, ).label('author_name') ) e = create_engine('sqlite://', echo=True) Base.metadata.create_all(e) s = Session(e) s.query(Book).from_self().all()
-
reporter - changed status to resolved
-
reporter - removed milestone
Removing milestone: 0.6.8 (automated comment)
- Log in to comment
wow this is a really odd bug to have at this stage in the game, that this never came up before.
that's it !