Creating Multiple Mappings From One Informatica Mapping Template
Creating Multiple Mappings From One Informatica Mapping Template
Abstract
You can create a single mapping template using Informatica Mapping Architect for Visio and import into PowerCenter to generate multiple mappings and workflows.
Table of Contents
Overview ........................................................................................................................................................................... 2 Step 1. Establish the PowerCenter Environment (Developer) .......................................................................................... 3 Designate a Repository Folder to Store the Mapping Objects ..................................................................................... 3 Create Flat File Sources............................................................................................................................................... 3 Create Source and Target Definitions .......................................................................................................................... 4 Step 2. Create and Configure the Mapping Template XML File in Microsoft Visio (Business Analyst) ............................ 4 Create Mapping Template Drawing File ....................................................................................................................... 4 Configure Parameters .................................................................................................................................................. 8 Validate and Publish the Mapping Template ................................................................................................................ 8 Step 3. Save the Mapping Template XML File to a Shared Location (Business Analyst) ................................................ 8 Step 4. Import the Mapping Template XML File to Generate Multiple Mappings and Workflows (Developer) ................. 8 Import the Mapping Template....................................................................................................................................... 9 Specify the Mapping Details ......................................................................................................................................... 9 Generate Mappings .................................................................................................................................................... 10 Generate Workflows from the Mappings .................................................................................................................... 12 Run the Workflows ..................................................................................................................................................... 13
Overview
PowerCenter Mapping Architect for Visio enables the following individuals to collaborate when creating PowerCenter mappings: Business analyst. Creates a high level data flow pattern by designing a mapping template in Microsoft Visio, and defines mapping rules and parameters that may be used to configure and run sessions in PowerCenter. A business analyst is familiar with project requirements and source and target data, but is not a PowerCenter user. PowerCenter developer. Imports the mapping template using the Designer to generate PowerCenter mapping objects. The PowerCenter developer edits the mappings, implements additional functionality that might be required, and runs workflows generated from the mappings. The example in this article shows how to create a mapping template using Informatica Mapping Architect for Visio, and import it into PowerCenter to generate multiple mappings and workflows. In this example, you create a mapping template that represents a simple mapping with an Expression transformation configured to trim leading and trailing spaces from string data. You create two mappings from a single mapping template. Each mapping uses a different source and target table. When you configure the source and target definitions in the mapping template, you can set the value of the source and target to a parameter. After you create the template and import it into PowerCenter, you define the mappings you want to create. When you define the mappings, you set the value of the parameter for the source table in each mapping to a source table in the repository. Similarly, you set the value of the parameter for the target table in each mapping to a target table in the repository.
For more information about PowerCenter Mapping Architect for Visio, see the PowerCenter Mapping Architect for Visio Guide. The example in this article configures two mappings that read from the following flat file sources: CUSTOMER. Flat file source that stores customer data. PRODUCTS. Flat file source that stores product information. The mappings write to the following flat file targets: T_CUSTOMER. Flat file target that stores customer data. T_PRODUCTS. Flat file target that stores product information. To generate the example mappings and workflows, the business analyst and PowerCenter developer collaborate to complete the following tasks: 1. 2. 3. 4. 5. Establish the PowerCenter environment (Developer). The PowerCenter developer creates the source and target tables and designates a repository folder to store the imported objects. Create the mapping template in Microsoft Visio (Business Analyst). The business analyst creates a mapping template drawing file and defines mapping rules and parameters. Validate and publish the mapping to generate the mapping template XML file (Business Analyst). Save the mapping template XML file to a shared location (Business Analyst). Import the mapping template XML file in PowerCenter to generate multiple mappings and workflows (Developer). Use Import Mapping Template Wizard to import the mapping template XML file in PowerCenter Designer and generate mappings and workflows.
Save the text files to the default source file directory in the following location:
INFA_ROOT\server\infa_shared\SrcFiles
For more information about working with flat files, see PowerCenter Designer Guide.
Step 2. Create and Configure the Mapping Template XML File in Microsoft Visio (Business Analyst)
The business analyst completes the following tasks to configure the mapping template XML file in Microsoft Visio: 1. 2. 3. Create a mapping template drawing file. Configure parameters. Validate and publish the mapping template.
The following figure shows the Mapping Architect for Visio window:
Informatica Toolbar
Drawing Window
Informatica Stencil
3. 4.
Verify that the Informatica Stencil and Informatica toolbar are available. Select and drag the following mapping objects into the drawing window to create a mapping: Source definition Source Qualifier transformation Expression transformation Target definition
5. 6.
Double-click the source definition to edit the properties. Set the following parameters for the source name:
Property Value
$SRC$ $SRC$
Specify parameters when you want to vary the values for a mapping object. 7. Double-click the Source Qualifier transformation to edit the properties.
Property Value
SQ_$SRC$ SQ_$SRC$
Double-click the link between the source and the source qualifier.
9.
To specify a link rule, enter a value for the Rule Set Name. For example, enter All.
10. Click New Rule and configure the AllPorts rule to connect all ports in the source to all the ports in the source qualifier. 11. Double-click the Expression transformation, and select Properties to specify a value for the transformation name. For example, enter EXP_TRIMSTRINGS. 12. In the Expression transformation, select Configuration to configure an expression that trims leading and trailing spaces in a string. Enter the following values:
Property Value
13. Configure a link rule set named String to pass all columns of string datatype from the source qualifier to the Expression transformation. 14. Double-click the target definition to edit the properties. Set following parameters for the target name.
Property Value
$TGT$ $TGT$
15. Configure a link rule set named Remaining from the source qualifier to the target. Create two link rules to pass all ports except ports of string datatype.
16. Configure a link rule set named All to pass all columns ending with _Out in the Expression transformation to the target.
17. Click Save to save the mapping template drawing file. The following figure shows the mapping template drawing file, TrimMapping.vsd
Configure Parameters
You can view and configure the parameters you created in the mapping template file. Configure parameters to generate multiple mappings that use the same data extraction logic but use different sources and targets. To view and configure the mapping template parameters, click the Show Parameters icon on the Informatica toolbar. Configure following values for the source and target parameters:
Property Target Source
Step 3. Save the Mapping Template XML File to a Shared Location (Business Analyst)
The business analyst saves the mapping template XML file named TrimMapping.xml to a shared location so that the PowerCenter developer can access the file.
Step 4. Import the Mapping Template XML File to Generate Multiple Mappings and Workflows (Developer)
The PowerCenter developer uses the Import Mapping Template Wizard in the Designer to generate mappings and workflows from the mapping template XML file. To generate the mappings and workflows, the PowerCenter developer completes the following tasks: 1. 2. 3. 4. 5. Import the mapping template. Specify the mapping details. Generate the mappings in the repository. Generate workflows from the mappings. Run the workflows.
4. 5.
Click Browse to locate the mapping template XML file. Navigate to the directory where the XML file is located. Select the XML file and click OK. Click Next. The second page of the Import Mapping Template Wizard appears.
6.
7.
Click Next. The third page of the Import Mapping Template Wizard appears. The Import Mapping Template Wizard displays the list of mappings you configured.
Generate Mappings
In the third page of the Import Mapping Template Wizard, you generate mappings and save parameter values. To generate the mappings: 1. In the third page of the Import Mapping Template Wizard, select the mappings that you want to generate: m_CUSTOMER and m_PRODUCTS.
10
2.
Optionally, select Save parameter values for the selected mapping if you want to reuse the mapping template parameter file. The wizard saves the parameter values for each mapping that you selected in the mapping template parameter file.
3. 4. 5. 6.
Click Next. The wizard prompts you to export table definitions. Click Yes. The Export Object dialog box appears, and the table definitions are exported to the default location. Click Close to close the Export Objects dialog box. The fourth page of the Import Mapping Template Wizard appears. Review the list of mappings to verify that the Import Mapping Template Wizard generated the correct number of mappings. By default, the option to create workflows and sessions is enabled.
11
7.
12
7.
8. 9.
10. Review the status and click Finish. 11. Click Repository > Save.
Authors
Lalitha Sundaramurthy Senior Product Manager
13