Beruflich Dokumente
Kultur Dokumente
POWERCENTER 1.5
POWERMART 4.5
Getting Started
Revision 1.5.0
November 1998
Contributors: Loretta Chen, Robin Rielley, Anthony Zambataro
Copyright (c) 1996-1998 Informatica Corporation.
All rights reserved. Printed in the USA.
This software and documentation contain proprietary information of Informatica Corporation; they are provided under a
license agreement containing restrictions on use and disclosure and is also protected by copyright law. Reverse engineering of
the software is prohibited. No part of this document may be reproduced or transmitted in any form, by any means
(electronic, photocopying, recording or otherwise) without the prior written consent of Informatica Corporation.
Use, duplication, or disclosure of the Software by the U.S. Government is subject to the restrictions set forth in the applicable
software license agreement as provided in DFARS 227.7202-1(a) and 227.7702-3(a) (1995), DFARS 252.227-7013(c)(1)(ii)
(OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable.
The information in this document is subject to change without notice. If you find any problems in the documentation, please
report them to us in writing. Informatica Corporation does not warrant that this documentation is error free.
Informatica, Informatica The Enterprise DataMart Company and design, PowerMart, PowerMart Designer, PowerMart
Repository Manager, PowerMart Server Manager, PowerMart Server, PowerCenter, PowerCenter Server, PowerConnect, Star
Schema Wizard, Multi-Dimensional Design Schema Wizard, MX, MX2, PowerCapture, and PowerPlug are trademarks of
Informatica Corporation. All other company and product names may be trade names or trademarks of their respective own-
ers.
Informatica Corporation
3350 West Bayshore Road
Palo Alto, CA 94303
North America / South America
Informatica Corporation
3350 West Bayshore Road
Palo Alto, CA 94303
Phone: 650-687-6200
Fax: 650-687-0040
Technical support hours: 6 a.m. - 7 p.m. / p.s.t.
email: support@informatica.com
Africa / Asia / Australia / Europe
Informatica Corporation
Lincolns Inn, Chancery Court
Lincoln Road, High Wycombe
HP123RE
Phone: +44 990 275 223
Fax: +44 990 275 224
Technical support hours: 9 am - 5 pm / g.m.t.
email: support_uk@informatica.com
Table of Contents
Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Before You Begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Steps to Create a Data Mart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Lesson 1: Creating a Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Creating Repository Users and Groups . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Creating a Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Lesson 2: Importing Source and Target Definitions . . . . . . . . . . . . . . . . . . . 15
Creating Source Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Adding Source Definitions to the Repository . . . . . . . . . . . . . . . . . . . . 17
Lesson 3: Creating a Simple Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Lesson 4: Using Lookups and Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Creating a New Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Creating the New Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Creating an Aggregator Transformation . . . . . . . . . . . . . . . . . . . . . . . . 33
Creating an Expression Transformation . . . . . . . . . . . . . . . . . . . . . . . . 38
Locating Additional Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Connecting the Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Lesson 5: Creating Sessions and Batches . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Configuring the Server and the Server Manager . . . . . . . . . . . . . . . . . . 45
Creating the First Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Creating the Second Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Creating a Batch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Lesson 6: Working with Other Transformations . . . . . . . . . . . . . . . . . . . . . 56
Creating the Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Creating the New Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Creating a Filter Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Populating expFPromoItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Creating a Sequence Generator Transformation . . . . . . . . . . . . . . . . . . . 62
Completing the Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
iii
iv
Chapter 14
Tutorial
This tutorial provides a basic grounding in data mart development using Informatica’s tools.
The topics covered in this tutorial include:
♦ Overview
♦ Lesson 1: Creating a Repository
♦ Lesson 2: Importing Source and Target Definitions
♦ Lesson 3: Creating a Simple Mapping
♦ Lesson 4: Using Lookups and Expressions
♦ Lesson 5: Creating Sessions and Batches
♦ Lesson 6: Working with Other Transformations
♦ Lesson 7: Using Shortcuts
1
Overview
This tutorial walks you through the process, from start to finish, of creating a data mart. The
tutorial will teach you how to:
♦ Create a repository
♦ Create users and groups
♦ Add source definitions to the repository
♦ Create targets and add their definitions to the repository
♦ Map data between sources and targets
♦ Instruct the Informatica Server to write data to targets
In general, you can set your own pace for completing the tutorial. However, we recommend
completing an entire lesson in one sitting, since each lesson builds on a sequence of related
tasks. After you've finished the tutorial, you’ll have mastered the basics of creating data marts
with Informatica's industry-leading tools.
2 Tutorial
Steps to Create a Data Mart
You can create a data mart in just a few steps:
♦ Create a target database or flat file system. The target then becomes the source of data
used for decision support.
♦ Create the repository. The repository contains all the information needed to move data
into the target.
♦ Create repository users and groups. You log into a repository as a repository user who
belongs to at least one user group. Your user profile determines which tasks you can
perform, based on the privileges granted to your group.
♦ Import descriptions of the sources. You can provide data from a relational source or flat
file.
♦ Create or import target definitions. You can define relational or flat file targets to receive
data from these sources.
♦ Create the target tables. You can create tables by generating and executing the necessary
SQL code within the Designer.
♦ Design mappings. A mapping specifies how you move data from sources into targets, as
well as any modifications that you want to make to this information.
♦ Run sessions. For each mapping, you'll need to create a session that moves data in the
fashion specified in the mapping.
For a more detailed breakdown of the process of designing data marts, see “Understanding
Data Marts” in the Administrator Guide.
If these terms—repository, mappings, sessions, and so forth—are unfamiliar at this point,
don't worry. You'll learn more about these concepts during the tutorial.
Overview 3
Lesson 1: Creating a Repository
The first step in designing a data mart is creating the repository. Each repository contains
metadata, information about sources and targets, as well as instructions on how and when to
move information between them. In the simplest possible repository, the metadata contains
the description of:
♦ A single source, such as a table in a relational database.
♦ One target, perhaps another table in a different database.
The metadata also includes mappings, identifying how each column in a target receives data
from one or more columns in the source. For example, the mapping might specify that the
CUSTOMER_ID column in a target table receives data from the CUSTOMER_ID column
in a source table. The CUSTOMER_NAME column in the target might receive data from
two columns, LAST_NAME and FIRST_NAME, two strings that are concatenated before
writing this modified information to the target. You need to instruct the server to concatenate
these strings before sending them to the target.
Metadata can include other types of information as well. For example, the metadata might
contain transformation details that specify how the server changes information before sending
it to the target database. Common changes might include:
♦ Formatting date values.
♦ Calculating the sum of all values found in a particular column.
♦ Replacing a customer’s numeric ID with the customer’s name stored in a separate table.
During this tutorial, you'll be using three different tools:
♦ The Repository Manager. Used to create and maintain repositories.
♦ The Designer. Used to import sources, design targets, create mappings, and develop
transformations.
♦ The Server Manager. Used to instruct the server how and when to move data according to
the instructions in mappings you create with the Designer.
Since the first step in building a data mart is creating a repository, you’ll use the Repository
Manager first.
4 Tutorial
In the Create Repository dialog, you specify the name of the new repository, as well as the
parameters needed to connect to the repository database through ODBC.
Informix database_name@server_name
For example, if your database platform is Sybase, the database name is TUTORIAL, and
it runs on the MY_SERVER database server, you would enter
MY_SERVER@TUTORIAL.
4. Click OK.
If a repository already exists in the database, the Repository Manager warns you that if
you want to continue, the new repository will replace the old one. However, since this is
the first time you've added a repository to the repository database, you should not see this
warning.
5. Click OK when prompted to create the repository.
The Repository Manager displays a SQL Output window and informs you that it will
take a short time to create the repository. While the Repository Manager runs the DDL
scripts needed to set up the repository, you can watch the results of this process in the
Output window. You can open and close the Output window from the View menu.
6. When the Repository Manager finishes creating the repository, click OK to close the
dialog.
Privilege Description
Session Operator Can use the command line program (pmcmd) to start sessions
and batches. Can start, view, monitor, and stop sessions or
batches with folder-level read permission and the Create
Sessions and Batches privilege using the Server Manager.
Use Designer Can edit metadata in the Designer, with read and write
permission at the folder-level.
Create Sessions and Batches Can create, modify, start, stop, and delete sessions and batches
through the Server Manager with folder-level read, write, and
execute permissions. Can configure some connections used by
the server.
Administer Repository Can create and modify folders, create and modify users and
groups, assign privileges to users and groups, and perform
database maintenance tasks such as backups.
Administer Server Can configure connections to the server and stop the server
through the Server Manager.
Super User Can perform any task in the repository and with the server.
Super User privilege supersedes all folder-level permissions.
6 Tutorial
The privileges you possess typically depend on your group membership, since every repository
member belongs to at least one group. For example, the person who administers the
repository might belong to the Administrators group, while your developers belong to the
Designers group. By default, you receive the privileges assigned to your group. While it’s most
common to assign privileges by group, the repository administrator (someone with either
Super User or Administer Repository privileges) can also grant privileges to individual users
where needed.
To take advantage of these user management features, you need to:
♦ Create groups.
♦ Assign privileges to groups.
♦ Create users and assign them to groups.
When you create a repository, the Repository Manager creates two default groups:
Administrators and Public. Within the Administrators group, two default users are also
created: Administrator (password Administrator) and a username equivalent to the database
username (and password) used when the repository was created. The first time you log into a
new repository, you use the Administrator user profile. You can then change the password and
begin adding new users and groups.
When you assign group memberships, each user:
♦ Inherits all group privileges.
♦ Can belong to more than one group and inherit the privileges of each one.
♦ Loses and gains privileges when moved from one group to another.
However, if a group itself is removed from the repository, any users in the group retain the
privileges they inherited from the group until you revoke them for the individual users.
In this tutorial, you will create two groups, Managers and Designers. Managers will be super-
users, the kind of user profile you want to grant to lead data mart developers and administer
the server. Designers will have privileges to create mappings and run sessions. First, you need
to connect to the repository.
2. Click Add.
3. Enter Managers for the name of the new group, and “Data mart developers” as the
description.
4. Click OK. The new group, Managers, appears in the list.
8 Tutorial
5. Now add another new group, specifying Designers as the group name, and “Repository
developers” as the description.
6. Click OK to return to the Repository Manager.
The next step is to grant privileges to these two groups.
2. From the Privileges list, select Administer Server. Note that only the Administrators
group and Administrator user currently have this privilege.
3. Click Add.
4. Select the Managers group and click Add.
10 Tutorial
To create a new user:
1. Choose Security-Manage Users.
A new dialog listing all the users in the repository appear.
2. Click Add.
7. Click OK. The user, jdoe, now has all privileges associated with the Administrators
group.
Creating a Folder
Every data mart is organized into folders, each containing a different type of metadata. Think
of folders in the Repository Manager as something like folders in the Windows operating
system, or projects in other development tools. In this case, you use folders to organize the
sources, targets, mappings, and transformations used to create a data mart. Each folder can
contain all of these components, or just some of them. Feel free to create folders and add
components to them in whatever way you find convenient.
For example, you might create a folder containing generic mappings used when you move
data into several different targets. Another folder might contain only target descriptions. Or
you could keep source definitions, target definitions, mappings, and transformations in every
folder, each organized for a different type of information.
In fact, that's just how many users organize their folders, each corresponding to a different
type of information, such as Human Resources, Research Projects, Sales Performance, or
Registered Vehicles.
Shared Folders
When you create a folder, you can configure it as a shared folder. Users working in other
folders can create shortcuts to metadata in a shared folder. By accessing metadata, such as a
source definition, through a shortcut, you can use it as if you had added the actual metadata
to your folder.
Folder Permissions
Folders also provide another layer of user management. You do this by assigning folders to an
owner and the owner’s group (selecting one of the owner’s group if the owner has multiple
12 Tutorial
group memberships). You then assign permissions to the folders which can extend repository-
level privileges for some users, allowing them to perform additional tasks for objects within a
specific folder. The three types of permissions include the following:
Read Can read, copy from, and create shortcuts to repository objects in the folder. If you do
not have the Read permission, you cannot view the folder unless you have the Super
User privilege.
Write Can edit metadata in the folder, and copy objects to the folder.
Permission Levels
Each folder has an owner, who acts as a kind of super user within the folder itself. Both the
folder owner and repository super users can grant folder permissions to others by selecting
one or more permission types at each of these permission levels:
♦ Owner. The owner of the folder, as listed in the owner menu.
♦ Owner’s Group. Each member of the group to which the owner belongs, including the
owner. If the owner belongs to more than one group, you must select one of those groups
in the Folder dialog. This becomes the Owner’s Group for the purposes of folder
permissions.
♦ Repository. All groups and users in the repository.
Each permission level includes the permissions of the level above it. Permissions won’t be
covered in this tutorial, since you will have only a single user accessing the repository. For
more information on assigning folder-level permissions, see “Repository Security” in the
Administrator Guide.
3. Choose Folder-Create.
A dialog used to configure the new folder now appears.
4. Enter the name of the folder as Orders.
5. Select jdoe as the folder’s owner.
Because jdoe is a member of only one group, Owner’s Group defaults to that group,
Administrators. If jdoe belonged to more than one group, you would select one of those
groups as Owner’s Group.
14 Tutorial
Lesson 2: Importing Source and Target Definitions
In this lesson, you’ll add the sample tables and their contents to your source database. Once
you've created these database objects, you can add descriptions of them, also called source
definitions, to your repository.
This dialog gives you several options for creating targets. If we already had target objects
in the repository, we could use this dialog to create the actual targets, since the Designer
Platform File
Informix SMPL_INF.SQL
Oracle SMPL_ORA.SQL
If you want, you can type the whole filename and path yourself. If you have installed the
client tools in a different directory, navigate to that directory to find these .SQL files.
Note: Database objects created in Informix databases will have shorter names than those
created in other types of databases. For example, the name of the table
ITEMS_IN_PROMOTIONS, created in these scripts, is shortened to
ITEMS_IN_PROMO.
Click Open and then click the Execute SQL file button.
16 Tutorial
The database now executes the SQL script to create the sample source database objects.
While the script is running, the Output window displays the progress.
11. Once the script is finished running, click Disconnect and then click Close.
12. Close the Output window by clearing View-Output.
Keep the Designer open, however, since we'll be working within this tool for the rest of the
tutorial, except for the very last steps.
18 Tutorial
Alternatively, you can click the All button to see all tables in the source database.
You should now see a list of all the tables you created by running the SQL script.
8. Click the CUSTOMERS table, hold down the Shift key, then click the STORES table.
You may need to scroll down the list of tables to reach STORES. You should now have all
the tables selected. If not, click the Select All button.
9. Click OK.
The Designer takes a few seconds to import the table descriptions. When it's finished,
the Designer displays the newly imported sources in the workbook.
20 Tutorial
Create the Target Definitions
The next step is to create a description of the target. You will add this target definition to the
metadata in the repository, just like the source definition. However, in this case, the actual
table that the target definition describes doesn't exist yet.
Target definitions can describe targets that already exist, or those you plan to create later. This
feature gives you a great deal of flexibility when prototyping your data mart, since you can
modify targets as needed before adding them to the database or flat file system. Once you're
satisfied with the target definition, you can then run the necessary SQL code, or create the
new flat file.
In this part of the tutorial, you will create a simple target table that will contain employee
information. In a real data mart, such tables would be relatively rare, since the whole point of
the data mart is to provide more information than what's contained in the records from a
single table in the source database. For example, instead of displaying the ID number of each
employee's manager, you might instead look up the manager's name and write that value in
the target table. However, the point of this initial exercise is to get comfortable using the
Designer to create mappings, so we'll keep the task simple.
The first target we create will be a copy of the EMPLOYEES table in the source database.
3. In the Create Target Table dialog, enter T_EMPLOYEES, select the correct database
platform, and click Create.
4. Click Done to close the Create Target dialog, then double-click the title bar of
T_EMPLOYEES.
An Edit Tables dialog appears, similar to what you saw when reviewing the EMPLOYEES
source definition.
5. Click the Columns tab, then click the Add button.
A new column appears in the list, with the default name NEWFIELD. You will give this
column a different name, as well as make other changes to it.
22 Tutorial
7. Select Integer for the column's datatype.
If your database doesn’t have an Integer datatype (for example, Oracle), use Number(p,s)
with a precision of 15 and a scale of 0.
8. In the Key Type section, designate this column as a primary key.
Since the primary key cannot accept nulls, the Designer automatically selects Not Null
and disables the Not Null option based on the key type. You now have a column ready to
receive data from the EMPLOYEE_ID column in the EMPLOYEES source table. Next,
you'll add some more columns to the table. Click the Add button and configure them in
the same fashion as you did with EMPLOYEE_ID.
Note: If you wanted to add a business name for any column, you could scroll to the right
and enter it.
9. Add the following columns to T_EMPLOYEES:
OFFICE_PHONE Varchar* 30 No
Don’t modify the Key settings for these columns, since you don’t want any of them to be
keys. When you’re finished, the target should be configured like this:
10. Click OK to close the dialog, then choose Repository-Save to save your work.
24 Tutorial
Lesson 3: Creating a Simple Mapping
Now it’s time to take stock of what you've done so far. You've added definitions of several
source tables to your repository, as well as that of a target table designed to store employee
records in your new data mart. You've generated and run the SQL code to create this new
target table. However, you don't yet have any way to move information from the source
EMPLOYEES table to the target T_EMPLOYEES table.
The next step is to create a mapping, a description of how to copy information from each
column in a source table to a corresponding column in a target table. The Designer gives you
a great deal of flexibility in designing mappings, as you'll see during this part of the tutorial.
The same target can receive data from several sources, and the same source can provide data
for several targets. Some of the information from a single source can go to one target, and
other information from the same source to a different target.
The Mapping Designer gives you a graphical palette that you’ll use to create the mappings. In
this portion of the Designer, you'll add sources and targets, draw the dataflow between
columns, and add transformations between them to modify the data before it reaches the
targets.
In your first mapping, you'll map information from each column in the source EMPLOYEES
table to its counterpart in the target T_EMPLOYEES table.
A window identical to the one you saw in the Source Analyzer now appears in the
workbook for the Mapping Designer. In addition, the Designer adds a Source Qualifier
to the transformation, representing the data that the server queries from the
EMPLOYEES table. The Source Qualifier is automatically connected to the source
definition. After you add the target definition, you will connect the Source Qualifier to
the target.
6. Click the Targets icon in the Navigator to open the list of all target definitions.
7. Click and drag the icon for the T_EMPLOYEES target into the workbook.
A new window for this target now appears. The final step is connecting the Source
Qualifier to this target definition.
26 Tutorial
To connect the Source Qualifier to the target:
1. Verify that the Layout-Link Columns option is checked.
2. Click once in the middle of the EMPLOYEE_ID row in the source qualifier. Holding
down the mouse button, drag the cursor to the EMPLOYEE_ID row in the target, then
release the mouse button.
An arrow (called a connector) now appears between the two columns.
28 Tutorial
Lesson 4: Using Lookups and Expressions
As you can tell by glancing at the Transformations toolbar, the Designer provides a lot more
transformations than just the Source Qualifier. Here's a list all the types of transformations
you can create:.
Transformation Description
Update Strategy Defines how the server should handle updates to existing
records in targets.
Rank Filters out all records except a top or bottom rank, such as
the top ten best-selling products in your inventory.
For many of the transformation types, you can also create an instance of a reusable
transformation that serves as a kind of template for other transformations.
In this lesson, you'll create some of the most common types of transformations:
♦ A Lookup transformation will find the name of a manufacturer.
♦ An Aggregator transformation will calculate the maximum, minimum, and average price
of items from each manufacturer.
♦ An Expression transformation will calculate the average profit of items, based on the
average price.
MANUFACTURER_NAME Varchar 72
If the Money datatype does not exist in your database, use Number (15,2) or Decimal
(15,2). If the Integer datatype does not exist, use Number (10,0) or Double.
7. Click Apply.
8. Select the Indexes tab.
This time, you'll add an index to your new target table.
If your target will exist in an Oracle database, skip to step 14, since you can’t add an
index to a column that already has the PRIMARY KEY constraint added to it.
9. In the Indexes section, click Add.
30 Tutorial
10. Enter IDX_MANUFACTURER_ID as the name of the new index, then press Enter.
11. Check the Unique index option.
To create T_ITEM_SUMMARY:
1. With the new table selected, choose Targets-Generate/Execute SQL.
Make sure that you don't have the T_EMPLOYEES table selected, or you'll re-create it
when you generate the T_EMPLOYEES table. Instead, type in a temporary file name.
For simplicity, you might want to just change the filename that appears by default.
2. In the Database Object Generation dialog, connect to the target database.
3. Make sure that you have selected the option to generate from selected tables, and have
checked the generate options for Create table, Primary key, Create index.
Leave the other options unchanged.
4. Click Generate and Execute.
The Designer now runs the SQL DDL code needed to create T_ITEM_SUMMARY.
5. Click Close, then choose Repository-Save.
32 Tutorial
10. Click and drag the T_ITEM_SUMMARY target into the mapping.
You need to move this target far to the right of the source and Source Qualifier to provide
enough space for the transformations you'll add next.
34 Tutorial
12. Configure the ports:
You might also select each port and click the Up and Down buttons to position the
output ports after the input ports in this list.
36 Tutorial
7. Double-click the PRICE port appearing beneath aggPriceCalculations.
A reference to this port now appears within the expression. The final step is to validate
the expression to ensure that you haven't made any mistakes.
8. Click Validate.
If you've followed the steps in this portion of the lesson carefully, the Designer tells you
that it parsed the expression successfully. In other words, the syntax you entered didn't
include any errors.
9. Click OK to close the message box from the parser, then click OK again to close the
Expression Editor.
Port Expression
OUT_MIN_PRICE MIN(PRICE)
OUT_AVG_PRICE AVG(PRICE)
Both MIN and AVG appear in the list of Aggregate functions, along with MAX.
Note that you can type this syntax, instead of using the point-and-click features of the
Expression Editor. However, use the point-and-click method to avoid typing mistakes.
3. Choose Repository-Save.
You may notice an error message in the Output window at this point. Ignore it, since all
it’s telling you is that you don’t have your targets connected to any transformations yet.
38 Tutorial
The new transformation appears when you release the mouse button.
2. Click and drag the dotted square (the viewing rectangle) within this window.
As you move the viewing rectangle, your perspective on the mapping changes.
40 Tutorial
3. Choose Repository-Save.
4. Select the MANUFACTURERS table from the scrolling list and click OK.
The Designer now adds the transformation. As you'll notice, the Lookup transformation
has the same columns as in the MANUFACTURERS source definition you created in the
Source Analyzer.
Since you already created a source definition for the MANUFACTURER, you don't have
to import the source definition into the repository at this point. You can use source and
target definitions in the repository to identify a lookup source for the Lookup
transformation. Alternatively, using the Import feature, you could have opened a
connection to a database, and designated some table or view in that database as the
lookup source.
5. Double-click the title bar of the transformation.
6. Name this transformation lkpManufacturers.
7. Add a new input port, IN_MANUFACTURER_ID, using the Integer datatype.
This port will receive MANUFACTURER_ID values. When the transformation receives
a new value through this port, it will look up the matching value in a record from
MANUFACTURERS. Remember that the Lookup transformation queries and stores the
contents of the table before the rest of the transformation runs, so it's performing the
join through a local copy of the table that it has cached.
8. Click the Condition tab, then click the Add button.
An entry for the first condition in the lookup appears. Each row in this dialog represents
one condition that appears in the WHERE clause that the server generates when
querying records. In this case, you'll be looking for matching MANUFACTURER_ID
values. However, you can enter multiple conditions for lookups, in which case the
Designer uses the AND operator to combine all the conditions you enter.
9. Verify the following settings for the condition:
MANUFACTURER_ID = IN_MANUFACTURER_ID
Note: If the datatypes (including precision and scale) of these two columns do not match,
you may not be able to validate your mapping.
42 Tutorial
10. Click the Properties tab.
Don't change any settings in this section of the dialog. For the time being, note that you
can modify how the Lookup transformation queries and caches values.
11. Click OK.
You now have a Lookup transformation that reads values from the MANUFACTURERS
table and can perform lookups using values passed through the
IN_MANUFACTURER_ID input port. The final step is to connect this Lookup
transformation to the rest of the mapping.
12. Choose Layout-Link Columns.
13. Connect the output port MANUFACTURER_ID from the Aggregator transformation to
the input port IN_MANUFACTURER_ID in the Lookup transformation.
MANUFACTURER_ID MANUFACTURER_ID
MANUFACTURER_NAME MANUFACTURER_NAME
OUT_MIN_PRICE MIN_PRICE
OUT_MAX_PRICE MAX_PRICE
OUT_AVG_PRICE AVG_PRICE
OUT_AVG_PROFIT AVG_PROFIT
2. Choose Repository-Save.
3. Close the Designer.
44 Tutorial
Lesson 5: Creating Sessions and Batches
Each mapping describes how to move data between a specific set of sources and targets, as well
as how to change this information along the way. Informatica's tools include a server
application that moves the data between sources and targets. When moving data, the server
transforms it according to the instructions you enter in a mapping.
Normally, you want to run the same mapping repeatedly to update information in the target
database or flat file system you've created for decision support. Therefore, you need to tell the
server to perform the data transformation specified in each mapping at regular intervals. For
example, the accounting department needs to look at monthly and perhaps weekly data about
accounts payable and accounts receivable. Similarly, the marketing department needs regular
reports to judge how competitive the company is.
You create a session to run a mapping at specified intervals. Sessions have additional options
that determine how and when the server moves data according to a particular mapping, as
you'll see in this lesson.
Earlier, when you needed to create a repository, you used the Repository Manager. To create
mappings, you used the Designer. Now, to send instructions to the server, you'll connect to
the repository through the Server Manager.
9. Enter any further information needed to connect to this database and click OK.
TUTORIAL_SOURCE now appears in the list of registered database connections.
10. Repeat the above steps to create another database connection called
TUTORIAL_TARGET for the target databases.
When you’re finished, TUTORIAL_SOURCE and TUTORIAL_TARGET appear in the
list of registered database connections.
11. Click Close.
You can now configure the Server Manager to communicate with the server.
46 Tutorial
4. Select the network protocol (IPX/SPX or TCP/IP) used to access the server across your
network and click Select. If you are using TCP/IP, you also need to enter the port number
the server is using.
Don't worry about the timeout setting for now.
Next, you'll enter the path where the server will store log files that record the progress of
sessions and any errors encountered.
5. Enter a directory for the server variable attribute $PMRootDir.
$PMRootDir is the root directory used by all other server variables. We recommend you
enter the directory where the server is installed, since all of the necessary subdirectories
were created there when you installed the server.
If you enter a different directory, you must make sure a directory exists for each server
variable.
6. Review the server variable directories.
7. Click OK.
You've now finished configuring the Server Manager to communicate with the server, and
indicated how to connect to the source, target, and repository databases. The next step is to
create a new session for the mPhoneList mapping.
Monitoring Sessions
As you work with sessions in the Server Manager, several menu options allow you to poll and
view server activity. Briefly, here’s how they work:
♦ Server Configuration-Monitor toggles the monitor window (which displays in the middle
third of the Server Manager workspace) on and off.
♦ Server Requests. On this menu, you can start polling, stop polling, or select Session
Overview. While polling is enabled, the Server Manager automatically polls the server and
displays the current status of any jobs in the Monitor window. Since this option creates
extra network traffic, you can instead select Session Overview to get a quick snapshot of
the latest activity.
At several points during the tutorial, you will turn the monitor on and off.
The Session Wizard now appears, providing many options for configuring your sessions.
For the tutorial, however, you can ignore most of the options.
48 Tutorial
4. Enter sPhoneList as the session name. This convention makes it easy to tell which
mapping each session runs.
5. In the Source section, select Relational and TUTORIAL_SOURCE for your Source
Database.
6. In the Target section, select Relational and TUTORIAL_TARGET for your Target
Database. These are the only options we need to select here; click Next to proceed
through the wizard.
On this panel, you can tell the server what to do when it updates data in a target table
that already contains records. However, since you're populating the target for the first
time, you don't need to worry about these settings for right now. This is also where you
enter the name and directory for session log files. You’ll skip this step, too.
50 Tutorial
9. Click Next.
This panel displays options read from the transformations contained in the session’s
mapping. In some cases, you need to select overrides for your transformations during a
session. For now, though, you don’t want to modify anything here, so you’re ready to
complete the wizard.
10. Click Finish.
The Server Manager now tells the server to store the description of the new session. If you had
configured the session to run at specific intervals, you'd wait to see what happened when the
session ran. However, you'll now tell the server to run the session immediately.
Name sItemSummary
52 Tutorial
Creating a Batch
When you organize sessions into a batch, the schedule you set for the batch overrides any
schedules for the individual sessions. While that might sound like a disadvantage at first,
consider for a moment how you're likely to schedule sessions. Normally, you'll want to time
the sessions to run at a time when network traffic and the load on the server are at a
minimum. This technique decreases the time needed to run the session, and most
importantly, it reduces the risk that running the sessions will interfere with the ability of users
to use data in the targets. In other words, you're likely to schedule as many sessions as you can
during the same windows of opportunity, at night or over the weekend.
Batches also help you ensure that targets affected by a set of related mappings all get updated
at the same time. For example, the finance department will want to update financial data
every day. But you need to update both accounts receivable and accounts payable at the same
time in order to accurately assess the organization’s current financial status.
In this tutorial, you’ll move both the sessions you created into a batch, then run the batch to
run both sessions.
54 Tutorial
To run the batch:
1. Click the batch to select it, then click the Start a Session/Batch button, or choose Server
Requests-Start.
2. Choose Start Polling from the Server Requests menu to view the progress of these
sessions.
56 Tutorial
3. Choose Targets-Create.
4. In the Create Target Table dialog, enter F_PROMO_ITEMS as the name of the new
target table, select the database type, and click Create.
5. Repeat step 4 to create the other tables needed for this schema: D_ITEMS,
D_PROMOTIONS, and D_MANUFACTURERS. When you have created all these
tables, click Done.
6. Double-click the title bar of each new target, and add these columns to the appropriate
table:
F_PROMO_ITEMS
NUMBER_ORDERED Integer NA
Note: For this table, you are including foreign key columns that correspond to the
primary keys in each of the following tables.
D_ITEMS
ITEM_NAME Varchar 72
D_PROMOTIONS
PROMOTION_NAME Varchar 72
MANUFACTURER_NAME Varchar 72
As you know from previous lessons, the next step is to generate and execute the SQL DDL
commands to create each of these new target tables.
58 Tutorial
2. From the list of targets, select the tables you just created and drag them into the
mapping.
Since you prefaced the names of these tables with F_ and D_, these targets should be easy
to find.
3. From the list of sources, add the following sources to the mapping:
♦ PROMOTIONS
♦ ITEMS_IN_PROMOTIONS
♦ ITEMS
♦ MANUFACTURERS
♦ ORDER_ITEMS.
4. Delete all Source Qualifiers that the Designer creates when you add these source
definitions.
The Designer creates Source Qualifiers for each source used by default. If no Source
Qualifiers were created, this option was changed.
5. Add a Source Qualifier transformation, srcAllData, to the mapping, adding all the
sources to it.
Creating a single Source Qualifier makes the server perform a single read on the source
database instead of multiple reads, which increases performance.
6. Choose View-Navigator to close the Navigator window.
You’ll need the extra space in the workbook.
60 Tutorial
3. Click and drag the following columns from the Source Qualifier transformation into the
Filter transformation:
♦ ITEM_ID
♦ ITEM_NAME
♦ PRICE
♦ DISCONTINUED_FLAG
4. Double-click the Filter transformation's title bar.
5. Rename the transformation filCurrentItems.
6. Click the Properties tab.
Here is where you specify the filter condition.
7. Select the Filter Condition field, and click the small button that appears in the right
corner of the field.
The Expression Editor dialog appears.
8. Highlight the word TRUE in the Formula field and press Delete.
9. Click the Ports tab, then double-click the DISCONTINUED_FLAG port.
10. Click = and 0 (zero).
The complete condition should now read as follows:
DISCONTINUED_FLAG=0
Populating expFPromoItems
Before continuing, you need to configure the transformation that collects all the data to be
sent to the target F_PROMO_ITEMS.
1. Click and drag the following columns from the Source Qualifier to the expression
transformation expFPromoItems:
♦ MANUFACTURER_ID1
♦ PROMOTION_ID
♦ ITEM_ID1
♦ COMMENTS
♦ DISCOUNT
2. Create the following columns in expFPromoItems:
Column Datatype
OUT_PROMO_ID Integer
OUT_ITEM_COUNT Integer
3. Choose Repository-Save.
In the rest of this lesson, you will use a Sequence Generator transformation to provide unique
IDs for PROMO_ITEM_ID, and a Stored Procedure transformation to populate
NUMBER_ORDERED.
62 Tutorial
If you have used sequences before, the properties of the Sequence Generator transformation
should look familiar:
♦ The starting number (normally 1).
♦ The current value stored in the Sequence Generator transformation.
♦ The number which the Sequence Generator transformation adds to its current value every
time someone requests a new ID.
♦ The maximum value you want used in the sequence.
♦ A flag indicating whether the Sequence Generator transformation's counter resets to the
minimum value once it has reached its maximum value.
The Sequence Generator transformation has two output ports, NEXTVAL and CURRVAL,
which correspond to the two pseudo-columns in a sequence. When you query a value from
the NEXTVAL port, the transformation adds the pre-set increment to its internal counter,
then provides the new value through this port.
In our new mapping, you'll add a Sequence Generator transformation to generate IDs for the
fact table F_PROMO_ITEMS.
Database Syntax
64 Tutorial
Database Syntax
In this section, you will add a Stored Procedure transformation to call this procedure. After
the stored procedure returns the number of orders containing an item, the transformation
provides this value through an output port.
4. Select the stored procedure named SP_GET_ITEM_COUNT from the tree and click
OK.
The Stored Procedure transformation appears in the mapping.
7. Click OK.
8. Connect the ITEM_ID column from the Source Qualifier to the IN_ITEM_ID column
in the Stored Procedure transformation.
9. Add a new input/output port, OUT_NUMBER_ORDERED, using the Integer datatype
or its equivalent, to the Expression transformation expFPromoItems.
10. Connect OUT_ITEM_COUNT from the Stored Procedure transformation to the OUT
NUMBER_ORDERED port in expFPromoItems.
11. Choose Repository-Save.
expFPromoItems F_PROMO_ITEMS
PROMOTION_ID FK_PROMOTION_ID
ITEM_ID1 FK_ITEM_ID
MANUFACTURER_ID FK_MANUFACTURER_ID
66 Tutorial
expFPromoItems F_PROMO_ITEMS
COMMENTS COMMENTS
DISCOUNT DISCOUNT
OUT_PROMO_ITEM_ID PROMO_ITEM_ID
OUT_NUMBER_ORDERED NUMER_ORDERED
2. Connect the following columns from the Source Qualifier transformation to the targets:
3. Choose Repository-Save.
The mapping is now complete. Since you've had some experience with sessions, you might
want to create and run a new session that uses this mapping.
68 Tutorial
Index
Chapter 14
A target definitions, 15
Designer
aggregate calculations, 36 generating SQL DDL commands with, 24
Aggregator transformations, 29, 33–38
analyzing sample sources, 18–20
E
B Execute permission, 13
Expression transformations, 29, 38
batches External Procedure transformations, 29
creating, 53–55
F
C Filter transformations, 29, 60–62
configuring server folders
communication with Server Manager, 45–47 creating, 12–14
in tutorial, 13–14
permissions, 12–13
D shared folders, 12
data marts
creating, 3
database platforms, 16
G
definitions groups
adding to repository, 17–20 assigning privileges to Managers group, 9
source definitions, 15 creating Managers group, 8
69
creating repository groups, 11
P
permissions
I folder, 12–13
populating targets, 62
importing definitions, 15
privileges
Informix database platform, 16
assigning to Managers group, 9
J R
Joiner transformations, 29
Rank transformations, 29
Read permission, 13
L repositories
adding source definitions to, 17–20
Lookup transformations connecting to, 7–8
adding, 41–44 creating, 4–14
description, 29 creating repository groups, 11
creating repository users, 11
M
Managers group, 8, 9
S
Mapping Designer, 58 sample sources
mappings analyzing, 18–20
changing display, 27–28 sample tables
completing, 66 creating, 15–17
creating, 25–28, 32–33, 58–60 scheduling batched sessions, 53
Microsoft SQL Server database platform, 16 Sequence Generator transformations, 29, 62–64
server
providing with connectivity information, 45
N Server Manager
configuring, 45–47
new mapping
sessions
creating, 32–33
creating, 48–52
new target
shared folders
creating, 30–31
definition, 12
new user
source definitions
creating, 11
adding to repository, 17–20
Normalizer transformations, 29
importing, 15
reviewing, 20
O Source Qualifier transformations, 29
connecting to target, 27
Oracle database platform, 16 sources
Overview window, 40 analyzing sample sources, 18–20
SQL DDL commands, 24
Stored Procedure transformations, 29, 64–66
Sybase SQL Server database platform, 16
70 Index
T
tables
sample, 15–17
target definitions, 15
targets
connecting Source Qualifier to, 27
connecting to, 44
creating, 24, 30–31
populating, 62
transformations, 29, 56
U
Update Strategy transformations, 29
users
repository users, 11
W
Write permission, 13
Index 71
72 Index