You are on page 1of 11

Ho me

Inf o rmat ica

D at a Ware Ho using

Unix- She ll Scrip t s

PL SQ L

C o nt act Us

Complete reference to Informatica

17
Sharing

Ap r 20 11

SCD Type 1
Naveen

0
Discussion Forum

Transf ormat ion

Share

Filter

Discussio n Fo rum

Expressio n
Ro uter

Int roduct ion

Slo wly Changing Dim e nsio ns (SCDs) are dimensio ns that have data that
changes slo wly, rather than changing o n a time-based, regular schedule

So rter
Rank

ETL Life Cycle

Fo r e xam ple , yo u may have a dimensio n in yo ur database that tracks the sales

Transactio n Co ntro l

What Is Info rmatica

reco rds o f yo ur co mpany's salespeo ple. Creating sales repo rts seems simple

So urce Qualifier

Client Co mpo nents

eno ugh, until a salesperso n is transferred fro m o ne regio nal o ffice to ano ther. Ho w

Sto red Pro cedure

Services Behind Scene

do yo u reco rd such a change in yo ur sales dimensio n?

SQL Transfo rmatio n

Try U R Hand's o n AdminCo nso le


Difference Between 7.1 and

Yo u co uld sum o r average the sales by salesperso n, but if yo u use that to


co mpare the perfo rmance o f salesmen, that might give misleading info rmatio n. If

No rmalizer
Sequence Generato r
Aggregato r

PDFmyURL.com

Difference Between 7.1 and


8 .6
Info rmatica 8 .6 Installatio n

the salesperso n that was transferred used to wo rk in a ho t market where sales

Aggregato r

were easy, and no w wo rks in a market where sales are infrequent, her to tals will

Unio n

lo o k much stro nger than the o ther salespeo ple in her new regio n, even if they are

Jo iner

just as go o d. Or yo u co uld create a seco nd salesperso n reco rd and treat the

Update Strategy

transferred perso n as a new sales perso n, but that creates pro blems also .

Lo o k Up

Int erview Zone


Dealing with these issues invo lves SCD management metho do lo gies:
Info rmatica Real Time
Interview Questio ns

Subscribe t o Learn
Inf ormat ica

Type 1:

Info rmatica Experienced

The Type 1 metho do lo gy o verwrites o ld data with new data, and therefo re do es

Interview Questio ns - part1

no t track histo rical data at all. This is mo st appro priate when co rrecting certain

Info rmatica Experienced

types o f data erro rs, such as the spelling o f a name. (Assuming yo u wo n't ever

Interview Questio ns - part2

need to kno w ho w it used to be misspelled in the past.)

Info rmatica Experienced


Interview Questio ns - part3
Info rmatica Experienced

Like

157 people like this.

Here is an example o f a database table that keeps supplier info rmatio n:


Supplie r_Ke y Supplie r_Co de Supplie r_Nam e Supplie r_St at e

Interview Questio ns - part4


Data Wareho using co ncept

123

ABC

Acme Supply Co CA

Enter yo ur email address:

Based Interview Questio ns


In this example, Supplier_Co de is the natural key and Supplier_Key is a surro gate
key. Technically, the surro gate key is no t necessary, since the table will be unique

Test ing
Unit Testing
Integratio n Testing
UAT
Info rmatica Testing
Debugger
Co nstraint Based lo ading
Target Lo ad Plan

Subscribe

by the natural key (Supplier_Co de). Ho wever, the jo ins will perfo rm better o n an
integer than o n a character string.

Delivered by FeedBurner

No w imagine that this supplier mo ves their headquarters to Illino is. The updated
table wo uld simply o verwrite this reco rd:
Supplie r_Ke y Supplie r_Co de Supplie r_Nam e Supplie r_St at e

Perf ormanceTuning

123

Necessity Of

ABC

Acme Supply Co IL

Perfo rmance-tuning

Advanced
Concept s

The o bvio us disadvantage to this metho d o f managing SCDs is that there is no


histo rical reco rd kept in the data wareho use. Yo u can't tell if yo ur suppliers are

Identificatio n Of bo ttle
Necks

Mapping Parameter's &

tending to mo ve to the Midwest, fo r example. But an advantage to Type 1 SCDs is

Optimizatio n o f Bo ttle

Variable

that they are very easy to maintain.

necks

Mapplets
Partitio ning

Perfo rmance tuning o f


Explanat io n wit h an Exam ple :

Lo o kup
PDFmyURL.com

Wo rking with links


Scheduler
Types o f Task's- 1
Types o f Task's- 2
Indirect Metho d fo r Lo ading
SCD - Type 1
SCD - Type 2

Push Do wn Optimizatio n

So urce Table : (0 1-0 1-11) Targe t Table : (0 1-0 1-11)


Emp no

Ename

Sal

10 1

10 0 0

Chat wit h Me

10 2

20 0 0

10 3

30 0 0

Chat wit h Me
Offline

SCD - Type 3

Visit or's

Incremental Aggregatio n
Mapping Templates
Grid Pro cessing
Wo rk Flo w Variables

Emp no

Ename

Sal

10 1

10 0 0

10 2

20 0 0

10 3

30 0 0

The necessity o f the lo o kup transfo rmatio n is illustrated using the abo ve so urce
and target table.
So urce Table : (0 1-0 2-11) Targe t Table : (0 1-0 2-11)
Emp

Ename

Sal

Empno

Ename

Sal

10 1

10 0 0

10 1

10 0 0

10 2

250 0

10 2

250 0

10 3

30 0 0

10 3

30 0 0

10 4

40 0 0

10 4

40 0 0

no

In the seco nd Mo nth we have o ne mo re emplo yee added up to the table


with the Ename D and salary o f the Emplo yee is changed to the 250 0
instead o f 20 0 0 .
PDFmyURL.com

St e p 1: Is to impo rt So urce Table and Target table.


Create a table by name emp_so urce with three co lumns as sho wn abo ve in
o racle.
Impo rt the so urce fro m the so urce analyzer.
In the same way as abo ve create two target tables with the names
emp_target1, emp_target2.
Go to the targets Menu and click o n generate and execute to co nfirm the
creatio n o f the target tables.
The snap sho t o f the co nnectio ns using different kinds o f transfo rmatio ns
are sho wn belo w.

St e p 2: Design the mapping and apply the necessary transfo rmatio n.


Here in this transfo rmatio n we are abo ut to
transfo rmatio ns

namely

Lo o kup

use fo ur kinds o f

transfo rmatio n,

Expressio n

Transfo rmatio n, Filter Transfo rmatio n, Update Transfo rmatio n. Necessity


PDFmyURL.com

and the usage o f all the transfo rmatio ns will be discussed in detail belo w.
Lo o k up Transf o rm at io n: The purpo se o f this transfo rmatio n is to determine
whether to insert, Delete, Update o r reject the ro ws in to target table.
The first thing that we are go anna do is to create a lo o k up transfo rmatio n
and co nnect the Empno fro m the so urce qualifier to the transfo rmatio n.
The snapsho t o f cho o sing the Target table is sho wn belo w.

What Lo o kup transfo rmatio n do es in o ur mapping is it lo o ks in to the target


table (emp_table) and co mpares it with the So urce Qualifier and determines
whether to insert, update, delete o r reject ro ws.
In the Po rts tab we sho uld add a new co lumn and name it as empno 1 and
this is co lumn fo r which we are go nna co nnect fro m the So urce Qualifier.
The Input Po rt fo r the first co lumn sho uld be unchked where as the o ther
po rts like Output and lo o kup bo x sho uld be checked. Fo r the newly created
PDFmyURL.com

co lumn o nly input and o utput bo xes sho uld be checked.


In the Pro perties tab (i) Lo o kup table name ->Emp_Target.
(ii)Lo o k up Po licy o n Multiple Mismatch -> use First Value.
(iii) Co nnectio n Info rmatio n ->Oracle.
In the Co nditio ns tab (i) Click o n Add a new co nditio n
(ii)Lo o kup Table Co lumn sho uld be Empno , Transfo rmatio n po rt sho uld be
Empno 1 and Operato r sho uld =.
Expre ssio n Transf o rm at io n: After we are do ne with the Lo o kup Transfo rmatio n
we are using an expressio n transfo rmatio n to check whether we need to insert the
reco rds the same reco rds o r we need to update the reco rds. The steps to create an
Expressio n Transfo rmatio n are sho wn belo w.
Drag all the co lumns fro m bo th the so urce and the lo o k up transfo rmatio n
and dro p them all o n to the Expressio n transfo rmatio n.
No w do uble click o n the Transfo rmatio n and go to the Po rts tab and create
two new co lumns and name it as insert and update. Bo th these co lumns
are go nna be o ur o utput data so we need to have check mark o nly in fro nt
o f the Output check bo x.
The Snap sho t fo r the Edit transfo rmatio n windo w is sho wn belo w.

PDFmyURL.com

The co nditio n that we want to parse thro ugh o ur o utput data are listed
belo w.
Input IsNull(EMPNO1)
Output iif(No t isnull (EMPNO1) and Deco de(SAL,SAL1,1,0 )=0 ,1,0 ) .
We are all do ne here .Click o n apply and then OK.
Filt e r Transf o rm at io n: we are go nna have two filter transfo rmatio ns o ne to
insert and o ther to update.
Co nnect the Insert co lumn fro m the expressio n transfo rmatio n to the insert
co lumn in the first filter transfo rmatio n and in the same way we are go nna
co nnect the update co lumn in the expressio n transfo rmatio n to the update
co lumn in the seco nd filter.
Later no w co nnect the Empno , Ename, Sal fro m the expressio n
transfo rmatio n to bo th filter transfo rmatio n.
PDFmyURL.com

If there is no change in input data then filter transfo rmatio n 1 fo rwards the
co mplete input to update strategy transfo rmatio n 1 and same o utput is
go nna appear in the target table.
If there is any change in input data then filter transfo rmatio n 2 fo rwards the
co mplete input to the update strategy transfo rmatio n 2 then it is go nna
fo rward the updated input to the target table.
Go to the Pro perties tab o n the Edit transfo rmatio n
(i) The value fo r the filter co nditio n 1 is Insert.
(ii) The value fo r the filter co nditio n 1 is Update.
The Clo ser view o f the filter Co nnectio n is sho wn belo w.

Updat e

St rat e gy Transf o rm at io n: Determines whether to insert, delete,

update o r reject the ro ws.


Drag the respective Empno , Ename and Sal fro m the filter transfo rmatio ns
PDFmyURL.com

and dro p them o n the respective Update Strategy Transfo rmatio n.


No w go to the Pro perties tab and the value fo r the update strategy
expressio n is 0 (o n the 1s t update transfo rmatio n).
No w go to the Pro perties tab and the value fo r the update strategy
expressio n is 1 (o n the 2 nd update transfo rmatio n).
We are all set here finally co nnect the o utputs o f the update transfo rmatio ns
to the target table.
St e p 3: Create the task and Run the wo rk flo w.
Share

Do nt check the truncate table o ptio n.


Change Bulk to the No rmal.
Run the wo rk flo w fro m task.

Twe e t

St e p 4 : Preview the Output in the target table.

PDFmyURL.com

Sub mit

G e t th i s

Reactio ns:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave
a response.

0 Responses
Le ave a R e p ly
PDFmyURL.com

Enter your comment...

Comment as:
Publish

Preview

Links to this post


Create a Link

Previous Entries

Next Entries

Recent Comments
2009 - Complete reference to Informatica is proudly brought to you by Naveen

PDFmyURL.com

You might also like