A Session in Informatica is a set of instructions that tells the Informatica Integration Service when and how to move data from Source to target.
In Informatica, we have to create a session task for each Mapping because the Mapping is just a structural definition, and the session will move data from Source to destination. There are two types of sessions in Informatica:
- Non-reusable Session Task: Session Task that we created in the Workflow Designer is non-reusable.
- Reusable Session Task: Session Task that we created in Informatica Task Developer is reusable
NOTE: Before you create a Non-reusable Session in Informatica, we must configure the Workflow manager to communicate with databases and Integration services.
In this article, we will show you how to create Non-reusable Session in Informatica with an example. For this example, we are going to use the Mapping that we created in our previous article. You can refer to the Informatica Mapping article for further reference
Create Session in Informatica
Creating Non-reusable Session in Informatica follows three steps, so you have to follow the same procedure:
- Step 1: Configuring the Source and Destination connection. In this example, we are a connection to the SQL Server Relational Database.
- Step 2: Creating a Workflow manager to communicate with Informatica integration services
- Step 3: Creating Session in Informatica
First, connect to the Informatica repository service. To connect with Repository service, we have to provide the Informatica Admin Console credentials so, Please provide the appropriate Username and Password and click on the Connect button.
From the below screenshot, you can observe that we are in the Task Developer.
Configuring the Source and Destination connection
Before we start creating Session in Informatica, we have to set the relational database connections. To do this, Please navigate to Connections Menu and select the Relational option.
Once you select on the Relational option, a new window called Relational Connection Browser will open. It helps us to create a connection to our relational database.
For this example, we are using the SQL as our source database that’s why we are selecting the Microsoft SQL Server as the Select Type
From the below screenshot, you can observe that currently, we don’t have any relational connections. To create a new one, please click on the New button.
Once you click on the New button, a new window called Connection Object Definition will open.
- Name: Please specify the unique name for this connection.
- Username: You have to specify the username to connect with the database.
- Password: Here, provide the password of the user mentioned above.
- Database Name: Please specify the name of a database you are going to use. For this example, we are using AdventureWorksDW2014.
- Server name: Here, you have to write your server instance name.
Click Ok button after you fill the details
We need to create one more connection string for our target database. Although we can create using the steps mentioned above, we want to copy the above connection using the Copy As.. option.
It opens the connection Object definition window for the target so, please specify the connection name, database name, and the remaining details.
NOTE: Once we configured the database connections, we have to create a workflow within the workflow manager. We will explain this in our next article.
Non-reusable Session in Informatica
To create Non-reusable Session in Informatica, Please navigate to Tasks Menu and select the Create option.
Next, you have to enter a New name for this non-reusable session task. Here we assigned the name as s_DimProducts_from_SQL_to_SQL
Once you click on the Create button, a new window called Mappings will open. Here, we have to select the Mapping that you want to associate with this session. From the below screenshot, you can observe that currently, we have only one mapping, so we are selecting it.
TIP: Please refer Informatica Mapping article to understand the data transformation in below specified mapping m_DimProducts_from_SQL_to_SQL
Our newly created session task added to the Workflow Manager. Before we are adding or linking to the Informatica Workflow, we have to change a few properties and configure the connection strings of a Source and target. To do so, Please double-click on our session task
Double click on the Informatica Session task will open the following window. Within the General Tab, we can rename the Session Task to a more meaningful name. Please do not forget to provide a valid description of the Task.
Fail Parent if this Task fails: Please check mark this option. If this session task fails, then it will fail the workflow.
Within Properties Tab, we have three common properties that we have to configure for the relational databases.
$Source connection value: This property will store the relational source information in $Source variable. So, we have to configure the source connection by clicking on the Arrow we marked below.
Once you click on the Arrow, a new window called Connection Browser will open. Since we are using the SQL as our source database, we are selecting the Microsoft SQL Server as the Select Type. Next, we are selecting the already created connection i.e., AdventureWorksDW
TIP: If you want to create a new connection before then, you can use the New button.
$Target connection value: This property will store the relational target information in the $Target variable. So, we have to configure the target connection by clicking on the Arrow we marked below.
For this example, we are using the SQL database as the destination so, we selected the Microsoft SQL Server as the Select Type and Informatica target as the Destination database name
Write backward Compatible Session Log File: If you checkmark this option, Informatica generates the session file in text format so that we can review it later. Otherwise, it will produce only a binary format.
Within the Config Object, we have to configure the Log options and Error handling. Although we have many properties, we are discussing and configuring the most common properties within this window.
- Save Session log for these runs: Please specify the integer number here. For example, if you specify 3, the last three sessions will be saved to our Informatica session log file
- Stop on Errors: Please specify how many errors you want the session to tolerate. For example, if you specify 3, the session runs until it encounters three errors.
Within the mappings tab, we have to configure the Source, target Connections, and some common properties. First, let us configure the source connections by clicking on the Dimproducts source present in the Sources folder.
Within the Connections, select the Arrow button beside the relational type to open the Relational Connection Browser. This window helps you to configure the source connections (creating new, modifying, etc).
Here, we are using the Connection variable that we created in our previous step, i.e., $Source
Now, let us configure the target connections by clicking on the Target_Dimproducts present in the Targets folder.
Within the Connections, select the Arrow button beside the relational type to open the Relational Connection Browser. Here, we are using the Connection variable that we created in our previous step, i.e., $Target
TIP: You can also select the Use Object option and select the Database name also.
Within the Target properties, we have to configure two common properties, and they are:
Target Load Type: If your target table has indexes, then use the Normal-type. Otherwise, Bulk type. Remember, the bulk type will insert the data faster than Normal, but it does not work on indexed tables.
Truncate target table option: By check-marking, this option will truncate the existing data from the destination table. It helps us to insert new data for every successful run.
Once you finished creating the Informatica session task, we have to Link the workflow with the Session Task.