We have moved to www.dataGenX.net, Keep Learning with us.

Wednesday, June 04, 2014

Surrogate Key Generator - Generate Surrogate Key for Data


In this post, We will see how to generate surrogate key for data, where we have to use surrogate key stage.

A) Design :  
Below design is a demo design of job. Here our data source is a row generator which is generating rows. In real time scenario, Source can be a flat file, DB stages, Passive Stage or can be a Active stage also.
In Row Generator Stage, we are generating a col "Name".



B) Surrogate Key Stage Properties
In Surrogate Stage, fill all the properties of Surrogate Key Stage like below...
Generated Output Column Name = Skey
Source Name = <the path of Surrogate State File (which we generated) >
Source Type = Flat File
File Block Size = User specified
User Specified Block Size = 1  ( by this we can control the gaps in surrogate keys )


C) Output Column Mapping :
Map the column to output.


D) OutPut File :
Below I have attached output file which have surrogate keys generated with data.


More post in Series :

Surrogate Key Generator - Create State File
Surrogate Key Generator - Create/Update State File
Surrogate Key Generator - Delete State File

I hope, Now you got how to generate the Surrogate Keys for the data without having headache of management of keys. But there is still a scenario what if our state file got corrupted or deleted ? We will discuss this in next post.....Keep Reading.....


Like the Facebook Page & join Group
https://www.facebook.com/DataStage4you
https://www.facebook.com/groups/DataStage4you

https://twitter.com/datastage4you

No comments :

Post a Comment