Populate key into Fact Table

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kate_gkl
Participant
Posts: 22
Joined: Mon Jul 19, 2004 2:33 am
Location: Kuala Lumpur, Malaysia

Populate key into Fact Table

Post by kate_gkl »

Hi everyone. I have encountered a scenario that need to populate key from dimension table to Fact table. I am wondering is there any good practice that we can use to solve this scenario.

Hope you guys can share your opinions and experience.

Thanks very much in advance. :)
pramod_au
Participant
Posts: 30
Joined: Thu Feb 06, 2003 8:30 am
Location: London,UK

Re: Populate key into Fact Table

Post by pramod_au »

Create a job which loads dimension keys into Fact table. Run this jobs using job sequencer. Depending upon the requirement u can run this job in parallelism or sequentially.

You may also use Parallel Extender to assign keys.

Please read DS documentation: Parallel Job Developer Guide

Some Good practices are:

1.Have ur Dim table in Hash file.
2.Take care in selecting modulo number for Hash file design.
3.Try to use Inter Process Communication Stage, write cache etc.

kate_gkl wrote:Hi everyone. I have encountered a scenario that need to populate key from dimension table to Fact table. I am wondering is there any good practice that we can use to solve this scenario.

Hope you guys can share your opinions and experience.

Thanks very much in advance. :)
Thanks
Pramod
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Typically you're streaming data from source into the fact table (ideally via a staging area). What you need to do is to provide a mechanism - probably a dataset - containing the "reverse lookup" from the key values that are found in business data and the surrogate keys with which you keyed the dimension table.
By this means you will be able to populate the foreign key column in the fact table that accurately coincide with rows in the dimension table.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kate_gkl
Participant
Posts: 22
Joined: Mon Jul 19, 2004 2:33 am
Location: Kuala Lumpur, Malaysia

Post by kate_gkl »

ray.wurload wrote:
What you need to do is to provide a mechanism - probably a dataset - containing the "reverse lookup" from the key values that are found in business data and the surrogate keys with which you keyed the dimension table.
Can you please explain further on what you mean by "reverse lookup"? Thanks for your help.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Following will explain what is reverse lookup

Dimension Table : DIM_DATE
DIM_Date_Surrogate_Key Date_Natural_Key
1 20040721
2 20040722
3 20040723

Business Data(Which is the source data)
Rec_No Sales_Date Sale_Value
100 20040721 400.00
200 20040721 600.00
300 20040722 700.00


Based on your Business Data the Sales_Date is used as the reverse lookup with the Date_Natural_Key in DIM_Date table. Once you got the DIM_Date_Surrogate_Key of the Dimension table(DIM_DATE) you can pass this to the fact table.

Fact_Sales
Sales_SK dim_date_Surrogate_Key Sales
1111111 1 400.00
1111112 1 600.00
1111113 2 700.00

Above answers your question.

Thanks
Siva
Post Reply