Emma,

> In my current project the vast majority of DB access is blindingly
> simple, the sort of problem that scaffolding can actually solve (at
> least for the moment). I do, however, have a few queries that need in
> DB reporting - I need to iterate over a set of objects, joining on to
> a table and retrieving a count for joined objects for each row in the
> first set. (actually, this is a simplification)
>
> For now I have actually implemented this in an n+1 query style, with a
> ruby loop. Unpleasant and unscalable, but works for me right now.

There is the dm-aggregates gem for simple count(), sum(), min(), max
(), avg() functions scoped to a Model or a Collection.  It can even
perform multiple aggregate functions in a single call with the
aggregate() method.  It only works with RDBMS' right now, but I would
love to see someone add a layer that does it via "brute force" -- not
all storage engines have the concept of aggregate functions, so there
would be the need to iterate over every row and aggregate the results
that way.

Dan
(dkubb)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to