0% found this document useful (0 votes)
552 views8 pages

SCD-2 Implementation To Insert Update and Logically Delete Rows

This document provides instructions for implementing slowly changing dimension type 2 (SCD-2) logic in an SCD-2 data integration mapping to insert, update, and logically delete rows from a target table. It describes adding ports, filters, and logic to the mapping to handle inserts, updates based on changes to the salary field, and logical deletions by flagging records as deleted rather than physically deleting them. A source qualifier is also used to join source and target tables and identify records to insert, update, or logically delete based on a full outer join between the tables.

Uploaded by

Manshoon Habib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
552 views8 pages

SCD-2 Implementation To Insert Update and Logically Delete Rows

This document provides instructions for implementing slowly changing dimension type 2 (SCD-2) logic in an SCD-2 data integration mapping to insert, update, and logically delete rows from a target table. It describes adding ports, filters, and logic to the mapping to handle inserts, updates based on changes to the salary field, and logical deletions by flagging records as deleted rather than physically deleting them. A source qualifier is also used to join source and target tables and identify records to insert, update, or logically delete based on a full outer join between the tables.

Uploaded by

Manshoon Habib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

SCD-2 implementation to insert update and logically delete rows

Joiner condition:

Note- Use full outer join

Add one expression transformation as shown in mapping

Add Insert, Update, Delete ports with below mentioned logic and add two more
ports D_Flag with hardcoded value D and D_EndDate with value sysdate for
deletion logic

Insert port logic:

Update port logic: We are considering that update target records when salary will
change.
Means consider only salary as slowly changing dimension. But if you want then you
can consider other ports as well.

Delete logic- delete when record is deleted from source table

Add three filters after expression

In filter condition put logic as mentioned in table below:


Filter name
FLT_INS
FLT_DEL
FLT_UPD

Filter condition
Insert
Delete
Update

For FLT_DEL

In update strategy expression put DD_Update


Because we are updating its flag as D and end date as sysdate.
But physically we are not deleting that particular record. Because we want to keep
historical data.

Use below mentioned logic for Insert filter pipeline :

For FLT_UPD filter:


We need two pipelines one to update existing record and one to insert new record
with new source salary value.

Blue highlighted ports in expression are hardcoded ports.


Note- Use only one sequence generator in mapping to generate unique numbers for
both of the target instances which are used in FLT_INS and FLT_UPD pipelines.
Now, Mapping will look like:

Now, you will see that mapping is not performing as per requirement, So here is the
final solution to fix your issues:
Put below mentioned logic in Source qualifier of target table

Note- dont forget to use full outer join.

You might also like