John Lenton wrote:
>
> I hadn't even considered having a multi-parameter tuple-returning
> "sum"; I was ok with either calling groupby thrice, or saving the
> groupby and calling the different ops in sequence. In either case, a
> database roundtrip per call.
I'm often grouping thousands of rows
Russell Keith-Magee wrote:
> annotate() returns a query set, so it can be used multiple times, be
> combined with filters, etc. The argument handling strategy employed in
> filter() is reused here; kwargs to annotate() can be decomposed on a
> __ boundary to describe table joins, with the last pa
On 12/4/06, DavidA <[EMAIL PROTECTED]> wrote:
>
> Would I have to call queryset.groupby(account) three times: once for
> count(), once for sum(quantity) and once for sum(total_pnl)?
I hadn't even considered having a multi-parameter tuple-returning
"sum"; I was ok with either calling groupby thric
On 12/4/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote:
>
> I'm taking this to django-dev for more discussion; it'll get seen by more the
> right people there.
>
> Thoughts, anyone?
Ok; here's my thoughts.
1. Introduction
~~~
Consider the following pseudo-model:
class Book(Model):
On 12/4/06 3:30 PM, DavidA wrote:
> I think it quickly gets more complicated than that syntax would
> support.
Oh, of *course* it does -- that's why I want to discuss it more!
I think, though, that we should be able to find a 80/20 point for aggregates
and support most of the common use cases.
Jacob Kaplan-Moss wrote:
> No, I think not -- I think that syntax (``queryset.groupby(field).max()``)
> actually looks like the best proposal for aggregates I've seen thus far...
>
> Thoughts, anyone?
>
> Jacob
I think it quickly gets more complicated than that syntax would
support. For example,
On 12/4/06 5:57 AM, John Lenton wrote:
> The "max", "min" and other such functions might be a little more
> problematic, unless groupby returned, rather than a generic iterator,
> a special "queryset group" and give _it_ the max/min/etc methods. This
> way it would be clear that max() returns a tu