I've seen similar discussions here, but it's been a while so perhaps
things have changed.

class Foo(Base):
  __tablename__ = 'foo'
  type = Column(Integer)
  __mapper_args__ = {'polymorphic_on': type}
  ...

class BarFoo(Foo):
  __mapper_args__ = {'polymorphic_identity': 1}
  bar_id = Column(Integer)
  # relations
  bar = relation('Bar')

class BazFoo(Foo):
  __mapper_args__ = {'polymorphic_identity': 2}
  baz_id = Column(Integer)
  # relations
  baz = relation('Baz')

## assume existence of Bar and Baz objects

Is there a way to say, query all Foo objects while eager-loading the
bar/baz relations?

 - Jae


--~--~---------~--~----~------------~-------~--~----~
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