I have a polymorphic class structure like this, with a lot of classes 
extending the parent class.  
In reality I'm using a Mixin that declares the visible_id column and it's 
defined with @declared_attr.cascading, but for simplicity:



class A(Base):
    __tablename__ = 'a'
    id = Column(Integer, primary_key=True)
   visible_id = Column(Integer)

class B(A):
    __tablename__ = 'b'
    id = Column(Integer, ForeignKey("A.id"), primary_key=True)
    visible_id = Column(Integer)


What I need for my application is to query A.visible_id and return the 
CHILD values for B.visible_id (and all the others).

The inheritance works fine, i.e. if i query all As in the database, my 
response is a list of [B] objects, but unless I directly query B the 
visible_id from A takes precedence and I cannot query A.visible_id if I 
remove it from A.

Can anyone tell me how to configure this? 

Thanks!

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/9a248c3e-ec1a-4e18-b663-3a03bab027e5%40googlegroups.com.

Reply via email to