There are situations where you need to keep a source and target in sync. One method to do this is to truncate and reload. However this method is not that efficient for a table with millions of rows of data. You really only want to:
- insert rows from the source that don’t exist in the target
- update rows that have changed
- delete rows from the target that no longer exist in the source
Can you do this efficiently in a single informatica mapping?
Here is a picture of the informatica mapping:
Here is the detailed informatica mapping:
- Insert Source and Source Qualifier from Source
- Insert Source and Source Qualifier from Target
- Sort Source and Target in Source Qualifiers by Key Fields
- Insert Joiner Transformation using a Full Outer Join and select Sorted Input option
- Insert a Router Transformation with 3 groups
- Insert – ISNULL(Target_PK)
- Delete – ISNULL(Source_PK)
- Default – used for Update
- Insert an Update Transformation coming form the Delete Group using DD_DELETE
- Connect this transformation to the Target
- Insert a Filter Transformation coming from the Update Group
- (
DECODE(Source_Field1, Target_Field1, 1, 0) = 0
OR
DECODE(Source_Field2, Target_Field2, 1, 0) = 0
) - Modify as needed to compare all non-key fields
- (
- Insert an Update Transformation coming from the Filter Transformation using DD_UPDATE
- Connect this transformation to the Target
- Connect the Insert Group in the Router Transformation to the Target
Please leave a comment if you have questions on this informatica mapping process.
very well done. this what i was looking. Thanks a lot
LikeLike
Thanks for the comment. Glad I could help you.
LikeLike
Awesome post.. was very helpfull. Could not get this solution so clear any where else. Great job!!
LikeLike
Thanks for putting this post.. Appriciate your time and share..
LikeLike
Very informative and helpful.
I have one Quick question – i am not able to add Target and its corresponding SQ. When i add the Target, all of the ports are Output and i cannot change them to Input so that i can connect them to a new SQ.
Also, when i try to add a new SQ for the Target, it pops up with a window to Select which Source it needs to be associated to.So, i am not sure on how to add a Target with SQ.
Thank you once again.
LikeLike