Assuming I have the following simplified classes:

class A(Base):
    __tablename__ = 'a'
    id = Column(Integer, primary_key=True)
    type = Column(Unicode)
    enabled = Column(Boolean)
    __mapper_args__ = {'polymorphic_on': type}

class B(A):
    __tablename__ = 'b'
    __mapper_args__ = {'polymorphic_identity': u'type b'}

    id = Column(Integer, ForeignKey('A.id'), primary_key=True)
    col1 = Column(Unicode)

class C(A):
    __tablename__ = 'c'
    __mapper_args__ = {'polymorphic_identity': u'type c'}

    id = Column(Integer, ForeignKey('A.id'), primary_key=True)
    col2 = Column(Unicode)

I would like to perform a query like this:
a_list=session.query(A).filter(A.enabled == True).all()
and have all the subclass fields eagerly loaded.  It appears only the
fields belonging to class A (type, enabled) are loaded by default.  Is
there an easy way to do this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to