[sqlalchemy] Re: Trying to join a session query to a union
you probably need to modify the various objections with a `.select()` or `.subquery()` e.g: query_select = query.select() q = intersect.join(query_select, query_select.c.sid, intersect.c.sid) pay attention to the docs on what the various methods return. some return a selectable, others don't. you can usually toggle around the different forms with .select, .subquery, .alias (and there are a few others) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Trying to join a session query to a union
For the record, this should have a '==' for the join condition: q = intersect.join(query_select, query_select.c.sid == intersect.c.sid) On Wednesday, July 8, 2015 at 7:48:54 PM UTC-5, Horcle wrote: Weird, I had tried using the subquery() method earlier, but it didn't work. Not sure why, but now it is returning the desired query object. (I guess stepping away from this for a few hours was a good idea, eh?!) Thanks! Greg-- On Wednesday, July 8, 2015 at 6:24:16 PM UTC-5, Jonathan Vanasco wrote: you probably need to modify the various objections with a `.select()` or `.subquery()` e.g: query_select = query.select() q = intersect.join(query_select, query_select.c.sid, intersect.c.sid) pay attention to the docs on what the various methods return. some return a selectable, others don't. you can usually toggle around the different forms with .select, .subquery, .alias (and there are a few others) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Trying to join a session query to a union
Weird, I had tried using the subquery() method earlier, but it didn't work. Not sure why, but now it is returning the desired query object. (I guess stepping away from this for a few hours was a good idea, eh?!) Thanks! Greg-- On Wednesday, July 8, 2015 at 6:24:16 PM UTC-5, Jonathan Vanasco wrote: you probably need to modify the various objections with a `.select()` or `.subquery()` e.g: query_select = query.select() q = intersect.join(query_select, query_select.c.sid, intersect.c.sid) pay attention to the docs on what the various methods return. some return a selectable, others don't. you can usually toggle around the different forms with .select, .subquery, .alias (and there are a few others) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.