Tuesday, June 25, 2013

Incremental Loading in Informatica using Mapping Variable

Lets understand what is a Mapping Variable:

A mapping variable represents a value that can change through the session. The Integration Service saves the value of a mapping variable to the repository at the end of each successful session run and uses that value the next time when we run the session. Variable functions like SetMaxVariable, SetMinVariable, SetVariable, SetCountVariable are used in the mapping to change the value of the variable. At the beginning of a session, the Integration Service evaluates references to a variable to determine the start value. At the end of a successful session, the Integration Service saves the final value of the variable to the repository. The next time we run the session, the Integration Service evaluates references to the variable to the saved value. To override the saved value, define the start value of the variable in the parameter file.

Lets see the steps to create a Mapping Variable which can be used in incremental loading.

Step 1:

How to create mapping variable in informatica?


Step 2:

To define a mapping variable to be used for incremental loading (for this illustration we are in a assumption that your source system is a relational source (RDBMS))


Step 3:

In the Source Qualifier we need to Generate SQL and add a filter, WHERE condition to filter records that are greater than the $$LAST_RUN_DATE


Step 4: Part 1: 

To define the logic where the Informatica integration services saves the timestamp when the session is executed, for the next run, it will use that saved timestamp to read the records from the relational source incrementally. We need to create a expression transformation right after the Source Qualifier to set the variable.


Step 4: Part 2:

In the expression transformation create a OUT port and use the code as show below



Step 5:

After the session has executed we can see the saved timestamp in the workflow manager as below:-




No comments:

Informatica Expression Code: Chr(10): Line Feed character  Chr(13): Carriage Return character.  Chr(12): Form Feed Expression Code to...