Name of Solution:
Implementing SCD type-2 dynamically
Business Requirement:
This is a Mapping example that demonstrates how to implement the Slowly Changing
Dimension (Type-2) when source data has multiple occurrence of the same dimension key.
Solution URL:
https://community.informatica.com/solutions/1927
Supported Versions:
PowerCenter 9.1 and 9.5
Description:
This is a generic mapping to apply SCD type-2 on source data where we have multiple
records with the same natural key in the same run and we want to capture all of them not
only the last one.
Consider that we have SCD Type-2 Dimension and dimension load is happening once a day
or we are doing the initial load of the dimension table.
Suppose a company is maintaining a table with the employee location details.
Example of the data is given below:
EMPLOYEE TABLE
EMPLOYEE_ID EMPLOYEE_NAME EMPLOYEE_LOCATION LOCATION_START_DATE
100
'XXX YYY'
'ABC'
01-01-2000
100
'XXX YYY'
'DEF'
01-01-2001
100
'XXX YYY'
'GHI'
01-01-2002
Now if we want to build a data warehouse, hence Employee will be one of our important
dimensions. Now the mapping will load the historical data in SCD Type-2 dimension table.
So the data will look like as shown below after it has been passed through mapping.
SEQ
ID
EMPLOYEE_NAME LOCATION START_DATE END_DATE ACTIVE_FLG
100
'XXX YYY'
'ABC'
01-01-2000
01-01-2001 'N'
100
'XXX YYY'
'DEF'
01-01-2001
01-01-2002 'N'
100
'XXX YYY'
'GHI'
01-01-2002
NULL
'Y'
This will help client to report from day one based on their historical data. And we can
capture all changes that happen to the record between two runs.
Please rate this solution and share your feedback on Marketplace Website.
If the Date column is not present, then mapping can be built using any of the columns
which helps us identify when the records were inserted.
Download file contents:
1. Workflow
2. Script
Steps to implement the solution:
1. Execute the script to create the source table, test data and target table.
2. Import workflow using Repository Manager. Select the appropriate folder from
repository and resolve the conflicts by choosing suitable option.
3. PowerCenter Designer, study the mapping and how transformations are designed.
Observe the router tranformation as shown below.
4. Open the workflow in Workflow Manager. Assign the integration service in Workflow > Edit -> Integration Service
5. Edit session and assign valid connection object for the source and target. Make sure
the lookup transformation also get the valid connection.
6. For more details for importing object please visit our YouTube link.
Please rate this solution and share your feedback on Marketplace Website.
7. Execute the workflow and observe the output in target table.
YouTube Video on Importing and Configuring Workflows:
http://www.youtube.com/playlist?list=PLLRreK2jjjgWBQ4NPfp0QWTxYDvlnEqSJ
Other Useful links:
Mapping Bundles
Workflow Bundles
Informatica Tools Bundles
Informatica for Social Media Bundles
Debugging Tools Bundles
Visio Templates Bundles
B2B Templates and Projects Bundles
Data Quality Packs and Plans Bundles
Script Bundles
Please rate this solution and share your feedback on Marketplace Website.