On 3/8/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > how often do you have a "base query" hanging around, vs. doing "brand > new query object" each time? with the full "generative" way, if you > are programatically building up your query, now you have to say: > > if somecriterion: > q = q.where(<something>) > if someother criterion: > q = q.where(<somethingelse>) > > q = q.order_by(<something else>) > q = q.options(foo) > > ie you have to keep remembering to say "q = q.etc", otherwise you are > just throwing away your newly generated query objects. this seems > inconvenient to me. > > id like to see what cases make you want to have a base query that is > reused, and consider how that might not be needed either.
for instance, i have an application in charge of building zips for users to download from a queue of requests. the requests are prioritized, but to prevent starvation of low priority requests, i have another thread that just processes them in order of request time. so i have the base query that's just a module-level variable, and the main threadpool adds on the priority clause, while the other adds on the request-time clause. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
