Users Online

· Guests Online: 161

· 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

Transaction Control Transformation in Informatica

The Transaction Control Transformation in Informatica allows you to control the Transactions within the Transformation. Using this transaction Control Transformation, you can Commit or Rollback the records (or rows) passing through it.

For this Informatica Transaction Control Transformation example, we are going to use SP Source and Destination tables. 

Transaction Source Table 1

Transaction Control Transformation in Informatica Example

In this example, we will show you how to use Transaction Control Transformation in Informatica to perform the Rollback Transaction. Before we start configuring, First, let me connect with the repository service.

To do so, we have to provide the Admin Console credentials. So, Please provide the appropriate Username and Password you specified while installing the Server.

TIP:  We explained everything about the Transactions and its functionalities in the SQL Transaction article.  

 

Source Definition for Transaction Control Transformation in Informatica

Once you connected successfully, Please navigate to Source Analyzer and define your Sources. In this Informatica Transaction Control Transformation example, we are using the Sp Source table from the SQL Server database as our source definitions. Please refer Database Source to understand the steps involved in creating Informatica source definition

Transaction Control Transformation in Informatica 2

Create a Target Definition for Informatica Transaction Control Transformation

Please navigate to Target Designer to define the Target. In this example, we are using the existing SQL table (SP Destination) as our target definition. You can refer to Create Target Table to understand the process of creating a target definition

Transaction Control Transformation in Informatica 3

Create Mapping for Transaction Control Transformation in Informatica

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

Transaction Control Transformation in Informatica 4

Once you select the Create.. option, a new Mapping Name window will be opened. Let me provide m_Transaction as the mapping name and click OK button.

  Transaction Control Transformation in Informatica 5

Drag and drop the SP Source from Sources folder to the mapping designer. Once you drag the source, Power Center Designer will automatically create the Source Qualifier Transformation (default transformation) for you.

Transaction Control Transformation in Informatica 6

Create Informatica Transaction Control Transformation

To create Transaction Control Transformation in Informatica, Please navigate to the Transformation menu in Menu Bar. Next, select the Create.. option

 Transaction Control Transformation in Informatica 7

Selecting the Create.. option will open the Create Transformation window. Please select the Transaction Control Transformation from the drop-down list, and provide a unique name (Tran_Employee), and click on Create button

Transaction Control Transformation in Informatica 8

By clicking OK will create a Transaction Control Transformation for you.

Transaction Control Transformation in Informatica 9

Let me drag all the fields that are available in source definition to Transaction Control Transformation. Next, Drag and drop the target definition (SP Destination) from the Targets folder to the mapping designer. Lastly, connect the Transaction Control Transformation fields with the target definition using the Autolink.. option. 

Transaction Control Transformation in Informatica 10

Double click on the Informatica Transaction Control Transformation to edit or configure the transformation. Please go to the Properties tab, and click on the Arrow beside the Transaction Control Condition to apply transactions at the mapping level.

Edity and Rename the Transaction 11

Once you click the Arrow, an expression window will open. The Expression window in Transaction Control Transformation uses the IIF Function to test each row against the condition.

The Informatica Transaction Control Transformation provides the following built-in variables to apply transactions. For the demonstration purpose, let us take the above specified SP Source table and condition is EmpID = 5. 

  • TC_CONTINUE_TRANSACTION: This is the default value for this option. It does not perform any change for this row.
  • TC_COMMIT_BEFORE: This is nothing but a Commit transaction in any relational database. If the condition is true, then it will first Commit the transaction. Next, it will begin a new transaction and writes the current row. Example: It will commit records up to EmpID 4 and start a new transaction to commit records from 5
  • TC_COMMIT_AFTER: If the condition is true, then it will first write the current row and Commit the transaction. Next, it will begin a new transaction. Example: It will write and commit records up to EmpID 5 and begin a new transaction to commit records from 6
  • TC_ROLLBACK_BEFORE: This is nothing a Rollback transaction in any relational database. If the condition is true, it will first Rollback the transaction. Next, it will begin a new transaction and writes the current row. Example: It will rollback records up to EmpID 4 and begin a new transaction to commit records from 5
  • TC_ROLLBACK_AFTER: If the condition is true, it will first write the current row and then Rollback the transaction. Next, it will begin a new transaction. Example: It will rollback records up to EmpID 5 and begin a new transaction to commit records from 6
IIF Expression for Transaction 12

Click Apply and then click OK to close the Informatica Transaction Control Transformation window.

 Transaction Attribute Values 13

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

Create a Workflow for Transaction Control Transformation in Informatica

After you finish creating the Informatica Transaction Control Transformation Mapping, we have to create the Workflow for it. PowerCenter Workflow manager provides two approaches to create a workflow.

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

Transaction Control Transformation in Informatica 14

It will open the Create Workflow window. Please provide the unique name (wf_Transaction) and leave the default settings.

Transaction Control Transformation in Informatica 15

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

Create a Session for Transaction Control Transformation in Informatica

There are two types of sessions:

For this Informatica Transaction Control Transformation example, we created a Non-reusable Session. To create Non-reusable Session, Please navigate to Tasks Menu and select the Create option as shown below.

Transaction Control Transformation in Informatica 16

Here, we are naming this session as s_Transaction. Once you click on the Create button, a new window called Mappings will open. Here, select the Mapping (m_Transaction) that you want to associate with this session. 

 

Transaction Control Transformation in Informatica 17

Double click on the Session task will open the Edit Tasks window. Within the mappings tab, we have to configure the Source, Target Connections.

First, let us configure the source connections by clicking on the SQ_SPSource source present in the Sources folder. Within the Connections, click on the Arrow button beside the Relational type, and select the Database Object (Database Name) i.e., Source

Transaction Source Database 18

Now, we have to configure the Target Connection. So, click on the SPDestination present in the Targets folder. Within the Connections, click on the Arrow button beside the Relational type, and select the Database Object (Target Database Name) i.e., target 

 

Target Transaction Database 19

Please change the Target Load Type to Normal or Bulk as per your requirements. Let me checkmark the Truncate target table option as well.

Transaction Control Transformation in Informatica 20

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow.

Transaction Control Transformation in Informatica 21

Now, Let me start the Informatica Transaction Control Transformation Workflow. To do so, navigate to the Workflows menu and select the Start Workflow option. 

 

Transaction Control Transformation in Informatica 22

Let us open the SQL Server Management Studio and write the following SQL Query to check whether we successfully transferred the data from a source or not. As you see that our target table is displaying records where EmpID = 10. Because Rollback will start before processing the record whose EmpID, is 10

This time we will use the TC_ROLLBACK_AFTER as the second argument in IIF. It means the Rollback option will perform after passing the EmpID 10.

IIF Expression for Transaction 24

As you can see, our target table is displaying records where EmpID is greater than 10

Transaction Destination Table Output 25

 

 

 

 

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: 1.08 seconds
10,807,144 unique visits