ActiveWarehouse

Posted by Gregg Kellogg Sat, 19 May 2007 23:10:00 GMT

Related to the interesting talk at a recent NBRug meeting on Ruport, I’ve been looking at doing data warehousing in Ruby. Fortunately, Anthony Eden has beaten me to the punch with ActiveWarehouse.

For those unfamiliar with Data Warehousing, the concepts are basically to create a series of facts that are indexed buy multiple dimensions. A fact is typically an integer (eg, sales amount) with data relating to the fact expressed in dimensions. (Note that in some cases, you can have a Factless Fact table where the information is entirely in the dimensions). Dimensions provide different types of data relating to the fact (e.g., date & time of entry, user, product, location, etc.), so a fact table has a column for each ’’dimension’’ with a column for the fact scalar value itself.

The ’’dimension’’ tables contain an id index column, a column for the fact value (e.g., timestamp for date & time) and columns for each ’’summary’’ to be associated with the dimension (e.g., day of week, day of month, month, year, hour minute, ...).

At this point, queries can be performed by joining the dimension and fact tables and summarizing (or counting) the scalar fact value against conditions against the dimension tables (e.g., sales per year by person and region).

Typically, this data is pre-summarized in ’’cubes’’ with summary tables that contain the results of these summary queries.

The ActiveWarehouse plugin contains everything necessary to define, populate and report on this data.

I expect to be using this to hold information on user listening habits for MP3 files.

Gregg Kellogg

Posted in  | no comments | no trackbacks

RailsConf Sessions

Posted by Gregg Kellogg Thu, 26 Apr 2007 20:05:00 GMT

Here are the sessions Ill be attending at RailsConf. Hope to see you there.

Gregg

Posted in  | no comments | no trackbacks

Observers in Rails 1.2

Posted by Gregg Kellogg Sat, 27 Jan 2007 03:13:00 GMT

Thanks to Rick Olson for providing assistance with the proper syntax for instantiating observers in Rails 1.2. The old way was to add an observer statement to the appropriate controler, such as:
observer :user_observer

Hidden in the ignored parts of conf/environment.rb was the proper notation:

# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector

This makes the last of my deprecation messages go away!

Gregg

Posted in  | no comments | no trackbacks

Eager Finder SQL

Posted by Gregg Kellogg Mon, 06 Nov 2006 01:31:00 GMT

EagerFinderSql allows custom SQL to be specified when doing eager loading of associations through the :include option to find. This allows for purpose-constructed queries to be used and still result in a fully linked object model.

Background

ActiveRecord constructs SQL to satisfy the requirements of a find request. Associations allow for customized SQL to be specified, using the :finder_sql option, but this has not been available when performing eager loading using the :include option. The result is that a standardized query is constructed to bring in the associated tables using LEFT OUTER JOIN. For some queries, this can be result in expensive queries and potentially very large result sets.

Custom SQL

EagerFinderSql addresses this problem by allowing :finder_sql to be added to find options when the :include option is also specified.

Read more...

Posted in  | Tags , , , ,  | 5 comments | no trackbacks

Button Labels

Posted by Gregg Kellogg Tue, 24 Oct 2006 02:22:00 GMT

I checked in the button-labels plugin. I was frustrated when trying to create a form with multiple radio-buttons and no way to tell them apart. Basically, if the :label option is passed to radio_button, it calls content_tag() instead of tag() and uses the label as the content.

radio_button("post", "title", "Goodbye World", :label => "Goodby World")

<input id="post_title_goodbye_world" 
     name="post[title]" 
     type="radio" 
     value="Goodbye World">
  <label for="post_title_goodbye_world>
    Goodby World
  </label>
</input>

The plugin is managed on ruby_forge. Rdoc is available.

Entered some time ago as a bug #4627.

Gregg Kellogg

Posted in  | 3 comments | no trackbacks