• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1193
  • Last Modified:

How to load OLTP data into Dimension and Fact table

Experts,


I have a Dim Customer table and Dim Products table and a FactSaletable:

Dim Customer Table:

CustomerID     AlternateKey     CustomerName       CustomerCompany
1                      34525                James Boags            Target

Dim Products table:

ProductID       AlternateKey     ProductType        ProductName
1                     345354              Large                   Ball


FactSales table:

ID     CustomerID(FK)    ProductID(FK)      Qty     SalesAmount
1        1                          1                           2       $45


So I have created primary keys for all dimension tables which are foreign keys in the Fact table. Also a primary key for the fact table.

Now how am I suppose to load data into these tables from the OLTP database so items and
customer details are referenced accurately. I dont know how to relate the OLTP data to the fact tables so it references the Dim tables.

Please let me know if you need further details. Any help would be greatly appreciated.


Many Thanks,

J3di
0
J3D1-KN1G1-1t
Asked:
J3D1-KN1G1-1t
  • 2
  • 2
1 Solution
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
I dont know how to relate the OLTP data to the fact tables so it references the Dim tables.
You first fill your dimension tables then your fact table using INSERT statement based on selections from your OLTP.   Please make sure you use SELECT DISTINCT to avoid redundant rows.

Hope this helps.
0
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
Additionally, relating the table functionally to the new structure requires business knowledge so my guess is that it would be a good idea to involve the OLTP designers to establish that knowledge.
0
 
J3D1-KN1G1-1tAuthor Commented:
Thanks Racimo for your responses. I am aware of OLTP design and business processes.

What I really want to know is how does the dimension table know which row to look at in the fact table.

For example the DimCustomer table has a primary key(CustomerID=1) which is the foreign key in the Fact table. The Alternate key is the actual (CustomerID=34525) in the OLTP database.

So lets say I'm loading the DimCustomer table with :

CustomerID     AlternateKey     CustomerName       CustomerCompany
1                      34525                James Boags            Target


How do I relate and load this information into the fact table. I would understand if the primary for the DimCustomer 34525(alternate) and then this is the foreign key in the fact table. So all inserted data from OLTP is matching in relationship of the ROLAP database.

I get lost in ROLAP concept when there is new customerID in the DIM table and the OLTP key becomes the alternate key.

So I guess If you could please explain the concept or give an example I could better understand.

Many Thanks
0
 
J3D1-KN1G1-1tAuthor Commented:
After researching I came up with this. Please let me know if it correct.

If I'm loading measures from the OLTP source into Factable. I would have to

1. Lookup the primary key of DimTable by referencing the alternate key with the ID from source DB

2. Add the DimTable Primary KeyID in the fact table and then add then add the measure in.

3. Which means I would have a view or table setup in the the OLTP(with multiple joins) showing Dim and Measure information in a single row. (this would be my source)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now