Seth wrote: > > Michael, > > Once again I appreciate your help on this issue; and once again I > cannot seem to find the right recipe to get SQLAlchemy to format the > query like I want. > > I tried your latest suggestion: > >>>> users = DBSession.query(Post.id.label('post_id'), >>>> Post.user_id.label('user_id')).from_statement(Discussion.__table__.select().with_only_columns(['post_id', >>>> 'user_id']).union(DiscussionComment.__table__.select().with_only_columns(['post_id', >>>> 'user_id']))) > > ...but that strips out the first union and skips directly to the last > one: > >>>> print users > SELECT post_id, user_id > FROM discussions UNION SELECT post_id, user_id > FROM discussion_comments
huh ? I see two SELECTs in there, from discussions and discussion_comments, just as the query requests. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---