A database in a data warehouse is often organized into a "star schema," consisting of a central "fact table" with the data to be analyzed and multiple "dimension tables" that describes the data.
Each dimension table has a single surrogate key, an arbitrary unique identifier for the row. The fact table has multiple keys, each joining to a different dimension table.
Before you create and run the data flows discussed in this section, in addition to creating the source tables, you must also create the target tables. See How to Create Sample Procedures and Data for Star Schema.
This example has detailed instructions for loading one of the four dimension tables. Refer to the sample flows, DLOADCUST, DSLOADPROD, DSLOADSALE, and DSLOADTIME, for other examples of loading a dimension table. Refer to DSLOADFACT for an example of loading a fact table and DSFLOWP for the complete example of loading a star schema.
This example has instructions for loading the customer dimension table.
The Column Selection window opens.
The erties window opens.
From the Load Type drop-down menu, select Slowly Changing Dimensions, as shown in the following image. Click OK.
The Target Transformation window opens.
button. The identically named source and target column names are added to the Expressions window. The Target Transformations window should now look like the following image.
Note: The columns CKEY and ACTIVE are not mapped because these columns are handled automatically by the DataMigrator Slowly Changing Dimension processing. CKEY is the surrogate key, which automatically starts with a value of 1 and increases by one, for each row added. The Active flag is set to 1 for currently active rows.
Click OK to close the Transformations window.
A fact table load requires looking up the keys for each row in the corresponding dimension tables, and obtaining a surrogate key so that the fact table can be joined to each of the dimensions for subsequent reporting.
To create the fact table follow these steps.
A JOIN object is automatically added connected to DMORD[MS] and DMSALE.
A second JOIN object is automatically added connected to the first JOIN object and DMINV.
The Column Selection window opens.
ORDER_DATE from DMORD(T1)
PROD_NUM from DMINV(T3)
STORE_CODE from DMORD(T1)
EMPID from DMSALE(T2)
LINEPRICE from DMORD(T1)
QUANTITY from DMORD(T1)
button. The SQL Calculator opens.
The Column Selection window should appear as in the following image.
The Transformations window opens.
button.The Transformation Calculator window opens.
The Lookup function assist opens.
button
after Lookup Synonym. Select the synonym DSDIMTIME from
the ibisamp directory and press Enter.
button
after Return Field.The Lookup Field dialog box opens.
The Lookup window should appear as shown in the following image.
For the rest of the key columns, the Source Field and Lookup Field are pre-selected since the names are the same in the Fact and Dimension tables. In addition, transformations are required for the remaining columns.
When you have created the remaining transformations, the Transformations window should appear as shown in the following image.
In order to load the fact table in this example, all the dimension tables have to be loaded first so that the surrogate keys are available.
button
and drag it into the work area to the right of the Start icon.A box appears on the screen. This is an empty parallel group.
Release the line when the arrow is touching the box.
button
and drag it into the work area to the right of the parallel group.When you have finished, your process flow should appear as shown in the following image.
The process flow log opens.
The log shows the four dimension data flows run and the fact table load, which runs when the data flow runs are complete. The lines in blue indicate links to the detail logs for the individual flows.
| iWay Software |