[sqlalchemy] Re: Query filtering like isinstance()

2008-05-14 Thread Yannick Gingras
Michael Bayer [EMAIL PROTECTED] writes: 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

[sqlalchemy] Re: Query filtering like isinstance()

2008-05-14 Thread Michael Bayer
On May 14, 2008, at 10:56 AM, Yannick Gingras wrote: Michael Bayer [EMAIL PROTECTED] writes: 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

[sqlalchemy] Re: Query filtering like isinstance()

2008-05-14 Thread Yannick Gingras
Michael Bayer [EMAIL PROTECTED] writes: Sounds good. I didn't find how to get the polymorphic_identity of a mapped class. Is it possible to retried it if I have only the class object? This is not a big problem since I can use Item.__name__ as the polymorphic_identity.

[sqlalchemy] Re: Query filtering like isinstance()

2008-05-13 Thread Michael Bayer
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