NAME

DBIx::Class::Snowflake::Fact

VERSION

version 0.10

ABSTRACT

DBIx::Class::Snowflake::Fact - Load this for any fact tables.

NAME

DBIx::Class::Fact - Make your table a star/snowflake fact table

SYNOPSIS

__PACKAGE__->load_components(qw/ Snowflakee::Fact /);

DESCRIPTION

Component for DBIx::Class that makes it easier to develop star or snowflake schemas. This will provide the class with useful accessors to get a list of dimensions and easily search given a dimension.

METHODS

attributes

Returns the attributes of the fact excluding any ignore columns. It returns them as an array containing hashes each containing the data type and the accesssor name.

attrs

Convenience alias to attributes

generate_report

generate_report returns a resultset for the report requested. Each item in the array is a row in the report and each element in the hash is one of the metrics requested.

Usage: $fact->generate_report({'filters' => {'dimdate.day_of_week' => 3}, 'metric' => {'dimline.line_velocity' => 1}})

_resolve_types

The resolve types subroutine attempts to determine if the value passed in is the name of a dimension or an attribute given the columns of the current table.

In this case the term attribute is described as column on a fact table that does not reference another table. So, if there was a fact table fact_produced that had two columns, date_id and widget_id, and date referred to the date_id column of the date table which had a column dow and widget_id did not refer to anything then the following call: $fact->_resolve_types({'dow' => 3, 'widget_id' => 6}); the following hash would be returned: { 'attributes' => { 'widget_id' => 6}, 'dimensions' => { 'dow' => 3 }}

NOTE If the column does not exist it assumes it is a dimension, IT DOES NOT SEARCH FOR IT TO VERIFY.