On 4/24/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > On Apr 24, 2007, at 5:42 AM, Gaetan de Menten wrote: > > > Here is an experimental patch to add generative aggregate methods on > > query objects. > > > > My use case is that I have a class which is often queried with a sum > > query, from different places. But those different places usually add a > > filter on top of that basic query. And since I don't like repeating > > myself, I wanted a way to factor the common part. > > > > Here is some (untested) example: > > > > score_query = Query(Tag).sum_clause(tags_table.c.score1 * > > tags_table.c.score2) > > fun_score_query = score_query.filter_by(name='fun') > > > > [... on another place ...] > > > > user_fun_score = fun_score_query.filter_by(user=self).scalar() > > > > if we can use a verb in the name, like "apply_sum()", sure.
I created ticket 552 for this with an improved patch. http://www.sqlalchemy.org/trac/ticket/552 -- Gaƫtan de Menten http://openhex.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---