NAME

DataWarehouse::Fact - a Data Warehouse Fact table

VERSION

Version 0.04

SYNOPSIS

use DataWarehouse::Fact;

my $fact = DataWarehouse::Fact->new(
    dsn       => 'dbi:SQLite:dbname=dw.db',
    name      => 'sales',
    dimension => [ qw/ customer product / ],
);

my $query = $fact->aggr_query(
    \@dimension,
    \@where, 
);

my $sth = $fact->prepare($query);

my $data = $sth->fetchall_arrayref();

DESCRIPTION

A DataWarehouse::Fact represents a fact table.

A typical fact table contains numeric facts and foreign keys that references dimension tables. Some fact tables may contain just foreign keys; those are "factless" fact tables. Fact tables may also contain natural keys that identify the facts in the source systems.

GRAIN

The grain of a fact table is defined by its dimensions. For instance, the grain of "Sales" fact table is "Sales by product, by store, by day".

This notion is particularly useful when we talk about aggregate fact tables, which different grain (for example: "Sales by month").

HOUSEKEEPING COLUMNS

load_date

When a fact is loaded, it should have a timestamp that identifies the load time. This will help us to detect aggregate tables which should be updated.

n

When we create aggregate tables, we will store the number of aggregated records in a column called "n". For the base fact table, n should default to 1.

AUTHOR

Nelson Ferraz, <nferraz at gmail.com>

BUGS

Please report any bugs or feature requests to bug-dw at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DataWarehouse. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc DataWarehouse::Fact

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2010 Nelson Ferraz.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.