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

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.

-- 
Yannick Gingras

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

Reply via email to