On Dec 6, 2007, at 11:41 AM, Artur Siekielski wrote:

>
> Hi.
> I know that I can do SQL UNION of two record sets when using SQL
> Expression objects. But how to do UNION of two sqlalchemy.orm.Query
> objects? I can do the UNION on SQL Expressions level and then use
> 'from_statement' from Query, but what I can do if I already have two
> Queries?
>

you can pull out the select() generated by Query using  
query.compile().   individual components of the select() are available  
as well although in a not-yet-public API, using such datamembers as  
query._criterion, query._from_obj, etc.  As far as a union() operator  
directly on Query, we dont have that right now and it falls under a  
general category of "re-generative Query" operators (i just made that  
name up), i.e. Query objects that can interact with themselves and  
other queries the way select() objects do in SQL (i.e. subquery of  
itself, etc).   We've had a little bit of interest in building that  
out but we havent begun to address the actual complexity involved as  
of yet.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to