On May 13, 2008, at 4:53 PM, Yannick Gingras wrote:
> > If I want to query on containers and on area, I can simply do > > q = Container.query().filter(...) > > but, if I receive a query on Item and a base class, say either Item, > Container or Area, how can I filter() my query to receive only the > sub-items from this base class? filter on type_.in(["area", "container"]) is one approach. Easier though is session.query(Container); it'll load from the join of items/ containers so you wouldn't get any non-Container objects. with_polymorphic() only speaks to what subclasses are eagerly loaded and will be available for filtering. Though its something to think about if base classes are not included in WP, should that change the base class; I'd say no, since you are reversing intent. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---