Anda di halaman 1dari 18

Informatica Transformations Guide

05/11/2009

Informatica Transformations Guide

Introduction:
A transformation in informatica is a repository object, which loads the data into the target as per the business rule. A transformation in Informatica repository is the definition for a process that generates, modifies, or passes data. A process has inputs and outputs. In Informatica repository, the inputs and outputs of a transformation is called Port. Each port is like a column of a table. A port may have the data type, precision and scale to describe the data. You can specify a port as Input, Output, or Variable. Rows of the data passed to a transformation via the Input ports and individual rows will be passed out as output ports from a transformation. A transformations outputs may be the inputs of another transformation. The set of transformations forms a mapping or a mapplet. Transformations can be active or passive. An active transformation can change the number of rows that pass through it, such as a Filter transformation that removes rows that do not meet the filter condition. A passive transformation does not change the number of rows that pass through it, such as an Expression transformation that performs a calculation on data and passes all rows through the transformation. Transformations can be connected to the data flow, or they can be unconnected. A connected transformation is connected to other transformations or directly to target table in the mapping. An unconnected transformation is not connected to other transformations in the mapping. An unconnected transformation is called within another transformation, and returns a value to that transformation.

Internal Use

Informatica Transformations Guide

Creating a Transformation:
You can create a transformation using the following Designer tools. Mapping Designer: Create transformations that connect sources to targets. Transformations in a mapping cannot be used in other mappings unless you configure them to be reusable. Transformation Developer: Create individual transformations, called reusable transformations that use in multiple mappings. Mapplet Designer: Create and configure a set of transformations, called mapplets that you use in multiple mappings. Informatica provides following transformations by which you can easily load the data into the target according to your business rule. Aggregator Transformation Custom Transformation Expression Transformation Filter Transformation HTTP Transformation Java Transformation Joiner Transformation Lookup Transformation Normalizer Transformation Rank Transformation Router Transformation Sequence Generator Transformation Sorter Transformation Source Qualifier Transformation SQL Transformation Stored Procedure Transformation Transaction Control Transformation Union Transformation Update Strategy Transformation XML Transformations

Internal Use

Informatica Transformations Guide

Aggregator Transformation:
Transformation Type: Active connected The Aggregator transformation lets you perform aggregate calculations, such as averages and sums. The Aggregator transformation is unlike the Expression transformation, in that you use the Aggregator transformation to perform calculations on groups. The Expression transformation permits you to perform calculations on a row-by-row basis only. When using the transformation language to create aggregate expressions, use conditional clauses to filter rows, providing more flexibility than SQL language.

Filter Transformation:
Transformation Type: Active Connected You can filter rows in a mapping with the Filter transformation. You pass all the rows from a source transformation through the Filter transformation, and then enter a filter condition for the transformation. All ports in a Filter transformation are input/output and only rows that meet the condition pass through the Filter transformation. The mapping in Figure-1 passes the rows from a human resources table that contains employee data through a Filter transformation. The filter only allows rows through for employees that make salaries of $30,000 or higher. Figure-1: Sample Mapping with a Filter Transformation

For the above Example the filter condition is SALARY>30000. With the filter of SALARY > 30000, only rows of data where employees that make salaries greater than $30,000 pass through to the target.

Internal Use

Informatica Transformations Guide

Router Transformation:
Transformation Type: Active Connected A Router transformation is similar to a Filter transformation because both transformations allow you to use a condition to test data. A Filter transformation tests data for one condition and drops the rows of data that do not meet the condition. However, a Router transformation tests data for one or more conditions and gives you the option to route rows of data that do not meet any of the conditions to a default output group. Figure-2 shows two mappings that perform the same task. Mapping A uses three Filter transformations while Mapping B produces the same result with one Router transformation: Figure-2. Comparing Router and Filter Transformations

Lookup Transformation:
Transformation Type: Passive Connected/Unconnected

Use a Lookup transformation in a mapping to look up data in a flat file or a relational table, view, or synonym. You can import a lookup definition from any flat file or relational database to which both the Power Center Client and Integration Service can connect. Use multiple Lookup transformations in a mapping. The Integration Service queries the lookup source based on the lookup ports in the transformation. It compares Lookup transformation port values to lookup source column values based on the lookup condition. Pass the result of the lookup to other transformations and a target.

Internal Use

Informatica Transformations Guide

Use the Lookup transformation to perform many tasks, including: Get a related value: For example, the source includes employee ID, but you want to include the employee name in the target table to make the summary data easier to read. Perform a calculation: Many normalized tables include values used in a calculation, such as gross sales per invoice or sales tax, but not the calculated value (such as net sales). Update slowly changing dimension tables: Use a Lookup transformation to determine whether rows already exist in the target.

Sorter Transformation:
Transformation Type: Active Connected You can sort data with the Sorter transformation. You can sort data in ascending or descending order according to a specified sort key. You can also configure the Sorter transformation for case-sensitive sorting, and specify whether the output rows should be distinct. The Sorter transformation is an active transformation. It must be connected to the data flow. You can sort data from relational or flat file sources. You can also use the Sorter transformation to sort data passing through an Aggregator transformation configured to use sorted input. When you create a Sorter transformation in a mapping, you specify one or more ports as a sort key and configure each sort key port to sort in ascending or descending order. You also configure sort criteria the Integration Service applies to all sort key ports and the system resources it allocates to perform the sort operation. Figure-3:-shows a simple mapping that uses a Sorter transformation. The mapping passes rows from a sales table containing order information through a Sorter transformation before loading to the target. Figure-3: Sample Mapping with a Sorter Transformation

Internal Use

Informatica Transformations Guide

Joiner Transformation:
Transformation Type: Active Connected Use the Joiner transformation to join source data from two related heterogeneous sources residing in different locations or file systems. You can also join data from the same source. The Joiner transformation joins sources with at least one matching column. The Joiner transformation uses a condition that matches one or more pairs of columns between the two sources. The two input pipelines include a master pipeline and a detail pipeline or a master and a detail branch. The master pipeline ends at the Joiner transformation, while the detail pipeline continues to the target. Figure-4: shows the master and detail pipelines in a mapping with a Joiner transformation: Figure-4: Mapping with Master and Detail Pipelines

To join more than two sources in a mapping, join the output from the Joiner transformation with another source pipeline. Add Joiner transformations to the mapping until you have joined all the source pipelines. The Joiner transformation accepts input from most transformations. However, consider the following limitations on the pipelines you connect to the Joiner transformation: 1) You cannot use a Joiner transformation when either input pipeline contains an Update Strategy transformation. 2) You cannot use a Joiner transformation if you connect a Sequence Generator transformation directly before the Joiner transformation.

Internal Use

Informatica Transformations Guide

Sequence Generator Transformation:


Transformation Type: Passive Connected The Sequence Generator transformation generates numeric values. Use the Sequence Generator to create unique primary key values, replace missing primary keys, or cycle through a sequential range of numbers. The Sequence Generator transformation is a connected transformation. It contains two output ports that you can connect to one or more transformations. The Integration Service generates a block of sequence numbers each time a block of rows enters a connected transformation. If you connect CURRVAL, the Integration Service processes one row in each block. When NEXTVAL is connected to the input port of another transformation, the Integration Service generates a sequence of numbers. When CURRVAL is connected to the input port of another transformation, the Integration Service generates the NEXTVAL value plus the Increment by value. You can make a Sequence Generator reusable, and use it in multiple mappings. You might reuse a Sequence Generator when you perform multiple loads to a single target. For example, if you have a large input file that you separate into three sessions running in parallel, use a Sequence Generator to generate primary key values. If you use different Sequence Generators, the Integration Service might generate duplicate key values. Instead, use the reusable Sequence Generator for all three sessions to provide a unique value for each target row.

Rank Transformation:
Transformation Type: Active Connected. You can select only the top or bottom rank of data with Rank transformation. Use a Rank transformation to return the largest or smallest numeric value in a port or group. You can also use a Rank transformation to return the strings at the top or the bottom of a session sort order. During the session, the Integration Service caches input data until it can perform the rank calculations. The Rank transformation differs from the transformation functions MAX and MIN, in that it lets you select a group of top or bottom values, not just one value. For example, use Rank to select the top 10 salespersons in a given territory. Or, to generate a financial report, you might also use a Rank transformation to identify the three departments with the lowest expenses in salaries and overhead. While the SQL language provides many functions

Internal Use

Informatica Transformations Guide

designed to handle groups of data, identifying top or bottom strata within a set of rows is not possible using standard SQL functions. You connect all ports representing the same row set to the transformation. Only the rows that fall within that rank, based on some measure you set when you configure the transformation, pass through the Rank transformation. You can also write expressions to transform data or perform calculations.

Union Transformation:
Transformation Type: Active Connected The Union transformation is a multiple input group transformation that you use to merge data from multiple pipelines or pipeline branches into one pipeline branch. It merges data from multiple sources similar to the UNION ALL SQL statement to combine the results from two or more SQL statements. Similar to the UNION ALL statement, the Union transformation does not remove duplicate rows. The Integration Service processes all input groups in parallel. The Integration Service concurrently reads sources connected to the Union transformation, and pushes blocks of data into the input groups of the transformation. The Union transformation processes the blocks of data based on the order it receives the blocks from the Integration Service. You can connect heterogeneous sources to a Union transformation. The Union transformation merges sources with matching ports and outputs the data from one output group with the same ports as the input groups. Union Transformation Rules and Guidelines: Consider the following rules and guidelines when you work with a union transformation. You can create multiple input groups, but only one output group. All input groups and the output group must have matching ports. The precision, data type, and scale must be identical across all groups. The Union transformation does not remove duplicate rows. To remove duplicate rows, you must add another transformation such as a Router or Filter transformation. You cannot use a Sequence Generator or Update Strategy transformation upstream from a Union transformation. The Union transformation does not generate transactions.

Figure-5 shows Mapping with a union Transformation.

Internal Use

Informatica Transformations Guide

Figure-5 Mapping with a union Transformation:

Source Qualifier Transformation:


Transformation Type: Active Connected

When you add a relational or a flat file source definition to a mapping you need to connect it to a Source Qualifier transformation. The Source Qualifier represents the rows that the Informatica Server reads when it executes a session. Tasks performed by the Source Qualifier transformation: Join data originating from the same source database: You can join two or more tables with primary-foreign key relationships by linking the sources to one Source Qualifier. Filter records when the Informatica Server reads source data: If you include a filter condition the Informatica Server adds a WHERE clause to the default query. Specify an outer join rather than the default inner join: If you include a userdefined join the Informatica Server replaces the join information specified by the metadata in the SQL query. Specify sorted ports: If you specify a number for sorted ports the Informatica Server adds an ORDER BY clause to the default SQL query. Select only distinct values from the source: If you choose Select Distinct the Informatica Server adds a SELECT DISTINCT statement to the default SQL query.

Internal Use

10

Informatica Transformations Guide

Create a custom query to issue a special SELECT statement for the Informatica Server to read source data: For example you might use a custom query to perform aggregate calculations or execute a stored procedure.

Stored Procedure Transformation:


Transformation Type: Passive Connected/Unconnected A Stored Procedure transformation is an important tool for populating and maintaining databases. Database administrators create stored procedures to automate timeconsuming tasks that are too complicated for standard SQL statements. The stored procedure must exist in the database before creating a Stored Procedure transformation, and the stored procedure can exist in a source, target, or any database with a valid connection to the Informatica Server. Stored Procedure is an executable script with SQL statements and control statements, user-defined variables and conditional statements. You might use stored procedures to do the following tasks: Check the status of a target database before loading data into it. Determine if enough space exists in a database. Perform a specialized calculation. Drop and recreate indexes

Expression Transformation:
Transformation Type Passive Connected

Use the Expression transformation to calculate values in a single row before you write to the target. For example, you might need to adjust employee salaries, concatenate first and last names, or convert strings to numbers. Use the Expression transformation to perform any non-aggregate calculations. You can also use the Expression transformation to test conditional statements before you output the results to target tables or other transformations.

Internal Use

11

Informatica Transformations Guide

To use the Expression transformation to calculate values for a single row, you must include the following ports: Input or input/output ports for each value used in the calculation: For example, when calculating the total price for an order, determined by multiplying the unit price by the quantity ordered , the input or input/output ports. One port provides the unit price and the other provides the quantity ordered. Output port for the expression: You enter the expression as a configuration option for the output port. The return value for the output port needs to match the return value of the expression.

Update strategy Transformation:


Transformation Type: Active Connected When you design a data warehouse, you need to decide what type of information to store in targets. As part of the target table design, you need to determine whether to maintain all the historic data or just the most recent changes. For example, you might have a target table, T_CUSTOMERS that contains customer data. When a customer address changes, you may want to save the original address in the table instead of updating that portion of the customer row. In this case, you would create a new row containing the updated address, and preserve the original row with the old customer address. This shows how you might store historical information in a target table. However, if you want the T_CUSTOMERS table to be a snapshot of current customer data, you would update the existing customer row and lose the original address. The model you choose determines how you handle changes to existing rows. In PowerCenter, you set the update strategy at two different levels: Within a session: When you configure a session, you can instruct the Integration Service to either treat all rows in the same way (for example, treat all rows as inserts), or use instructions coded into the session mapping to flag rows for different database operations. Within a mapping: Within a mapping, you use the Update Strategy transformation to flag rows for insert, delete, update, or reject.

Normalizer Transformation:
Transformation Type: Active Connected Normalization is the process of organizing data to reduce redundancy. In database terms, this includes creating normalized tables and establishing relationships between the tables eliminating redundancy and inconsistent dependencies. The Normalizer transformation normalizes records from COBOL and relational sources, allowing you to organize the data. A Normalizer transformation can appear anywhere in a pipeline when you normalize a relational source. Use a Normalizer transformation instead

Internal Use

12

Informatica Transformations Guide

of the Source Qualifier transformation when you normalize a COBOL source. When you drag a COBOL source into the Mapping Designer workspace, the Mapping Designer creates a Normalizer transformation with input and output ports for every column in the source. You primarily use the Normalizer transformation with COBOL sources, which are often stored in a denormalized format. The OCCURS statement in a COBOL file nests multiple records of information in a single record. Using the Normalizer transformation, you break out repeated data within a record into separate records. For each new record it creates, the Normalizer transformation generates a unique identifier. Use this key value to join the normalized records.

Java Transformation:
Transformation Type: Active/Passive Connected You can extend PowerCenter functionality with the Java transformation. The Java transformation provides a simple native programming interface to define transformation functionality with the Java programming language. You can use the Java transformation to quickly define simple or moderately complex transformation functionality without advanced knowledge of the Java programming language or an external Java development environment. For example, you can define transformation logic to loop through input rows and generate multiple output rows based on a specific condition. You can also use expressions, userdefined functions, unconnected transformations, and mapping variables in the Java code.

HTTP Transformation:
Transformation Type: Passive Connected The HTTP transformation enables you to connect to an HTTP server to use its services and applications. When you run a session with an HTTP transformation, the Integration Service connects to the HTTP server and issues a request to retrieve data from or update data on the HTTP server, depending on how you configure the transformation: Read data from an HTTP server: When the Integration Service reads data from an HTTP server, it retrieves the data from the HTTP server and passes the data to the target or a downstream transformation in the mapping. For example, you can connect to an HTTP server to read current inventory data, perform calculations on the data during the PowerCenter session, and pass the data to the target. Update data on the HTTP server: When the Integration Service writes to an HTTP server, it posts data to the HTTP server and passes HTTP server responses to the target or a downstream transformation in the mapping. For example, you can post

Internal Use

13

Informatica Transformations Guide

data providing scheduling information from upstream transformations to the HTTP server during a session. Figure-6 shows how the integration service processes an HTTP transformation. Figure-6: HTTP Transformation Processing

SQL Transformation:
Transformation Type: Active/passive Connected The SQL transformation processes SQL queries midstream in a pipeline. You can insert, delete, update, and retrieve rows from a database. You can pass the database connection information to the SQL transformation as input data at run time. The transformation processes external SQL scripts or SQL queries that you create in an SQL editor. The SQL transformation processes the query and returns rows and database errors. For example, you might need to create database tables before adding new transactions. You can create an SQL transformation to create the tables in a workflow. The SQL transformation returns database errors in an output port. You can configure another workflow to run if the SQL transformation returns no errors. When you create an SQL transformation, you configure the following options: Mode: The SQL transformation runs in one of the following modes:

Script mode: The SQL transformation runs ANSI SQL scripts that are externally located. You pass a script name to the transformation with each input row. The SQL transformation outputs one row for each input row.

Query mode: The SQL transformation executes a query that you define in a query editor. You can pass strings or parameters to the query to define dynamic queries or change the selection parameters. You can output multiple rows when the query has a SELECT statement. Database type: The type of database the sql transformation connects to.

Internal Use

14

Informatica Transformations Guide

Connection type: Pass database connection information to the sql transformation or use a connection object.

Transaction control Transformation:


Transformation Type: Active Connected PowerCenter lets you control commit and rollback transactions based on a set of rows that pass through a Transaction Control transformation. A transaction is the set of rows bound by commit or rollback rows. You can define a transaction based on a varying number of input rows. You might want to define transactions based on a group of rows ordered on a common key, such as employee ID or order entry date. In PowerCenter, you define transaction control at two levels: Within a mapping: Within a mapping, you use the Transaction Control transformation to define a transaction. You define transactions using an expression in a Transaction Control transformation. Based on the return value of the expression, you can choose to commit, roll back, or continue without any transaction changes. Within a session: When you configure a session, you configure it for user-defined commit. You can choose to commit or roll back a transaction if the Integration Service fails to transform or write any row to the target.

XML Source Qualifier Transformation:


Transformation Type: Active Connected You can add an XML Source Qualifier transformation to a mapping by dragging an XML source definition to the Mapping Designer workspace or by manually creating one. When you add an XML source definition to a mapping, you need to connect it to an XML Source Qualifier transformation. The XML Source Qualifier transformation defines the data elements that the Integration Service reads when it executes a session. It determines how the PowerCenter reads the source data. An XML Source Qualifier transformation always has one input or output port for every column in the XML source. When you create an XML Source Qualifier transformation for a source definition, the Designer links each port in the XML source definition to a port in the XML Source Qualifier transformation. You cannot remove or edit any of the links. If you remove an XML source definition from a mapping, the Designer also removes the corresponding XML Source Qualifier transformation. You can link one XML source definition to one XML Source Qualifier transformation.

Internal Use

15

Informatica Transformations Guide

XML Parser Transformation:


Transformation Type: Active Connected Use an XML Parser transformation to extract XML inside a pipeline. The XML Parser transformation lets you extract XML data from messaging systems, such as TIBCO or MQ Series, and from other sources, such as files or databases. The XML Parser transformation functionality is similar to the XML source functionality, except it parses the XML in the pipeline. For example, you might want to extract XML data from a TIBCO source and pass the data to relational targets. The XML Parser transformation reads XML data from a single input port and writes data to one or more output ports.

XML Generator Transformation:


Transformation Type: Active connected Use an XML Generator transformation to create XML inside a pipeline. The XML Generator transformation lets you read data from messaging systems, such as TIBCO and MQ Series, or from other sources, such as files or databases. The XML Generator transformation functionality is similar to the XML target functionality, except it generates the XML in the pipeline. For example, you might want to extract data from relational sources and pass XML data to targets. The XML Generator transformation accepts data from multiple ports and writes XML through a single output port.

Custom Transformation:
Transformation Type: Active/passive Connected Custom transformations operate in conjunction with procedures you create outside of the Designer interface to extend PowerCenter functionality. You can create a Custom

Internal Use

16

Informatica Transformations Guide

transformation and bind it to a procedure that you develop using the Custom Transformation functions. Use the Custom transformation to create transformation applications, such as sorting and aggregation, which require all input rows to be processed before outputting any output rows. To support this process, the input and output functions occur separately in Custom transformations compared to External Procedure transformations. You can also use the Custom transformation to create a transformation that requires multiple input groups, multiple output groups, or both. A group is the representation of a row of data entering or leaving a transformation. For example, you might create a Custom transformation with one input group and multiple output groups that parses XML data. Or, you can create a Custom transformation with two input groups and one output group that merges two streams of input data into one stream of output data.

Internal Use

17

Informatica Transformations Guide

<LSH>/ <Life Sciences and Health Care/ SP> AUTHOR:<Ramachandra Rao.Pelluru>


Ram.pelluru@tcs.com

Internal Use

18