[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Seth
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'),

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Michael Bayer
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'),

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Seth
Michael, This is not valid SQL being outputted (at least on SQLite MySQL). There should not be a parenthesis between the first UNION and SELECT. This causes an SQL error. Is there a way to reformat the query to get valid SQL? Thanks, Seth On Sep 9, 8:38 am, Michael Bayer

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Seth
Michael, I'm really baffled by your response. Are we reading two different threads here? Or, perhaps you missed the main message in this thread outlining the issues with the suggestions you've given me so far? ( direct link here: http://groups.google.com/group/sqlalchemy/msg/d4d7a958f8ac2ff8 )

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION

2009-09-09 Thread Michael Bayer
Seth wrote: Michael, I'm really baffled by your response. Are we reading two different threads here? Or, perhaps you missed the main message in this thread outlining the issues with the suggestions you've given me so far? hi Seth - I was responding specifically to your example: users =

[sqlalchemy] Re: Issues with layered subqueries, NOT IN, and UNION [SOLVED]

2009-09-09 Thread Seth
Mike, That's the magic I was looking for! Thank you for a more thorough explanation of the subject at hand. If the length of this thread is anyone's fault, it would be mine for being somewhat of a SQLAlchemy newbie. I am extremely grateful for your willingness to see this thread through and I