[Sqlalchemy-tickets] [sqlalchemy] #2316: adaptation within query.join() etc. being weird for column
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2011-10-31 02:09:27
|
#2316: adaptation within query.join() etc. being weird for column prop against instrumented col --------------------+------------------------------------------------------- Reporter: zzzeek | Owner: zzzeek Type: defect | Status: new Priority: high | Milestone: 0.7.4 Component: orm | Severity: major - 1-3 hours Keywords: | Status_field: in queue --------------------+------------------------------------------------------- the column_property expression fails to get adapted {{{ #!python from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base= declarative_base() class A(Base): __tablename__ = "a" id = Column(Integer, primary_key=True) type = Column(String(40), nullable=False) __mapper_args__ = {'polymorphic_on': type} # works # anything = column_property(id + 1000) # works # A.anything = column_property(A.__table__.c.id + 1000) # fails A.anything = column_property(A.id + 1000) class B(A): __tablename__ = "b" account_id = Column(Integer, ForeignKey('a.id'), primary_key=True) x_id = Column(Integer, ForeignKey('x.id'), nullable=False) __mapper_args__ = {'polymorphic_identity': 'named'} class X(Base): __tablename__ = "x" id = Column(Integer, primary_key=True) b = relationship("B") s = Session() # joins: print s.query(X, B).join("b") # or joinedload() print s.query(X).options(joinedload("b")) # or subqueryload() -- Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2316> sqlalchemy <http://www.sqlalchemy.org/> The Database Toolkit for Python |