Users Online

· Guests Online: 159

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

Informatica Tutorial on Transformations

Informatica Update Strategy using Session Properties

In this article, we are going to explain, How to achieve Informatica Update Strategy using Session Properties. Or, the steps involved in configuring the Session Properties to achieve the Update Strategy without using any Update Strategy Transformation with an example.

In Informatica, you can use the Session Properties to achieve the update strategy. But, this approach is one of the worst approaches in real-time. Because, instead of Lookup this will blindly update existing records (even there is no change), or insert each and every record. This approach is fine for the small table. 

For this example, we are going to use the below show data (Employee Duplicate table)

Source Table 1

And the destination table is:

Destination Table 2

As you can that the destination table has 1 record and two extra columns. These extra columns will help you to understand the problems you might face in this approach.  

 

Informatica Update Strategy using Session Properties

Before we start configuring the Session Properties, First let me connect with the Informatica repository service. In order to do so, we have to provide the Admin Console credentials. So, Please provide the appropriate Username and Password, and click the Connect button.

TIP: Here you have to provide the Admin Username and password that you specified while installing the Server.

Step 1: Create a Source Definition

Once you connected successfully, Please navigate to Source Analyzer and define your Sources. In this example, we are using [Employee Duplicate] table from SQL Server database as our source definitions. Please refer Database Source to understand the steps involved in creating a source definition 

Informatica Update Strategy using Session Properties 3

Step 2: Create Target Definition

Please navigate to Target Designer and define the Target. In this example, we are using the already created SQL table (Employee Dup) as our target definition. Please refer Create Target table using Source Definition to understand the steps involved in creating a target definition

Informatica Update Strategy using Session Properties 4

Step 3: Create a Mapping

To create a new mapping, Please navigate to Mappings menu in Menu Bar, and select the Create.. option.

Informatica Update Strategy using Session Properties 5

This will open the Mapping Name window to write a unique name for this mapping. Let me write m_update_with_session and click OK button.

TIP: Please refer Mapping article to understand the procedure to create Mapping

Informatica Update Strategy using Session Properties 6

Drag and drop the Employee Duplicate source definitions from Sources folder to the mapping designer. Once you drag the source, Power Center designer will automatically create the source qualifier for you. I suggest you refer the Source Qualifier Transformation article.

Next, create an Expression Transformation, and Drag all the fields from Source Qualifier to Expression Transformation. I Suggest you refer Expression Transformation article for better understanding.

Informatica Update Strategy using Session Properties 7

Double click on the Expression transformation to add new fields, or write to custom expressions. From the below screenshot you can observe that We added 2 new columns using the New Port button. We are going to use these new columns to store the Created Date and Modified Date

Informatica Update Strategy using Session Properties 8

Let us write the custom expression. To do this, Click on the arrow button beside the CreatedOn.

TIP: All these new columns are output ports. So, please check mark O

Informatica Update Strategy using Session Properties 9

This will open the Expression Editor to write a custom expression. Here, we want the system date so, write SYSDATE.

Informatica Update Strategy using Session Properties 10

From the below screenshot you can observe that We did the same for the UpdatedOn column

Informatica Update Strategy using Session Properties 11

Next, Drag and drop the target definition from Targets folder to the mapping designer, and connected the Expression transformation with the target definition. Please use the Autolink.. option to connect them.

Informatica Update Strategy using Session Properties 12

Before we close the Mapping, Let us validate the mapping by going to Mapping Menu bar and selecting the Validate option.

Step 4: Create a Workflow

After we finish creating the Mapping, we have to create a workflow for it. Power Center Workflow manager provides two approaches to create a workflow.

In this example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

Informatica Update Strategy using Session Properties 13

This will open Create Workflow window as shown below. Please provide the unique name (wf_update_using_session) and leave the default settings.

Informatica Update Strategy using Session Properties 14

Once we created the workflow, our next step is to create a session task for our mapping.

Step 4(a): Create a Session

There are two types of sessions:

For this example, we will create a Non-reusable Session. In order to create the same, Please navigate to Tasks Menu and select the Create option as shown below.

Informatica Update Strategy using Session Properties 15

Please provide a unique name for this session. Here, we are naming it as s_update_using_session. Once you click on the Create button, a new window called Mappings will be opened. Here, we are selecting the m_update_with_session

Informatica Update Strategy using Session Properties 16

Double click on the Session task will open the Edit Tasks window. Within Properties Tab 

 

$Source connection value: This property will store the relational source information in $Source variable. So, click on the Arrow we marked below, and select the SQL Tutorial as the source information.

Informatica Update Strategy using Session Properties 17

$Target connection value: This property will store the relational target information in $Target variable. So, click on the Arrow we marked below, and select the SQL Test target as the Target information.

Informatica Update Strategy using Session Properties 18

Treat Source Rows as: Change the default Insert to Update. It means, instead of performing the only insertion, it will perform update too.

Informatica Update Strategy using Session Properties 19

Within the mappings tab, we have to configure the Source, target Connections. First, let us configure the source connections by clicking on the SQ_EmployeeDuplicate source present in the Sources folder.

Within the Connections, click on the Arrow button beside the Relational type, and use the Connection variable that we created in our previous step i.e., $Source

Informatica Update Strategy using Session Properties 20

Now, we have to configure the Target Connection. So, click on the EmployeeDup present in the Targets folder. Within the Connections, click on the Arrow button beside the Relational type, and use the Connection variable $Target

Informatica Update Strategy using Session Properties 21

Next, checkmark the Update else Insert.

Update else Insert: If the records already exist then it will perform UPDATE on that records. And, if the records do not exist then it will perform INSERT

Informatica Update Strategy using Session Properties 22

Please link the Start Task and the session task.

Informatica Update Strategy using Session Properties 23

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow. Now, Let me start the Workflow. To do so, navigate to the Workflows menu, and select the Start Workflow option.

Once you select the Start Workflow option, the PowerCenter Workflow monitor will be opened to monitor the workflow. From the below screenshot you can observe that our workflow is executed without any errors.

Informatica Update Strategy using Session Properties 24

Let us open the SQL Server Management Studio to check whether we successfully performed the update strategy. If you look at the first record, this record is updated along with the insertion. In a simple language, we can say, this approach is simply replacing all the existing target table records with the source table records.

Let me update Yearly Income for EmpID 3 and add one more record.

From the below screenshot you can observe that our workflow is executed without any errors.

Informatica Update Strategy using Session Properties 27

As you can see, again all the records are inserted freshly.

 

 

 

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.91 seconds
10,813,662 unique visits