On Jun 29, 2012, at 6:31 AM, tonthon wrote:

> I had also to add :
> c1 = aliased(Client)
> c2 = aliased(Client)

oh right, forgot that part

> query(Task).with_polymorphic([Invoice, Estimation]).outerjoin(p1,
> Invoice.project).outerjoin(p2, Estimation.project).outerjoin(c1,
> p1.client).outerjoin(c2, p2.client)
> 
> And I can filter on common parameters, that's what I was looking for so far.
> 
> Is it possible to get Invoices and Estimations as result objects (in
> place of Task objects) ?

if the Estimation/Invoice classes use "polymorphic_on" against a column in the 
Task table that acts as the "discriminator" then sure.

if there isn't such a column, then things are trickier - we don't have a 100% 
endorsed pattern for that right now.  there's hacky workarounds, id have to 
work one up.


-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to