here is the sample code I am using http://pastebin.com/m6cd9c5dd
-- Mike Conley On Wed, Sep 9, 2009 at 11:10 PM, Mike Conley <mconl...@gmail.com> wrote: > On Wed, Sep 9, 2009 at 10:46 PM, Michael Bayer > <mike...@zzzcomputing.com>wrote: > >> >> >> On Sep 9, 2009, at 8:41 PM, Seth wrote: >> >> > >> > Ok Mike, >> > >> > Tell me what you think about this: >> > >> > q1 = DBSession.query(P1.id, P1.user_id, P1.type, P1.title, P1.body, >> > P1.created, P1.updated) >> > q2 = DBSession.query(P2.id, P2.user_id, "'P2'", P2.title, P2.body, >> > P2.created, P2.updated) >> > q3 = DBSession.query(P3.id, P3.user_id, "'P3'", P3.title, P3.body, >> > P3.created, P3.updated) >> > >> > subquery = DBSession.query().from_statement(union_all(q1, q2, >> > q3)).subquery() >> > >> > posts = DBSession.query(subquery, User.name).filter >> > (User.user_id==subquery.c.user_id) >> > >> > >> > Kind of hackish, but... it seems to work? >> >> you should be able to call select() directly on the union_all() and >> send that as your subquery. >> >> > What would that look like? I don't get it the syntax. > > This is also really close to answering the question I posted earlier about > labeling literals in the first query of a union. I'll reply to that thread > again when I have the answer completed. > > -- > Mike Conley > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---