Dynamic Lookup Cache

14
Lab Dynamic Lookup Lab at a Glance...........................2 Objectives...........................2 Summary..............................2 Duration.............................2 Exercises.................................3 Exercise 1: Create the Mapping.......3 Exercise 2: Create and Run the Workflow............................12 PowerCenter 7 Level I Developer – Lab Guide 8 - 1

description

How to configure dynamic lookup cache in Informatica

Transcript of Dynamic Lookup Cache

Page 1: Dynamic Lookup Cache

Lab

Dynamic Lookup

Lab at a Glance.................................................................2

Objectives...............................................................2Summary.................................................................2Duration..................................................................2

Exercises...........................................................................3

Exercise 1: Create the Mapping..............................3Exercise 2: Create and Run the Workflow............12

PowerCenter 7 Level I Developer – Lab Guide 8 - 1

Page 2: Dynamic Lookup Cache

Lab. Dynamic Lookup

Lab at a Glance

The exercises in this lab are designed to walk the student through the process of using a Lookup transformation.

Objectives

After completing the lab, the student will be able to use a Dynamic Lookup transformation.

Summary

The purpose of this lab is to load an ODS_EMPLOYEE table with records.

The data will be extracted from the EMPLOYEE flat file. The target table ODS_EMPLOYEE table will be used as the lookup table.

SOURCE: EMPLOYEE flat file

TARGET: ODS_EMPLOYEE

The completed mapping should look as follows:

Duration

This lab should take approximately 40 minutes.

8- 2 PowerCenter 7 Level I Developer – Lab Guide

Page 3: Dynamic Lookup Cache

Lab. Dynamic Lookup

Exercises

Exercise 1: Create the Mapping

Step 1. Import the source table.

Clear the Source Analyzer workspace (right-click anywhere in the workspace and select Clear All).

Continue to work in the assigned student folder and import the EMP relational source table from the SDBU database schema.

The source should look as follows:

Step 2. Import the target.

Clear the Warehouse Designer workspace (right-click anywhere in the workspace and select Clear All).

Import the EMPLOYEE_TGT relational database target table from the TDBUxx database schema.

The target should look as follows:

Save the repository.

PowerCenter 7 Level I Developer – Lab Guide 8 - 3

Page 4: Dynamic Lookup Cache

Lab. Dynamic Lookup

Step 3. Creating a mapping.

Create a mapping called m_EMP_TGT_DYNAMIC_LOOKUP.

Step 4. Add source and target.

Add the EMP source definition with its respective Source Qualifier to the mapping:

Add the target definition ODS_CUSTOMER_ACTIVE.

Save the repository.

Step 5. Create a lookup transformation.

Click the Lookup Transformation button. Position the pointer in the workspace and click again.

The Select Lookup Table for Lookup Transformation dialog appears.

Since the EMPLOYEE_TGT table which is imported as a target.

Click OK and a Lookup transformation will appear in the workspace.

Rename the Lookup transformation

8- 4 PowerCenter 7 Level I Developer – Lab Guide

Page 5: Dynamic Lookup Cache

Lab. Dynamic Lookup

The Designer will automatically choose the ports to compare based on the sequential order of Lookup ports and Input ports.

lkp_EMPLOYEE_TGT.

Copy/link the following ports from Double-click on the header of lkp_EMPLOYEE_TGT.

EMP_NO

ENAME

JOB

MGR

HIREDATE

SAL

COMM

DEPTNO

The Edit Transformations dialog box appears.

Click on the Condition tab and click the Add a new

condition button:

Select EMPNO and IN_EMPNO for the condition.

Change the Connection Information on the Properties tab to $Source:

PowerCenter 7 Level I Developer – Lab Guide 8 - 5

Page 6: Dynamic Lookup Cache

Lab. Dynamic Lookup

Because the source and lookup tables come from the same database (schema), the $Source variable may be used.

Make sure that Dynamic Lookup Cache check box and Insert/Else update box is checked.

Now NewLookupRow input row port is added to ports which is not editable.

0 = Integration Service does not update or insert the row in the cache.

1 = Integration Service inserts the row into the cache.

2 = Integration Service updates the row in the cache.

8- 6 PowerCenter 7 Level I Developer – Lab Guide

Page 7: Dynamic Lookup Cache

Lab. Dynamic Lookup

Must give associated expression.

While using a dynamic lookup cache, we must associate each

lookup/output port with an input/output port or a sequence ID.

The Integration Service uses the data in the associated port to

insert or update rows in the lookup cache. The Designer

associates the input/output ports with the lookup/output ports

used in the lookup condition.

When we select Sequence-ID in the Associated Port column, the

Integration Service generates a sequence ID for each row it

inserts into the lookup cache.

Change the data type of EMP_PK to Integer.Sequence-Id will be added.

Click OK to close the Edit Transformations dialog box.

Save the repository.

PowerCenter 7 Level I Developer – Lab Guide 8 - 7

Page 8: Dynamic Lookup Cache

Lab. Dynamic Lookup

Step 6. Create the Router Transformation rtr_EMPLOYEE_TGT

Copy/link the following ports from lkp_EMPLOYEE_TGT

to the router and create tow new groups INSERT and UPDATE

NewLookupRow

EMP_PK

EMP_NO

ENAME

JOB

MGR

HIREDATE

SAL

COMM

DEPTNO

8- 8 PowerCenter 7 Level I Developer – Lab Guide

Page 9: Dynamic Lookup Cache

Lab. Dynamic Lookup

Step 7. Create an update strategy transformation.

Use an Update Strategy transformation when keeping history information in a table or updating a table to keep the most current information.

Create two Update Strategy transformation and name it upd_EMP_TGT_INS and upd_EMP_TGT_UPD.

Copy/link the following ports from rtr_EMPLOYEE_TGT INSERT Group to upd_EMP_TGT_INS and Update group to upd_EMP_TGT_UPD :

EMP_PK

EMP_NO

ENAME

PowerCenter 7 Level I Developer – Lab Guide 8 - 9

Page 10: Dynamic Lookup Cache

Lab. Dynamic Lookup

o JOB

o MGR

o HIREDATE

o SAL

COMM

DEPTNO

Edit upd_EMP_TGT_INS.

Click on the Properties tab and add the following expression in the Update Strategy Expression field:

DD_INSERT

Validate the formula and click the OK button to close the Expression Editor window

Edit upd_EMP_TGT_UPD

Click on the Properties tab and add the following expression in the Update Strategy Expression field:

DD_INSERT

Validate the formula and click the OK button to close the Expression Editor window.

Click OK to close the Edit Transformation window.

Save your work.

Step 8. Drag the target twice into workspace.

Rename the targets as EMPLOYEE_TGT_INSERT and EMPLOYEE_TGT_UPDATE.

8- 10 PowerCenter 7 Level I Developer – Lab Guide

Page 11: Dynamic Lookup Cache

Lab. Dynamic Lookup

Step 9. Link the target definition.

Link manually from upd_EMP_TGT_INS to EMPLOYEE_TGT_INSERT and upd_EMP_TGT_UPD to EMPLOYEE_TGT_UPDATE

Save the repository.

PowerCenter 7 Level I Developer – Lab Guide 8 - 11

Page 12: Dynamic Lookup Cache

Lab. Dynamic Lookup

Exercise 2: Create and Run the Workflow

Step 1. Create a workflow.

Create a workflow called wf_EMPLOYEE_DYNAMIC_LKP.

Create a session task called s_ m_EMP_TGT_DYNAMIC_LOOKUP.

Double-click on the session task. The Edit Tasks dialog box appears.

Select the Mapping tab.

In the Navigation box, select the source SQ_INVOICE.

Under Connections, click on the down arrow , select native_source and click OK.

In the Navigation box, select the target ODS_CUSTOMER_ACTIVE.

Under Connections, click on the down arrow , select native_target_xx and click OK.

Under Properties, the Target load type should be defaulted to Normal. Scroll down to select the Truncate target table option.

Click OK to close the Edit Tasks dialog box.

Link Start to s_ m_EMP_TGT_DYNAMIC_LOOKUP:

Save, validate and start wf_ODS_CUSTOMER_ACTIVE_xx.

Monitor and review the results for s_ m_EMP_TGT_DYNAMIC_LOOKUP in the Workflow Monitor.

Step 2. Verify results – session transformation statistics.

8- 12 PowerCenter 7 Level I Developer – Lab Guide

Page 13: Dynamic Lookup Cache

Lab. Dynamic Lookup

Step 4. Verify results.

Note that only the first few rows are shown here.

PowerCenter 7 Level I Developer – Lab Guide 8 - 13