Вы находитесь на странице: 1из 76

Getting Started

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.

Before You Begin


Before starting the lesson plan in the basic tutorial, you need to complete some preliminary
tasks. Be sure each of these tasks is done before you start:
♦ Create source, target, and repository databases. You should create a separate database for
each of these, and these should not be databases containing important data used within
your organization. The amount of source and target data is fairly small, so you do not need
to allocate a large amount of space for the sample databases. Each database should be less
than two megabytes.
♦ Install and configure the server. The server does not have to be installed on the same
machine where any of the three databases is located. The machine on which you install the
server must have access to all three databases (source, target, and repository). For more
information on installing the server, consult the installation chapters in the Administrator
Guide.
♦ Install the client software. Once again, you must make sure that you have access to all
three databases as well as the server. For more information on installing the client tools,
consult the installation chapters in the Administrator Guide.
♦ Create the ODBC data sources used to connect to databases. Informatica's tools use
ODBC to connect to various databases during data mart creation and maintenance.
Therefore, on the same system where you installed the client software, you'll need to create
ODBC data sources for each database. For more information on this step, see “Using
ODBC” in the Administrator Guide. You should use an easy-to-remember naming
convention for these three ODBC data sources, such as Tutorial source, Tutorial target,
and Tutorial repository.

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.

To create the repository:


1. Launch the Repository Manager by choosing Programs-PowerCenter (or PowerMart)
Client-Repository Manager from the Start Menu.
2. In the Repository Manager, choose Repository-Create Repository.
Note: You must be running the Repository Manager in Administrator mode to see the
Create Repository option on the menu. Administrator mode is the default when you
install the program.

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.

3. Enter TUTORIAL as the name of the new repository.


Enter the username and password, followed by the name of the ODBC data source used
for the repository and the native connect string, in the appropriate fields.The connect
string uses the following syntax:

Database Platform Native Connect String

IBM DB2 database_name

Informix database_name@server_name

Microsoft SQL Server server_name@database_name


Sybase SQL Server

Oracle dbname.world (corresponds to an entry in TNSNAMES.ORA)

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.

Lesson 1: Creating a Repository 5


Note: If you are using PowerCenter, you are asked if you want to make the repository a
global repository. Click No to create a local repository. For details, see “Power
Center Repositories” in the Administrator Guide.
An icon representing the new repository now appears in Navigator, which is the left pane
of the Repository Manager. Later, you can double-click the repository’s icon to view its
contents.

Creating Repository Users and Groups


When you connect to a repository, you log in through a repository user profile, not a database
user profile. Your user profile determines what tasks you can perform. For example, while you
may be able to edit metadata in the repository, you may not have the privileges necessary to
run sessions, or to create other repository users.
The Informatica tools include two basic types of security: privileges and permissions. You can
think of privileges as repository-wide security that controls which task or set of tasks a single
user or group of users can access. We use the term permissions, on the other hand, to describe
security assigned to individual folders within the repository. This tutorial covers the basics of
privileges and permissions, but more information is available in the chapter “Repository
Security” in the Administrator Guide.
For each privilege, you can perform various tasks. The following table lists some of the most
common tasks associated with each privilege:

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.

Browse Repository Can browse repository contents through the Repository


Manager, add and remove reports, maintain the registry, and
change your user password.

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.

To connect to the repository:


If you’re already connected to the Repository, disconnect and connect again, so you can log in
with the Administrator username.
1. Launch Repository Manager, and click the Connect button.
A list of all repositories appears in the Navigator.
2. Double-click the TUTORIAL repository from this list.
3. Enter Administrator as the username, and Administrator as the password.
4. Click Connect.
The dialog box expands to enter additional information.
5. Select the ODBC data source corresponding to the repository database.

Lesson 1: Creating a Repository 7


6. Enter the database username and password needed to connect to this database.
7. Enter the native connect string for your database.
8. Click Connect.
You’re now connected to the repository as the user Administrator.

To create the Managers group:


1. Select the repository in the Navigator, and choose Security-Manage Groups.
The Manage Group dialog lists all existing groups in the repository. Since you haven’t
created any new groups yet, only the two default groups, Administrators and Public,
appear in the list. You cannot edit or remove these groups.

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.

To assign privileges to the Managers group:


1. Choose Security-Manage Privileges.
In the Manage Privileges dialog, the drop-down list shows the various privileges you can
assign to groups and users. By default, the first item in the list, Session Operator, is
selected. Below the list is a window displaying all the groups and users that possess the
selected privilege. Right now, only the Administrators group and Administrator user have
the Session Operator privilege. Since these are the system defaults, you cannot remove
their privileges.

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.

Lesson 1: Creating a Repository 9


The Managers group now appears in the list of users and groups who possess the
Administer Server privilege.

5. From the list of privileges, select Administer Repository.


Since you did not select this privilege for the Managers group, they do not appear in the
list.
Next, we’ll assign privileges to the Designers group.
6. Select Use Designer from the Privileges list.
Notice both new groups have this default privilege. The default privileges granted to each
new group and new user are:
♦ Use Designer
♦ Create Sessions and Batches
♦ Browse Repository
7. Select Session Operator from the Privileges list.
8. Click Add.
9. Select the Designers group and click Add.
The Designers group now has the ability to start a session in any folder they can see in
the repository (any folder for which they have read permission).
The final step in this portion of the tutorial is to create a new user, jdoe, and add this user to
the Administrators group. You’ll use this user profile throughout the rest of this tutorial.

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.

3. In the New User dialog, enter jdoe as the username.


4. In both the Password and Confirm Password fields, enter jdoe.
5. Click the Group Memberships tab.

Lesson 1: Creating a Repository 11


6. Select Administrators as jdoe’s group.

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:

Permission Type Description

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.

Execute Can run sessions using mappings in 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.

Folders in this Tutorial


For this tutorial, you'll be creating a single folder, Orders. Ultimately, the metadata in this
folder will help create a target database containing related information about orders,
customers, and products.

To create a new folder:


1. Launch the Repository Manager, and choose Repository-Connect.
If you are already connected to the repository, disconnect and start over so you can log in
as a member of the Administrators group.
2. In the dialog that appears, enter the username and password used to connect to the
repository and click Connect.

Lesson 1: Creating a Repository 13


Since you have set up the jdoe user profile, enter this username/password combination.
You’re now connected to the repository as an Administrator, since jdoe belongs to the
Administrator group.

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.

6. Click OK to create the folder.


The new folder Orders now appears as part of the TUTORIAL repository.
7. Exit the Repository Manager.

What Comes Next


Now that you’ve created the repository, you can start adding source and target definitions to
it. However, you first need to create the actual source tables that contain the sample data.

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.

Creating Source Tables


To create the source tables, you need to run a SQL script for the type of database that will
contain these objects.

To create the sample tables:


1. Launch the Designer, double-click the icon for the TUTORIAL repository, and log into
the repository.
Again, be sure to use the jdoe/jdoe user profile to open the connection.
2. Once you have logged in, double-click the Orders folder within this repository.
3. Choose Tools-Warehouse Designer to switch to the Warehouse Designer.
The Designer has four different modes:
♦ The Source Analyzer. Adds source definitions to the repository.
♦ The Warehouse Designer. Creates targets and adds their definitions to the repository.
♦ The Transformation Developer. Creates reusable transformations (more on this later
in the tutorial).
♦ The Mapping Designer. Creates mappings between sources and targets.
Note: We're in the Warehouse Designer because this part of the Designer lets you run a
SQL script, which we'll need to do to create the sample source tables. With most data
marts, you’ll already have existing source database tables or flat files.
4. Choose Targets-Generate/Execute SQL.

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

Lesson 2: Importing Source and Target Definitions 15


can generate and run all the necessary SQL DDL commands. However, in this case, we'll
be running a script instead of letting the Designer generate the SQL.
5. Click the Connect button.
6. In the dialog that appears, select the ODBC data source you created for connecting to the
source database (not the repository!).
7. Enter the database username and password and click the Connect button.
You now have an open connection to the source database. You know that you’re
connected when the Connect button reads Disconnect, and the ODBC name of the source
database appears in the dialog box.
8. Make sure the Output window is open at the bottom of the Designer.
If it isn't, click the Toggle Output Window button on the View toolbar, or choose View-
Output.
9. Click the Select File button.
10. Select the .SQL file appropriate to the database platform you're using in the program
installation directory.

Platform File

Informix SMPL_INF.SQL

Microsoft SQL Server SMPL_MS.SQL

Oracle SMPL_ORA.SQL

Sybase SQL Server SMPL_SYB.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.

Adding Source Definitions to the Repository


Now that you've added the source tables containing sample data to the source database, you're
ready to add the definitions of these sources to your metadata. Remember, the repository will
contain a description of source tables, not the actual records contained in them. Once you
add these source definitions to the repository, you'll be able to use the source tables in a
mapping.

Lesson 2: Importing Source and Target Definitions 17


To analyze the sample sources:
1. In the Designer, click the Source Analyzer button on the workbook, or choose Tools-
Source Analyzer.
When you opened the workbook in the previous lesson, you may have noticed that the
workbook includes a button for each mode of the Designer. You can click these buttons
to switch between modes for looking at metadata in the folder represented by the
currently selected workbook. If you ever lose track of which folder a workbook
represents, move your mouse over the tab appearing at the bottom of the workbook. To
view metadata from another folder, you need to open a new workbook.
2. Double-click the Orders folder to view its contents.
Every folder contains sections for sources, targets, schemas, mappings, and re-usable
transformations.
3. Choose Sources-Import from Database.
4. In the dialog that appears, select the ODBC data source used to access the database
containing the source tables.
5. Enter the username and password for connecting to this database, as well as the name of
the source table's owner.
In Oracle, the owner name is the same as the username. However, make sure that the
owner name is in all caps (for example, JDOE).

6. Click the Connect button.


7. In the Select tables list, double-click the name of the owner, then double-click the
TABLES heading.

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.

Lesson 2: Importing Source and Target Definitions 19


You should also note that a new entry appears under the Sources portion of the Orders folder.
This new entry has the same name as the ODBC data source you use to access the sources you
just imported. If you double-click the name of the ODBC data source, you'll see the list of all
the imported sources.

Reviewing a Source Definition


Now that you've added source definitions to the repository, let's take a closer look at one.

To review a source definition:


1. Double-click the title bar of the source definition for the EMPLOYEES table.
The Edit Tables dialog opens and displays all the characteristics of this source definition.
The Table tab shows the name of the table, business name, database name, owner name,
and the database type. If you want to add a comment, you could enter it in the
Description section.
Note: At this point, you could also change the source table name by clicking Rename.

2. Click the Columns tab.


This portion of the dialog shows the column descriptions for the source. You could
modify the source definition at this point, changing or deleting columns. However, you
rarely use this feature in the Source Analyzer, since you don't want to make the source
definition out of sync with the actual source. Any changes you make in this dialog affect
the source definition, not the source. If the table included any foreign keys, a primary
table and column name would appear in the dialog.

3. Click Cancel to close the dialog.

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.

To create the first target definition:


1. In the Designer, switch to the Warehouse Designer.
2. Choose Targets-Create.

3. In the Create Target Table dialog, enter T_EMPLOYEES, select the correct database
platform, and click Create.

Lesson 2: Importing Source and Target Definitions 21


Behind the dialog, a new target, T_EMPLOYEES, appears in the workbook. It doesn't
contain any columns yet, so we'll add them to the target in the next steps.

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.

6. Select the column name and enter EMPLOYEE_ID.

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:

Name Datatype Precision Not Null

LAST_NAME Varchar* 30 Yes

FIRST_NAME Varchar* 30 Yes

OFFICE_PHONE Varchar* 30 No

* Use Varchar2 in Oracle

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.

Lesson 2: Importing Source and Target Definitions 23


Create the Targets
Now that you have a complete table structure for your first target, you're ready to generate
and run the SQL DDL commands needed to create this target. As you saw earlier when you
used this feature to generate the source tables, you can use the Warehouse Designer to run an
existing .SQL file containing DDL instructions. However, in this case, we want the Designer
to generate the SQL code needed to create your new target based on the target definition we
just created.
Note: Whenever you let the Designer generate the SQL DDL commands for creating a target,
the SQL code can start with instructions to drop a table with whatever name you've assigned
to your new target, if you have the DROP TABLE option checked. This feature exists so that
you can modify targets that you're still developing, dropping the old version of the target
before creating the new one. If your target database already contained tables before you
started designing your data mart, you should check to make sure that an existing table doesn't
have the same name as a target that you plan to create. If the table exists, you will lose the
table and any existing data.

To create the target T_EMPLOYEES table:


1. Make sure that you have the target definition for T_EMPLOYEES selected.
2. Choose Targets-Generate/Execute SQL.
The same dialog appears that you used to run the SQL script that created the source
tables.
3. In the Filename field, enter C:\[your installation directory]\ MKT_EMP.SQL.
If you installed the client software somewhere else, enter the appropriate drive letter and
directory.
4. If you are connected to the source database from the previous lesson, click Disconnect,
then Connect.
5. In the dialog that appears, select the ODBC data source used to connect to the target
database.
6. Enter the necessary username and password, then click the Connect button.
7. Select the Cr eate Table , Drop Table , and Primar y Key options.
8. Click the Generate and Execute button.
The Designer now runs the DDL code needed to create T_EMPLOYEES. If you want to
review the actual code, click Edit SQL file to open the MKT_EMP.SQL file.
9. Click Close to exit.

What Comes Next


In the next lesson, you’ll design the dataflow between sources and targets, specifying how each
column in the target table receives data from a counterpart column in the source table.

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.

To create the first mapping:


1. Switch to the Mapping Designer and make sure the workbook is open.
2. Choose Mappings-Create.
Although you don't see anything yet, you have just opened a new mapping in the
workbook.

Lesson 3: Creating a Simple Mapping 25


3. In the Mapping Name dialog, enter mPhoneList as the name of the new mapping and
click OK.
Your mapping now has a descriptive name. As you might have guessed, the naming
convention for mappings is mMappingName.
4. In the Navigator, under the TUTORIAL repository and Orders folder, click the Sources
icon to open the list of all source definitions added to the repository.
5. Click the icon representing the EMPLOYEES source and drag it into the workbook.

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.

3. Repeat steps 2 and 3 to map the LAST_NAME, FIRST_NAME, and OFFICE_PHONE


columns between the Source Qualifier transformation and the T_EMPLOYEES target
table.
If you accidentally connect the wrong columns, select the connector and press the Delete
key.
4. Choose Repository-Save.
Looking at the mapping, it may be hard to distinguish how columns map to each other.
The Designer has several features designed to make it easier to review a mapping.

To change how the mapping appears:


1. Choose Layout-Arrange.
2. In the Select Targets dialog, select the T_EMPLOYEES table and click OK.
The Designer now rearranges the source, Source Qualifier, and target from left to right,
making it easier to see how one column maps to another. However, you still may not be
able to see all the columns in the Source Qualifier and the source.
3. Drag the lower edge of the source and Source Qualifier windows until all columns
display.

Lesson 3: Creating a Simple Mapping 27


Now, let's take a closer look at this mapping. Data flows from source to Source Qualifier to
target through a series of input and output ports.
The source provides information, so it contains only output ports, one per column. Each
output port is connected to a corresponding input port in the Source Qualifier. By design, the
Source Qualifier transformation contains both inputs and outputs. This transformation needs
to receive data from the source, then pass it along to the target. And, naturally, the target only
contains input ports.
Later, when you design mappings containing different types of transformations, you'll spend a
fair amount of time configuring ports in a variety of ways. For example, you can define ports
in some transformations as inputs, outputs, or both; you can rename ports and change their
datatypes; you can make the data sent through an output port the result of an expression. You
can use output ports from one transformation as input ports in another transformation.

What Comes Next


At this point, we could create a session to move data between the source and the target.
However, before continuing, let’s create a more complex mapping to learn how to modify data
before it reaches the target.

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

Source Qualifier Represents source data to be read by the server.

Update Strategy Defines how the server should handle updates to existing
records in targets.

Expression Performs a simple calculation, using data from one or more


input ports.

Filter Performs a test on all records before allowing them to be


sent to targets.

Aggregator Performs an aggregate calculation (sum, average, count, and


so forth) on one column of data.

Lookup Looks up values.

Sequence Generator Generates values in the same fashion as a sequence in a


relational database.

Stored Procedure Calls a stored procedure and captures return values.

External Procedure Calls a procedure defined in a shared library.

Joiner Joins data from different databases or flat files.

Normalizer Represents data read from COBOL (mainframe) sources.


Also normalizes records that contain denormalized
information.

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.

Lesson 4: Using Lookups and Expressions 29


Creating a New Target
Before creating the mapping, you need to design a new target that will hold summary data
about products from various manufacturers. This table will include the maximum and
minimum price for products from a given manufacturer, an average price, and average profit
earned from selling these items.

To design the new target:


1. In the Designer, choose Window-New Window.
If this option is disabled, make sure that you have something selected in the current
workbook before you choose Window-New Window.
A new workbook appears. At the bottom of each workbook is a tab, used to switch
between workbooks as needed. Click the tab for the previous workbook, then select the
one you just opened.
2. In the new workbook, switch to the Warehouse Designer.
3. Choose Targets-Create.
4. In the dialog that appears, enter T_ITEM_SUMMARY as the name of the new target
table, click Create, then click Done.
5. Double-click the title bar of the new target.
6. Add the following columns to T_ITEM_SUMMARY:

Column Datatype Precision Not Null Key Type

MANUFACTURER_ID Integer Checked Primary key

MANUFACTURER_NAME Varchar 72

MAX_PRICE Money Checked

MIN_PRICE Money Checked

AVG_PRICE Money Checked

AVG_PROFIT Money Checked

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.

12. In the Columns section, click Add.


13. Select MANUFACTURER_ID and click OK.
14. Click OK to close this dialog, then choose Repository-Save.
As you know from previous lessons, the next step is to generate and execute the SQL DDL
commands to create this new target table.

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.

Lesson 4: Using Lookups and Expressions 31


Creating the New Mapping
The next step is to create a mapping that populates this new target. This mapping will
perform the following tasks:
♦ For each manufacturer, find the most expensive and least expensive item in your inventory.
♦ Calculate the average price and profitability of all items from a given manufacturer.
To provide this information, the mapping will have to perform both simple and aggregate
calculations. For example, you will use the MIN and MAX functions to find the most and
least expensive items from each manufacturer.

To create the new mapping:


1. In the Designer, click the tab for the workbook containing the first mapping you created.
By selecting this tab, you automatically switch from the Warehouse Designer to the
Mapping Designer.
2. Choose Mappings-Create.
3. When asked whether you want to close the current mapping, click Yes.
4. In the Mapping Name dialog, enter mItemSummary as the name of this new mapping.
5. From the list of sources in the TUTORIAL folder, click and drag the ITEMS table into
the mapping.
6. Double-click the title bar of the Source Qualifier.

7. In the Edit Transformations dialog, click Rename.


8. Enter srcAllData as the new name of the Source Qualifier transformation.
9. Click OK, then click OK again.

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.

Creating an Aggregator Transformation


One of the first requirements in the new mapping is an Aggregator transformation to
calculate the average, maximum, and minimum prices of items from each manufacturer.

To add the Aggregator transformation:


1. On the Transformations toolbar, click the Aggregator button.
2. Click in the space between the Source Qualifier and the T_ITEM_SUMMARY target.
The Designer adds a new Aggregator transformation to the mapping.

3. Choose Layout-Link Columns.


Now when you drag a column's worth of data from one transformation to another, the
Designer will copy the port description and link the original port to its copy. For this
feature to work, the port you copy must have both an input and an output.
If you had chosen Layout-Copy Columns, every port you drag would be copied, not
linked.

Lesson 4: Using Lookups and Expressions 33


4. From the Source Qualifier, click and drag the PRICE column into the Aggregator
transformation.
A copy of the PRICE column now appears in the new Aggregator transformation. The
new column has the same name and datatype as the original version.
The Aggregator transformation now receives data from the PRICE column. You need this
information to calculate the maximum, minimum, and average product price for each
manufacturer.
5. Click and drag the MANUFACTURER_ID column into the Aggregator transformation.
You need another input, MANUFACTURER_ID, to provide the information for the
equivalent of a GROUP BY statement. By adding this second input, you can define the
groups (in this case, manufacturers) for the aggregate calculation. This will organize the
data by manufacturer.
6. Double-click the title bar of the transformation.
7. Change the name of this transformation to aggPriceCalculations.
The naming convention for Aggregator transformations is aggTransformationName.
8. Click the Ports tab.
9. Uncheck the Output (O) box for PRICE.
You want to use this port as an input (I) only, not as an output (O). Later, you'll use data
from PRICE to calculate the average, maximum, and minimum prices.
10. Check the Group By option for the MANUFACTURER_ID column.

11. Click Add three times to add three new ports.

34 Tutorial
12. Configure the ports:

Name Datatype Precision Scale I O V

OUT_MIN_PRICE Decimal 19 2 No Yes No

OUT_MAX_PRICE Decimal 19 2 No Yes No

OUT_AVG_PRICE Decimal 19 2 No Yes No

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.

13. Click Apply to save your changes to this point.


The next step is to enter the expressions for all three output ports, using the functions MAX,
MIN, and AVG to perform aggregate calculations.

Lesson 4: Using Lookups and Expressions 35


To enter the first aggregate calculation:
1. Click the Expression field of the OUT_MAX_PRICE column.
You'll notice that a small button appears in the right corner of this section.
Click the button to open the Expression Editor.

Every transformation that requires you to enter an expression (the Aggregator,


Expression, Filter, and Rank transformations) uses this dialog. The Formula section of
the Expression Editor displays the expression as you develop it. You use other sections of
this dialog to select the input ports used to provide values for an expression, enter literals
and operators, and select the functions you want to use in the expression.
2. Select the text OUT_MAX_PRICE and press the Delete key.
3. Double-click the Aggregate heading in the Functions section of the dialog.
A list of all group functions now appears.
4. Double-click Max in the list.
The MAX function now appears in the window where you enter the expression. To
perform the calculation, you need to add a reference to an input port that provides data
for the expression.
5. Move the cursor between the parentheses next to MAX.
6. Click the Ports tab.
This section of the Expression Editor displays all the ports from all transformations
appearing in the mapping.

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.

To enter the remaining aggregate calculations:


1. Using the technique you just learned, enter and validate the following expressions for the
other two output ports:

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.

Lesson 4: Using Lookups and Expressions 37


2. Click OK to close the Edit Transformations dialog.

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.

Creating an Expression Transformation


Now that you have calculated the highest, lowest, and average prices for items, the next step is
to calculate the average profitability of items from each manufacturer. While such calculations
are normally more complex, we'll simply multiply the average price by 0.2 (20%).
To add this information to the target, we need to create an Expression transformation that
takes the average price of items from a manufacturer, performs the calculation, then passes the
result along to the target. As you develop your own transformations, you'll frequently chain
together transformations in this fashion, using the output of one transformation as an input
for others.

To add an Expression transformation:


1. On the Transformations toolbar, click the Expression button.
2. Click in the area to the right of the Aggregator transformation.

38 Tutorial
The new transformation appears when you release the mouse button.

3. Double-click the title bar of the Expression transformation.


4. In the Edit Transformations dialog, change the name of this transformation to
expAvgProfit.
5. Add a new input port, IN_AVG_PRICE, and a new output port, OUT_AVG_PROFIT,
both using the Decimal datatype with precision of 19 and scale of 2.
6. Enter the following expression for OUT_AVG_PROFIT:
IN_AVG_PRICE * 0.2

7. Validate the expression.


8. Close the Expression Editor, then close the Edit Transformations dialog.
9. Connect OUT_AVG_PRICE from the Aggregator to the new input port.
10. Choose Repository-Save.
At this point, your mapping is getting large enough to make it difficult to view it all at once.
You can use the Overview window to navigate around the workbook containing this mapping.

Lesson 4: Using Lookups and Expressions 39


To use the Overview window:
1. Choose View-Overview Window.
A window appears, displaying a smaller version of the mapping.

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.

Joining Data for the Target


Before you continue, you need to add an extra transformation that joins data coming from the
Aggregator, Expression, and (later in this lesson) Lookup transformations. If you connect
several transformations to the same target, you might get a mismatched row count. For
example, an Aggregator transformation might write a single value, such as an average, while
an Expression transformation provides several values, the result of a computation performed
on multiple rows. If the server tries to write one record of values from the Aggregator and 100
values from the Expression transformation, it won't know how many rows to insert in the
target.
To prevent this problem, you’ll create an interim Expression transformation to join values
from several different sources before sending them to the same target.

To create an interim transformation:


1. Create a new Expression transformation, named expJoinAllData.
2. Click and drag all the output ports from the Aggregator and Expression transformation,
expAvgProfit, into expJoinAllData.
The Designer copies these ports and connects them to the original output ports in the
Aggregator and Expression transformations.

40 Tutorial
3. Choose Repository-Save.

Locating Additional Data


The last step is to find each manufacturer's name in the MANUFACTURERS table, using the
Lookup transformation.

To add the Lookup transformation:


1. Click the Lookup button on the Transformations toolbar.
2. Click in the mapping to create the new transformation.
A dialog asks you to identify the source or target used to provide data for the lookup.
When the server runs a session using this transformation, it needs to know where to
obtain values.

Lesson 4: Using Lookups and Expressions 41


3. Click Source.

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:

Lookup Table Column Operator Transformation Port

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.

Lesson 4: Using Lookups and Expressions 43


14. Click and drag the MANUFACTURER_NAME port from the Lookup transformation
into the Expression transformation expJoinAllData and configure these new ports in both
transformations as combined input/output ports.
15. Choose Repository-Save.

Connecting the Target


Now that you have set up all the transformations needed to modify data before writing to the
target, let’s review what you’ve accomplished:
♦ Created a target.
♦ Created a mapping.
♦ Added transformations (and calculations).
♦ Joined data.
The final step is to connect expJoinAllData to the target.

To connect to the target:


1. Click and drag the following output ports in expJoinAllData to the corresponding input
ports in the target:

Output Port Input Port

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.

What Comes Next


You now have two mappings completed:
♦ mPhoneList, a simple mapping that reads employee names and phone numbers.
♦ mItemSummary, a more complex mapping that performs simple and aggregate
calculations as well as lookups.
Now is a good time to use these mappings to move data from sources to targets. To do so, we
need to give the server some instructions by defining sessions and batches.

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.

Configuring the Server and the Server Manager


Before you can create a session, you need to configure the Server Manager to communicate
with the server.
First, you need to provide the server with the information it needs to connect to the source
and target databases.

To define database connections:


1. Launch the Server Manager.
2. Select the TUTORIAL repository in the Navigator, then choose Repository-Connect.
3. Enter the username and password (jdoe/jdoe) for connecting to it, and click Connect.
4. Choose Server Configuration-Database Connections.
5. In the Database Connections dialog, click Add.

Lesson 5: Creating Sessions and Batches 45


6. In the Data Source field, enter TUTORIAL_SOURCE as the name of the database
connection.
Only the server uses this database name as a reference to one database connection it needs
to use. This is not the same name as an ODBC data source, or the location of a database
used to connect to it through the native database drivers.
7. Enter the username and password, as well as the name of the ODBC data source used to
connect to the database.
8. Select your Database Type from the list.
The dialog now expands, adding options appropriate to the selected database platform.

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.

To configure the Server Manager to communicate with the server:


1. Make sure the server is running. If not, start the server on that machine.
2. While connected to the TUTORIAL repository in the Server Manager, choose Server
Configuration-Register Server.
3. In the server dialog, enter the Server Name and the Host Name (or address) where your
server is located.

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.

Lesson 5: Creating Sessions and Batches 47


Creating the First Session
The first session you'll create uses the simple mapping mPhoneList. Later, you will add a
second session to run the second mapping you created, mItemSummary.

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.

To create the session:


1. In the Navigator, double-click the folder containing the mPhoneList mapping.
2. Click the Add Session button, or choose Operations-Add Sessions.
3. In the dialog that appears, select the mapping mPhoneList and click OK.

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.

Lesson 5: Creating Sessions and Batches 49


7. For the schedule, select Run Only on Demand.
As you can tell from this panel, you can set various intervals (for example, every week or
every 6 hours) for running the session. (If you want to view additional options, select
Customized Repeat and click the Edit button.)
8. Click Next.

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.

Lesson 5: Creating Sessions and Batches 51


To run the session:
1. In the Server Manager, click the session to select it.
2. Click the Start A Session/Batch button on the toolbar, or choose Server Requests-Start.
The server now starts running the session. Since a small number of records are involved,
you may not be able to switch to monitoring mode fast enough to see the actual
operation. However, this is a good chance for you to learn how to switch to monitoring
mode, used to watch how sessions and batches are progressing.

To monitor the server:


1. Select the server in the Navigator. Choose Server Configuration-Monitor.
This opens the Monitor window (and splits the screen) to show a snapshot of all sessions
running on the selected server. The session is listed in the upper section of the screen. If
other sessions were scheduled, the lower window on the screen would list them.
2. To see a refreshed view of the session status, choose Server Requests-Session Overview.
If the session completes before you refresh the view, the Server Manager tells you when
the server finishes running the session.

Creating the Second Session


Now that you know what it takes to create a session, make a new one that uses the other
mapping you designed.

To create the second session:


1. In the Server Manager, switch back to configure mode by selecting a folder in the
Navigator.
2. Open the Orders folder.
3. Click the Add Session button, or choose Operations-Add Sessions.
4. Select the mapping mItemSummary and click OK.
5. Complete the Session Wizard, entering the following settings:

Session Property Setting

Name sItemSummary

Source Database TUTORIAL_SOURCE

Target Database TUTORIAL_TARGET

Interval Run Only On Demand

6. Click Finish to close the Session Wizard.


Now that you have two sessions, you can organize them in the same batch. When you run the
batch, the server runs all sessions within the batch, either simultaneously or in sequence.

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.

To create the batch:


1. In the Server Manager, click the Add Batch button, or choose Operations-Add Batch.
The Batch dialog appears, where you can select batch settings.

2. Enter sbAllSessions as the batch name.


sbBatchName is the naming convention for sequential batches. For a concurrent batch,
the convention is cbBatchName.
3. Schedule the batch to run on demand.
4. Click OK.
The new batch appears in the same list as the two sessions as you created. The next step is
to move these sessions into the batch.

Lesson 5: Creating Sessions and Batches 53


To move sessions into the batch:
1. Click and drag the sPhoneList session into the batch.
The Server Manager notifies you that the session is now part of the batch. In the list of
sessions and batches, the session now appears beneath the batch.

2. Click and drag sItemSummary into the batch.


Note: Since both sessions move a small amount of data, you won't see any performance loss if
you run the two sessions simultaneously. By default, the sessions run consecutively, in order
from top to bottom as they appear in the list of sessions within the batch.
If you want to change the order in which the sessions run, you can click and drag the sessions
to change the order in which they appear in the batch list. However, for this tutorial, you will
configure the batch to run both sessions simultaneously.

To configure both sessions to run concurrently:


1. Double-click the name of the batch.
The Batch dialog reappears.
2. Check the Concurrent option.
3. Change the name of the batch to cbAllSessions.
4. Click OK.
The Server Manager notifies you that the server has saved this change to the batch in the
repository.
You're now ready to run the batch.

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.

What Comes Next


Now that you have some experience designing mappings and running those mappings
through a session in the Server Manager, you're ready to explore other types of
transformations. These will help you create the precise data models you want for targets in
your data mart.

Lesson 5: Creating Sessions and Batches 55


Lesson 6: Working with Other Transformations
So far, you've learned how to work with the Source Qualifier, Expression, Aggregator, and
Lookup transformations. In this lesson, you'll learn how to use the Stored Procedure, Filter,
and Sequence Generator transformations.
Assume that you don't want to view information about discontinued items. How do you keep
records describing these products out of the data mart? Traditionally, you would create a view
that filters these records in the source database, then query records through the view instead
of the ITEMS table.
However, this technique requires some work and overhead in the source database that you
may not want. Using the Designer, you can add the filter to the mapping itself using the Filter
transformation.
In addition, you might need to generate unique IDs for target tables. Maybe the table is a
collection of modified records from various sources so you don’t want to use the IDs in the
source table. Maybe you want to add an index and the original table doesn't have a numeric
column. In these cases, you can easily generate unique IDs for each record in a target, using
the Sequence Generator transformation.
Finally, you may find it easier to use stored procedures to perform some tasks. Using the
Stored Procedure transformation, you can call stored procedures and capture their return
values.
To illustrate how to use these transformations, you’ll create a new mapping that includes
several new target tables.

Creating the Targets


Before you can add the mapping, you need to create the following four tables:
♦ F_PROMO_ITEMS, a fact table of promotional items.
♦ D_ITEMS, D_PROMOTIONS, and D_MANUFACTURERS, the dimensional tables
Note: The use of fact and dimension tables are described in “Creating Cubes and Dimensions”
in the User Guide.

To design the new targets:


1. In the Designer, choose Window-New Window.
If this option is disabled, make sure that you have something in the current workbook
selected before you choose Window-New Window.
A new workbook appears. At the bottom of each workbook is a tab, used to switch
between workbooks as needed.
2. In the new workbook, switch to the Warehouse Designer. Note that you are still working
in the Orders folder at this point. To clear your workspace, select all objects in the
workspace, then choose Edit-Clear.

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

Column Datatype Precision Not Null Key

PROMO_ITEM_ID Integer NA Not Null Primary Key

FK_ITEM_ID Integer NA Foreign Key

FK_PROMOTION_ID Integer NA Foreign Key

FK_MANUFACTURER_ID Integer NA Foreign Key

NUMBER_ORDERED Integer NA

DISCOUNT Money default

COMMENTS Varchar default

Note: For this table, you are including foreign key columns that correspond to the
primary keys in each of the following tables.
D_ITEMS

Column Datatype Precision Not Null Key

ITEM_ID Integer NA Not Null Primary Key

ITEM_NAME Varchar 72

PRICE Money default

D_PROMOTIONS

Column Datatype Precision Not Null Key

PROMOTION_ID Integer NA Not Null Primary Key

PROMOTION_NAME Varchar 72

DESCRIPTION Varchar default

START_DATE Datetime default

END_DATE Datetime default

Lesson 6: Working with Other Transformations 57


D_MANUFACTURERS

Column Datatype Precision Not Null Key

MANUFACTURER_ID Integer NA Not Null Primary Key

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.

To create the tables:


1. Select all the table definitions.
2. Choose Targets-Generate/Execute SQL.
3. In the Database Object Generation dialog, connect to the target database.
4. Make sure that you have selected the option to generate from selected tables, and have
checked the appropriate options for creating the tables and generating keys.
5. Click Generate and Execute.
The Designer now runs the SQL DDL code needed to create the table.
6. Click Close, then choose Repository-Save.
At this point, you’re ready to create a mapping that includes the new targets. The mapping
will filter out discontinued items, call a stored procedure to find how many of each item
customers have ordered, and generate a unique ID for each row in the fact table.

Creating the New Mapping


The new mapping you'll create will use the target tables you just created.

To create the new mapping:


1. In the Designer, switch to the Mapping Designer and create a new mapping.
Name the mapping mPromoItems.

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.

Lesson 6: Working with Other Transformations 59


7. Create an Expression transformation, expFPromoItems.
This transformation will join data from multiple transformations before sending this
information to F_PROMO_ITEMS.
8. Choose Repository-Save.

Creating a Filter Transformation


As described earlier, the Filter transformations filters records in the same fashion as a WHERE
clause added to a query. If you connect a Filter to a Source Qualifier transformation, you can
filter records passed through that Source Qualifier using whatever condition you wish to
apply. In this exercise, you will remove all discontinued items from the mapping.
The mapping will contain a Filter transformation that limits records queried from the ITEMS
table to only those items that haven't been discontinued.

To add the Filter transformation:


1. Click the Filter button on the Transformations toolbar.
2. Click and drag between the Source Qualifier and the target tables.
A new Filter transformation appears.

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

11. Click Validate, then click OK.


The new condition now appears in the Value field.

Lesson 6: Working with Other Transformations 61


12. Click OK to return to the workbook.
The last step is to connect the Filter transformation to the D_ITEMS target table. Only
currently sold items will be written to this target.

To connect the Filter transformation:


1. Connect the columns ITEM_ID, ITEM_NAME, and PRICE to their counterpart
columns in D_ITEMS.
2. Choose Repository-Save.

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.

Creating a Sequence Generator Transformation


Many relational databases include sequences, a special database object designed exclusively to
generate values. The Sequence Generator transformation functions exactly like a sequence,
but instead of writing the SQL code needed to create and use the sequence, you simply add
one more transformation to your mapping to generate unique values for a target. You can use
this transformation to generate unique values, like primary key values. You can also use it to
cycle through a closed set of values.

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.

To add the Sequence Generator transformation:


1. On the Transformations toolbar, click the Sequence Generator button.
2. Click and drag to create a new Sequence Generator transformation.

3. Double-click the transformation's title bar.


The dialog used to configure transformations appears.

Lesson 6: Working with Other Transformations 63


4. Rename the transformation seqPromoItemID.
5. Click the Ports tab.
The two output ports, NEXTVAL and CURRVAL, appear in the list. Note that you
cannot add any new ports to this transformation, nor can you re-configure NEXTVAL
and CURRVAL.
6. Click the Properties tab.
The properties for the Sequence Generator transformation appear. Right now, don't
worry about changing any of these settings.
7. Click OK.
8. In the transformation expFPromoItems, create a new input/output port,
OUT_PROMO_ITEM_ID, using the Integer datatype.
9. Connect the NEXTVAL port from the Sequence Generator transformation to the
OUT_PROMO_ITEM_ID port in expFPromoItems.
10. Choose Repository-Save.
Now, every time the database inserts a new record into this table, the transformation provides
a unique ID for PROMO_ITEM_ID.

Creating a Stored Procedure Transformation


When you installed the sample database objects, you also created a stored procedure,
SP_GET_ITEM_COUNT. This procedure takes one argument, an ITEM_ID value, and
returns the number of times that item has been ordered. If you're curious, the syntax for this
stored procedure is the following:

Database Syntax

Oracle CREATE FUNCTION SP_GET_ITEM_COUNT


(ARG_ITEM_ID IN NUMBER) RETURN NUMBER
AS
IS SP_RESULT(NUMBER);
BEGIN
SELECT COUNT(*)
INTO SP_RESULT
FROM ORDER_ITEMS
WHERE ITEM_ID = ARG_ITEM_ID;
RETURN (SP_RESULT);
END;

Microsoft SQL Server CREATE PROCEDURE SP_GET_ITEM_COUNT (@ITEM_ID INT)


AS SELECT COUNT(*) FROM ORDER_ITEMS
WHERE ITEM_ID = @ITEM_ID

64 Tutorial
Database Syntax

Sybase CREATE PROCEDURE SP_GET_ITEM_COUNT (@ITEM_ID INT)


AS SELECT COUNT(*) FROM ORDER_ITEMS WHERE ITEM_ID = @ITEM_ID

Informix CREATE PROCEDURE SP_GET_ITEM_COUNT (ITEM_ID_INPUT INT)


RETURNING INT;
DEFINE CNT INT;
SELECT COUNT(*) INTO CNT FROM ORDER_ITEMS WHERE ITEM_ID =
ITEM_ID_INPUT;
RETURN CNT;

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.

To create the Stored Procedure transformation:


1. Click the Stored Procedure button on the Transformations toolbar.
2. Click in the workbook.
The Import Stored Procedure dialog box appears.
3. Select the ODBC connection for your source database. Enter your username, owner
name, and password. Click Connect.

4. Select the stored procedure named SP_GET_ITEM_COUNT from the tree and click
OK.
The Stored Procedure transformation appears in the mapping.

Lesson 6: Working with Other Transformations 65


5. Double-click on the header of the transformation, and select the Properties tab.
6. In the Connection information section, select $Source .
You can call stored procedures in both source and target databases.

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.

Completing the Mapping


The final step is to map data to the remaining columns in targets.

To complete the mapping:


1. Connect the following columns from expFPromoItems to their counterparts in the target
table F_PROMO_ITEMS:

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:

Source Qualifier Target Table Column

PROMOTION_ID D_PROMOTIONS PROMOTION_ID

PROMOTION_NAME D_PROMOTIONS PROMOTION_NAME

DESCRIPTION D_PROMOTIONS DESCRIPTION

START_DATE D_PROMOTIONS START_DATE

END_DATE D_PROMOTIONS END_DATE

MANUFACTURER_ID D_MANUFACTURERS MANUFACTURER_ID

MANUFACTURER_NAME D_MANUFACTURERS MANUFACTURER_NAME

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.

Lesson 6: Working with Other Transformations 67


What's Next
You have imported sources, designed targets, designed mappings that use a variety of
transformations, and run sessions and batches. Congratulations! You’ve now mastered the
basics of creating data marts.

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

Вам также может понравиться