Michael Bayer wrote:
> On May 29, 2007, at 10:28 PM, Huy Do wrote:
>
>   
>> s = select()
>> query = db.query(model.Invoice).options(contains_eager('client'))
>> query = query.from_select(s)   #
>> query = query.limit(10).offset(10)
>> rs = query.list()
>>
>> What I'm doing, is pretty much setting up a query in one place of my
>> program, then passing this query around, manipulating certain  
>> aspects of
>> that query, then finally executing the query in some other place in my
>> program.
>>     
>
> sure you can use query.select_from(myselect).  but its not going to  
> modify your select() statement, its giong to apply all those other  
> constraints to a "select * from (your select)" type of clause.  if  
> you want the SQL to be more finely tuned than that youd have to build  
> up your select() separately first.
>   
Thanks Michael. I should have read the docs more carefully before 
asking. That's exactly what I want. As you describe this should be fine 
for my use case, because I am only changing the limit, offset and order 
by clauses. The function which adds these constraints is solely dealing 
with paging so this is perfect.

Huy
> alternatively you can forego making a select() on your own and be  
> totally generative with the query itself, using filter(), order_by(),  
> limit(), etc.
>   
>
>
>
> >   


--~--~---------~--~----~------------~-------~--~----~
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