- marked as blocker
adaptation within query.join() etc. being weird for column prop against instrumented col
Issue #2316
resolved
the column_property expression fails to get adapted
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()
Comments (3)
-
reporter -
reporter - changed status to resolved
that was much, much harder than anticipated, as the deannotation was tripping off the "froms already generated" thing. Removed that whole check as well as the caching of _froms, the complexity here is not worth it and there's no real performance hit for the vast majority of usages. 699146086df8fd8778582a03267f8f28c5cdad7a
-
reporter - removed milestone
Removing milestone: 0.7.4 (automated comment)
- Log in to comment
and here's the fix !