Ruby on Rails and Star Schemas Question.

A

Anthony Garcia

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
 
L

Logan Capaldo

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?
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top