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.

>
> PS: for such new feature suggestions, do you prefer if I add a ticket
> directly or if I discuss the thing here first?

new feature suggestions probably better on the list first so everyone  
sees it.

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