Documente Academic
Documente Profesional
Documente Cultură
com +917411642061
Lab 10
Data-Driven Operations
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..............5 Exercise 3: Extra Credit..........................................7
10 - 1
Lab at a Glance
The exercises in this lab are designed to walk the student through the process of creating and configuring an Update Strategy transformation.
Objectives
After completing the lab, the student will be able to create and configure an Update Strategy transformation to perform multiple types of row operations within a single session.
Summary
In the previous labs, all of the inactive customers were filtered out to create data in the ODS_CUSTOMER_ACTIVE table. In the CUSTOMER table, the CUSTOMER_TYPE column can be set to either INACTIVE or ACTIVE. Because customers may change from ACTIVE to INACTIVE, Labs 8 and 9 would have to be run every time the ODS_CUSTOMER_ACTIVE table is loaded. The use of an Update Strategy transformation eliminates the need for running two mappings to accomplish what could be a single task. The new mapping will accomplish both tasks. The completed mapping should look as follows:
Duration
This lab should take approximately 30 minutes.
10 - 2
Exercises
Exercise 1: Create the Mapping
Step 1. Copy a mapping. Make a copy of the mapping and name it m_ODS_CUSTOMER_ACTIVE_upd_xx.
m_ODS_CUSTOMER_ACTIVE_xx
Open the m_ODS_CUSTOMER_ACTIVE_upd_xx mapping. Delete the links between lkp_CUSTOMER and
ODS_CUSTOMER_ACTIVE.
Create an Update Strategy transformation and name it upd_ODS_CUSTOMER_ACTIVE. Copy/link the following ports from lkp_CUSTOMER to upd_ODS_CUSTOMER_ACTIVE:
CUST_ID CUST_NAME FIRST_CONTACT CUSTOMER_STATE CUSTOMER_ZIP CUSTOMER_TYPE DISCOUNT_RATE
Edit upd_ODS_CUSTOMER_ACTIVE.
Click on the Properties tab and add the following expression in the Update Strategy Expression field: IIF(UPPER(RTRIM(CUSTOMER_TYPE))='INACT IVE' or ISNULL(CUSTOMER_TYPE), DD_DELETE, DD_INSERT)
10 - 3
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.
10 - 4
On the Properties tab, set Treat source rows as to Data Driven. Select the Mapping tab. In the Navigation box, select the source SQ_INVOICE. Under Connections, click on the down arrow native_source and click OK. , select
In the Navigation box, select the target ODS_CUSTOMER_ACTIVE. Under Connections, click on the down arrow select native_target_xx and click OK. ,
You would not normally truncate the target on an update strategy session, but previous labs have distorted the target.
Under Properties, the Target load type should be defaulted to Normal. Scroll down to select the Truncate target table option. Link Start to
s_m_ODS_CUSTOMER_ACTIVE_upd_xx:
wf_ODS_CUSTOMER_ACTIVE_upd_xx.
10 - 5
The 136 errors are duplicate rows that are rejected by the database. In the extra credit exercise, there will be a solution to omit these rows.
10 - 6
delete the link from fil_ODS_CUSTOMER_ACTIVE to lkp_CUSTOMER. Insert a sorter called srt_ODS_CUSTOMER_ACTIVE between fil_ODS_CUSTOMER_ACTIVE and lkp_CUSTOMER. Copy/link the CUST_NO port from fil_ODS_CUSTOMER_ACTIVE to srt_ODS_CUSTOMER_ACTIVE. Link the CUST_NO port from to the CUST_NO port in lkp_CUSTOMER.
srt_ODS_CUSTOMER_ACTIVE
Edit srt_ODS_CUSTOMER_ACTIVE: Under the Properties tab, turn on the Distinct property.
10 - 7
10 - 8