Hey folks,

After a bit of a hiatus to deal with other things, I am back into my
AW implementation.

For one of the fact tables I want to create, it is based off an AR
model's table that uses a polymorphic relationship, so I am thinking
about how to handle this using AW ETL.

I'm thinking it would be best to denormalize this with a row
processor, and looking for advice on how best to do it.

To use my app as an example, we have an activity feed (think facebook
feed, yes, I know, not original) that has the general form:
":user does :action to :action_object"

The :user part is easy, this will be stored in the fact table as an id
relating to the user dimension.

The :action is a string value, so I'll probably create a dimension for
this with all possible values, so this too will end up a reference to
a dimension.
(probably use the foreign key transform for this, right?)

The :action_object is polymorphic, with 2 columns, :action_object_id,
and :action_object_type.

The row processor would:
First, get all possible values for 'action_object_type', e.g. 'Foo', and 'Bar'.
Map the type value to new columns per value, so 'foo_id' and 'bar_id'
in this case will need to be added to each row.
As each row is processed, if a row has the values
action_object_type='Foo', and action_object_id=1,
then the processor would add foo_id=1 and bar_id=nil.
The assumption here is that there are corresponding dimensions for Foo
and Bar to go with these new columns.

Does this make sense?
Has anyone else solved this a different way?
Anyone interested in the polymorphic processor code once I finish it?
(I am testing it now, but looking for validation before I move ahead
using it)

Cheers,

Andrew Kuklewicz
_______________________________________________
Activewarehouse-discuss mailing list
Activewarehouse-discuss@rubyforge.org
http://rubyforge.org/mailman/listinfo/activewarehouse-discuss

Reply via email to