Re: [sqlalchemy] [Q] SA 0.7.9 - missing from when using union_all and joinedload_all

2013-02-28 Thread Ladislav Lenart
Thank you very much for your valuable time, Michael! Your example code seems correct. The only differences I found are: * Missing FK on ImportedPartnerShare.partner_id: class ImportedPartnerShare(Base): deal_id = Column(Integer, ForeignKey('deal.id')) partner_id = Column(Integer,

[sqlalchemy] [Q] SA 0.7.9 - missing from when using union_all and joinedload_all

2013-02-27 Thread Ladislav Lenart
Hello. Suppose I have the following mapped classes, A and B, that have two distinct M:N relationships, AB1 and AB2. If A.x is null, only relations in AB1 apply. If it is not null, only relations in AB2 apply. A also has 1:N relationship to C (one A can have more Cs). Finally, A is infact a joined

Re: [sqlalchemy] [Q] SA 0.7.9 - missing from when using union_all and joinedload_all

2013-02-27 Thread Michael Bayer
On Feb 27, 2013, at 12:21 PM, Ladislav Lenart lenart...@volny.cz wrote: Hello. Suppose I have the following mapped classes, A and B, that have two distinct M:N relationships, AB1 and AB2. If A.x is null, only relations in AB1 apply. If it is not null, only relations in AB2 apply. A also

Re: [sqlalchemy] [Q] SA 0.7.9 - missing from when using union_all and joinedload_all

2013-02-27 Thread Ladislav Lenart
Hello. Thank you for your prompt answer. I will try to create a working example that demonstrates the issue. Though it will take me a couple of days, maybe weeks (my regular work followed by a vacation). I have another problem. I rephrased the SQL, because postgres's planner had issues with

Re: [sqlalchemy] [Q] SA 0.7.9 - missing from when using union_all and joinedload_all

2013-02-27 Thread Michael Bayer
On Feb 27, 2013, at 3:12 PM, Ladislav Lenart lenart...@volny.cz wrote: Hello. Thank you for your prompt answer. I will try to create a working example that demonstrates the issue. Though it will take me a couple of days, maybe weeks (my regular work followed by a vacation). I have

Re: [sqlalchemy] [Q] SA 0.7.9 - missing from when using union_all and joinedload_all

2013-02-27 Thread Michael Bayer
OK, I've reconstructed mappings which correspond directly to your Query as given, and it produces the identical SQL. I've inserted a bunch of rows into all the tables so that a polymorphic result comes back, so that we can in fact verify that the ORM reads the client_id column correctly. Your