Transcript
Page 1: Complete Reference to Informatica_ SCD – Type 1

5/14/2016 Complete reference to Informatica: SCD – Type 1

http://informaticatutorialsnaveen.blogspot.in/2011/04/scdtype1.html 1/6

Home Data WareHousing Unix-Shell Scripts PL SQL Contact Us

PERFORMANCE TUNING

Necessity Of Performancetuning

Identification Of bottle Necks

Optimization of Bottle necks

Performance tuning of Lookup

Push Down Optimization

TESTING

Unit Testing

Integration Testing

UAT

Informatica Testing

Debugger

Constraint Based loading

Target Load Plan

INTERVIEW ZONE

Informatica Real Time Interview Questions

Informatica Experienced InterviewQuestions  part1

Informatica Experienced InterviewQuestions  part2

Informatica Experienced InterviewQuestions  part3

Informatica Experienced InterviewQuestions  part4

Data Warehousing concept Based InterviewQuestions

17

TOTAL VISITS

FEEDS

DISCUSSION FORUM

Discussion Forum

SUBSCRIBE TO LEARN INFORMATICA512 peoplelike this.

Like Share

Sunday, 17 April 2011

SCD – Type 1                                                                           

Slowly Changing Dimensions (SCDs) are dimensions that have data that changesslowly, rather than changing on a timebased, regular schedule

For example, you may have a dimension in your database that tracks the sales records ofyour company's salespeople. Creating sales reports seems simple enough, until asalesperson is transferred from one regional office to another. How do you record such achange in your sales dimension?

You could sum or average the sales by salesperson, but if you use that to compare theperformance of salesmen, that might give misleading information. If the salesperson thatwas transferred used to work in a hot market where sales were easy, and now works in amarket where sales are infrequent, her totals will look much stronger than the othersalespeople in her new region, even if they are just as good. Or you could create a secondsalesperson record and treat the transferred person as a new sales person, but thatcreates problems also.

Dealing with these issues involves SCD management methodologies:

Type 1:

The Type 1 methodology overwrites old data with new data, and therefore does not trackhistorical data at all. This is most appropriate when correcting certain types of data errors,such as the spelling of a name. (Assuming you won't ever need to know how it used to bemisspelled in the past.)

Here is an example of a database table that keeps supplier information:

Supplier_KeySupplier_CodeSupplier_Name Supplier_State

123 ABC Acme Supply CoCA

In this example, Supplier_Code is the natural key and Supplier_Key is a surrogate key.Technically, the surrogate key is not necessary, since the table will be unique by thenatural key (Supplier_Code). However, the joins will perform better on an integer than on acharacter string.

Now imagine that this supplier moves their headquarters to Illinois. The updated tablewould simply overwrite this record:

Supplier_KeySupplier_CodeSupplier_Name Supplier_State

123 ABC Acme Supply Co IL

The obvious disadvantage to this method of managing SCDs is that there is no historicalrecord kept in the data warehouse. You can't tell if your suppliers are tending to move tothe Midwest, for example. But an advantage to Type 1 SCDs is that they are very easy tomaintain.

Explanation with an Example:

Source Table: (010111) Target Table: (010111)

INTRODUCTION

ETL Life Cycle

What Is Informatica

Client Components

Services Behind Scene

Try U R Hand's on AdminConsole

Difference Between 7.1and 8.6

Informatica 8.6Installation

ADVANCED CONCEPTS

Mapping Parameter's &Variable

Mapplets

Partitioning

Working with links

Scheduler

Types of Task's 1

Types of Task's 2

Indirect Method forLoading

SCD  Type 1

SCD  Type 2

SCD  Type 3

Incremental Aggregation

Mapping Templates

Grid Processing

Frequently UsedFunctions

Work Flow Variables

TRANSFORMATION

Filter

Expression

Router

Sorter

Rank

Transaction Control

Source Qualifier

Stored Procedure

SQL Transformation

Normalizer

Sequence Generator

Aggregator

Union

Joiner

Update Strategy

Look Up

Complet愀爀 referenc愀爀 t漀昀 Informatic爀攀

Page 2: Complete Reference to Informatica_ SCD – Type 1

5/14/2016 Complete reference to Informatica: SCD – Type 1

http://informaticatutorialsnaveen.blogspot.in/2011/04/scdtype1.html 2/6

Enter your email address:

Subscribe

Delivered by FeedBurner

Emp no Ename Sal

101 A 1000

102 B 2000

103 C 3000

 

Emp no Ename Sal

101 A 1000

102 B 2000

103 C 3000

The necessity of the lookup transformation is illustrated using the above source and targettable.

Source Table: (010211) Target Table: (010211)

Emp no Ename Sal Empno Ename Sal

101 A 1000 101 A 1000

102 B 2500 102 B 2500

103 C 3000 103 C 3000

104 D 4000 104 D 4000

In the second Month we have one more employee added up to the table with theEname D and salary of the Employee is changed to the 2500 instead of 2000.

Step 1: Is to import Source Table and Target table.

Create a table by name emp_source with three columns as shown above in oracle.Import the source from the source analyzer.In the same way as above create two target tables with the names emp_target1,emp_target2.Go to the targets Menu and click on generate and execute to confirm the creation ofthe target tables.The snap shot of the connections using different kinds of transformations are shownbelow.

Page 3: Complete Reference to Informatica_ SCD – Type 1

5/14/2016 Complete reference to Informatica: SCD – Type 1

http://informaticatutorialsnaveen.blogspot.in/2011/04/scdtype1.html 3/6

Step 2: Design the mapping and apply the necessary transformation.

Here in this transformation we are about to use four kinds of transformations namelyLookup transformation, Expression Transformation, Filter Transformation, UpdateTransformation. Necessity and the usage of all the transformations will bediscussed in detail below.

Look up Transformation: The purpose of this transformation is to determine whether toinsert, Delete, Update or reject the rows in to target table.

The first thing that we are goanna do is to create a look up transformation andconnect the Empno from the source qualifier to the transformation.The snapshot of choosing the Target table is shown below.

What Lookup transformation does in our mapping is it looks in to the target table(emp_table) and compares it with the Source Qualifier and determines whether toinsert, update, delete or reject rows.In the Ports tab we should add a new column and name it as empno1 and this iscolumn for which we are gonna connect from the Source Qualifier.The Input Port for the first column should be unchked where as the other ports likeOutput and lookup box should be checked. For the newly created column only inputand output boxes should be checked.In the Properties tab (i) Lookup table name >Emp_Target.

(ii)Look up Policy on Multiple Mismatch > use First Value.

(iii) Connection Information >Oracle.

In the Conditions tab (i) Click on Add a new condition

Page 4: Complete Reference to Informatica_ SCD – Type 1

5/14/2016 Complete reference to Informatica: SCD – Type 1

http://informaticatutorialsnaveen.blogspot.in/2011/04/scdtype1.html 4/6

(ii)Lookup Table Column should be Empno, Transformation port should be Empno1 andOperator should ‘=’.

Expression Transformation: After we are done with the Lookup Transformation we areusing an expression transformation to check whether we need to insert the records thesame records or we need to update the records. The steps to create an ExpressionTransformation are shown below.

Drag all the columns from both the source and the look up transformation and dropthem all on to the Expression transformation.Now double click on the Transformation and go to the Ports tab and create two newcolumns and name it as insert and update. Both these columns are gonna be ouroutput data so we need to have check mark only in front of the Output check box.The Snap shot for the Edit transformation window is shown below.

The condition that we want to parse through our output data are listed below.

Input à IsNull(EMPNO1)

Output à iif(Not isnull (EMPNO1) and Decode(SAL,SAL1,1,0)=0,1,0) .

We are all done here .Click on apply and then OK.

Filter Transformation: we are gonna have two filter transformations one to insert andother to update.

Connect the Insert column from the expression transformation to the insert columnin the first filter transformation and in the same way we are gonna connect theupdate column in the expression transformation to the update column in the secondfilter.Later now connect the Empno, Ename, Sal from the expression transformation toboth filter transformation.If there is no change in input data then filter transformation 1 forwards the completeinput to update strategy transformation 1 and same output is gonna appear in thetarget table.If there is any change in input data then filter transformation 2 forwards thecomplete input to the update strategy transformation 2 then it is gonna forward theupdated input to the target table.Go to the Properties tab on the Edit transformation

(i) The value for the filter condition 1 is Insert.

(ii) The value for the filter condition 1 is Update.

The Closer view of the filter Connection is shown below.

Page 5: Complete Reference to Informatica_ SCD – Type 1

5/14/2016 Complete reference to Informatica: SCD – Type 1

http://informaticatutorialsnaveen.blogspot.in/2011/04/scdtype1.html 5/6

Update Strategy Transformation: Determines whether to insert, delete, update or rejectthe rows.

Drag the respective Empno, Ename and Sal from the filter transformations and dropthem on the respective Update Strategy Transformation.Now go to the Properties tab and the value for the update strategy expression is 0

(on the 1st update transformation).Now go to the Properties tab and the value for the update strategy expression is 1

(on the 2nd update transformation).We are all set here finally connect the outputs of the update transformations to thetarget table.

Step 3: Create the task and Run the work flow.

Don’t check the truncate table option.Change Bulk to the Normal.Run the work flow from task.

Step 4: Preview the Output in the target table.

Posted by Naveen at Sunday, April 17, 2011 

Page 6: Complete Reference to Informatica_ SCD – Type 1

5/14/2016 Complete reference to Informatica: SCD – Type 1

http://informaticatutorialsnaveen.blogspot.in/2011/04/scdtype1.html 6/6

No comments :

Post a Comment

Enter your comment...

Comment as:  Google Account

Publish   Preview

Links to this post

Create a Link

 


Top Related