[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby on Rails and Star Schemas Question.

Anthony Garcia

8/12/2006 2:54:00 PM

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


1 Answer

Logan Capaldo

8/12/2006 3:32:00 PM

0


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

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

> Regards,
> Anthony
>
>
>