Skip to main content

DYNAMIC LOOKUP WITH UPDATE STRATEGY IN INFORMATICA




Steps:

Create a new mapping M_US. Drag the source (EMP), target (DIM_JOIN) to the mapping designer workspace. The target table should have a Primary Key.

Create a Lookup Transformation T_LKP_DYN on the target table DIM_JOIN.

DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



Project the source ports on the Lookup Transformation.
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



Note: Source ports (EMPNO1,ENAME1, etc. ) are created in the Lookup transformation. Edit the Lookup transformation, Go to Properties Tab.

Check the property Dynamic Lookup Cache 

Note that after this property is checked following options get highlighted:

Ø Output Old value On Update

Ø Insert Else Update

Ø Update Else Insert




Before checking Dynamic Lookup Cache property
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY






After checking Dynamic Lookup Cache property
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY








Select the Property Insert Else Update
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY






Now go to Condition Tab and add a condition EMPNO = EMPNO1
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY






Go to the Ports tab.

A new port called NewLookupRow is inserted in to the set of ports.

Lookup uses NewLookupRow to identify changes in the Cache

0 No change

1 INSERT

2 UPDATE

It decides what type of data it is – 1 means Inserted data, 2 means updated data.

The condition EMPNO=EMPNO1 is disabled here (it has already been applied in the condition tab).

We apply additional conditions here.

ENAME=ENAME1

JOB=JOB1

MGR=MGR1

HIREDATE=HIREDATE1

SAL=SAL1

COMM=COMM1

DEPTNO=DEPTNO1

DNAME = ENAME1 (not logical, but we still give this condition because otherwise if we don’t assign a value here, it will throw an error and in cache it will be NULL. Since DNAME is not in the source it will just pass ENAME)
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY


DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY






Go to the Transformation Menu and create an Update Strategy transformation. T_UPS

Project the output ports from Lookup Transformation to Update Strategy.
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



Edit the Update Strategy transformation. Go to Properties tab 

In the Formula bar give the following condition:

IIF(NewLookupRow=1,DD_INSERT,IIF(NewLookupRow=2,DD_UPDATE,DD_REJECT)) is equivalent to

IF (NewLookupRow=1)

THEN 

DD_INSERT

ELSIF NewLookupRow=2

THEN 

DD_UPDATE

ELSE 

DD_REJECT
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY




DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



An automatic projection happens from lookup transformation to the update strategy port NewLookupRow.

At runtime it decides whether to INSERT or UPDATE.

By default, Session Property is INSERT.




Project the update strategy ports to the target.
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



Save the repository and validate the mapping.




Create a workflow WKF_LKP_DYN_UPS

Assign the Source and Target connections.

Note: In the Target connection give Load Type as Normal (as the TGT is having primary key) and do not select truncate the target table option because here we want to see the changes.
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



Assign the connection for the Lookup Connection (MEEN_TGT because lookup table is DIM_JOIN which is in the target database).
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY






Select the Dynamic Lookup Cache option and Insert Else Update option.
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY





In the Session properties set the attribute Treat source rows as to Data Driven.

Save the repository. Validate and start the workflow .




Preview the output of the target table.
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY





Normal output

Now let us observe the newlookuprow attribute.

INSERT a new record in the Source table EMP.



SQL> INSERT INTO EMP(EMPNO,ENAME,SAL,DEPTNO)

2 VALUES (9000,'MEENAKSHI',3000,10);



1 row created.



SQL> COMMIT;

Preview the output again
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY



The new record has been INSERTED.




Now let’s Update

SQL> update emp

2 set sal=3500

3 where empno=7499;

1 row updated.

SQL> commit;

Preview the output
DYNAMIC LOOKUP WITH UPDATE STRATEGY
DYNAMIC LOOKUP WITH UPDATE STRATEGY

Comments

Popular posts from this blog

Contact Me

Do You have any queries ?                   If you are having any query or wishing to get any type of help related Datawarehouse, OBIEE, OBIA, OAC then please e-email on below. I will reply to your email within 24 hrs. If I didn’t reply to you within 24 Hrs., Please be patience, I must be busy in some work. kashif7222@gmail.com

Top 130 SQL Interview Questions And Answers

1. Display the dept information from department table.   Select   *   from   dept; 2. Display the details of all employees   Select * from emp; 3. Display the name and job for all employees    Select ename ,job from emp; 4. Display name and salary for all employees.   Select ename   , sal   from emp;   5. Display employee number and total salary   for each employee. Select empno, sal+comm from emp; 6. Display employee name and annual salary for all employees.   Select empno,empname,12*sal+nvl(comm,0) annualsal from emp; 7. Display the names of all employees who are working in department number 10   Select ename from emp where deptno=10; 8. Display the names of all employees working as   clerks and drawing a salary more than 3000   Select ename from emp where job=’clerk’and sal>3000; 9. Display employee number and names for employees who earn commission   Select empno,ename from emp where comm is not null and comm>0. 10

Informatica sample project

Informatica sample project - 1 CareFirst – Blue Cross Blue Shield, Maryland (April 2009 – Current) Senior ETL Developer/Lead Model Office DWH Implementation (April 2009 – Current) CareFirst Blue Cross Blue Shield is one of the leading health care insurance provided in Atlantic region of United States covering Maryland, Delaware and Washington DC. Model Office project was built to create data warehouse for multiple subject areas including Members, Claims, and Revenue etc. The project was to provide data into EDM and to third party vendor (Verisk) to develop cubes based on data provided into EDM. I was responsible for analyzing source systems data, designing and developing ETL mappings. I was also responsible for coordinating testing with analysts and users. Responsibilities: ·          Interacted with Data Modelers and Business Analysts to understand the requirements and the impact of the ETL on the business. ·          Understood the requirement and develope