[Sqlalchemy-tickets] Issue #4116: Accessing AssociationProxy of aliased model breaks it (zzzeek/sql
Brought to you by:
zzzeek
From: dima-starosud <iss...@bi...> - 2017-10-19 09:25:18
|
New issue 4116: Accessing AssociationProxy of aliased model breaks it https://bitbucket.org/zzzeek/sqlalchemy/issues/4116/accessing-associationproxy-of-aliased dima-starosud: This is using sqlalchemy 1.2.0b3. When `AssociationProxy` is first accessed on `aliased` it leads to setting `owning_class` to that `AliasedClass`, which then leads to exceptions inside lib. Please see details in following code snippet. ``` #!python class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) value = Column(String) class B(Base): __tablename__ = 'b' id = Column(Integer, primary_key=True) a_id = Column(Integer, ForeignKey(A.id)) a = relationship(A) a_value = association_proxy('a', 'value') print(aliased(B).a_value) # Due to this call line below fails print(B(a=A(value=4)).a_value) # Class object expected, got '<AliasedClass at 0x7f491cbb3048; B>'. ``` |