Ruby on Rails and Star Schemas Question

Good morning,

I’m a ruby on rails newby and trying to figure out how I can execute a
star
schema query like this.

select generators.Unit,
thedates.weekday_name,
hours.thehour,
sum(generatorfacts.revenue)
from
generatorfacts,
generators,
thedates,
hours
where
generatorfacts.hour_id = hours.id and
generatorfacts.thedate_id = thedates.id and
generatorfacts.generator_id = generators.id and
thedates.weekday_name = ‘Monday’
group by generators.Unit,thedates.weekday_name,hours.thehour
having sum(generatorfacts.rtrevenue) > 0

This is a standard data warehouse type, star schema query.

I’ve been reading and trying things in script console but I’m hoping
someone
out there can give me a head start.
I’m as far using has_many :through, and belongs_to in my models. I’ve
also
heard that someone named Ken Kunz is developing an acts_as_fact plugin
which
may be just what I need. Can anybody walk me through how I would
approach
this?

Regards,
Anthony

On Aug 12, 2006, at 10:55 AM, Anthony Garcia wrote:

from
having sum(generatorfacts.rtrevenue) > 0
may be just what I need. Can anybody walk me through how I would
approach
this?

Well first, you want the ruby on rails mailing list. Secondly, you
may just want to use ActiveRecord::Base#find_by_sql for this, since
you already seem to know exactly what you want.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs