Re: [sqlalchemy] query joining and filtering with table inheritance

2012-09-28 Thread Iain Duncan
On Fri, Sep 28, 2012 at 7:06 AM, Michael Bayer wrote: > This is the right answer. if you > query(Contact).with_polymorphic([Person, Organization]), you can refer to > Person. and Organization. in your query. It will > produce a LEFT OUTER JOIN from contact to each of the related tables. > You

Re: [sqlalchemy] query joining and filtering with table inheritance

2012-09-28 Thread Michael Bayer
This is the right answer. if you query(Contact).with_polymorphic([Person, Organization]), you can refer to Person. and Organization. in your query. It will produce a LEFT OUTER JOIN from contact to each of the related tables. On Sep 28, 2012, at 7:05 AM, lenart...@volny.cz wrote: > Hell

Re: [sqlalchemy] query joining and filtering with table inheritance

2012-09-28 Thread lenartlad
Hello. I am not at my development environment now so I cannot test it, but I think you want this: http://docs.sqlalchemy.org/en/rel_0_7/orm/inheritance.html?highlight=of_type#basic-control-of-which-tables-are-queried Ladislav Lenart PS: I'm by no means a DB or SQLA expert too :-) Od: "Iain D

[sqlalchemy] query joining and filtering with table inheritance

2012-09-27 Thread Iain Duncan
First off, sorry if it turns out that what I'm trying to do is smoke crack here, I'm by no means a DB or SQLA expert. =) I have two classes, Person and Organization, that use table inheritance to inherit from Contact. ( Person.id is an fkey to Contact.id ), which is working fine. I want to search