[storm] Issue with find(), group by, and Single aggregates error

Ian Booth ian.booth at canonical.com
Tue Nov 9 22:39:14 GMT 2010


Hi

I have a storm query which, in SQL, essentially boils down to:

select foo.a, bar.b, max(foo.c) from foo, bar where foo.id = bar.id
group by a, b

This query is used to obtain a dataset used for display on a Launchpad
page - a table with navigation links for first/next/prev/last etc is
used; x records at a time are displayed.

In my business logic to grab the data using storm, I essentially do:

result = store.using(xxxx).find(yyyy).group_by(zzzz)
return result

This however causes an error:

storm FeatureError: Single aggregates aren't supported after a GROUP BY
clause

So it seems that using a view with navigation links on the table results
in an attempt to call count() on the resultset from the find() and this
is failing. Tracing the sql and executing this sql directly against the
db works just fine and produces the right data. But when using storm to
try and do the same thing it doesn't work.

I can make it work by doing:

result = store.using(xxxx).find(yyyy).group_by(zzzz)
return list(result)

But I really don't want to do this as it defeats the purpose of trying
to use an iterable result set.

Does anyone have any advice as to what I can do to make it work the way
I want?

Thanks in advance.





More information about the storm mailing list