Sie sind auf Seite 1von 12

SGT

Slowly growing targets (only inserts no updates in incremental loading) Slowly changing dimensions

Type I Keep latest record Type II Keep history - Keep new flag - use version no - use BEGIN DT & END DT

Slowly growing targets (only inserts no updates in incremental loading)


Requirement - A new key is generated for target Target is used as lookup. Expression -If lookup does not find matching value then returns NewFlag=TRUE ELSE NewFlag=FALSE FILTER1 allows rows if NewFlag = TRUE. = FILTER dis-allows rest of rows = FILTER allows only rows meant for insert FILTER2 allows rows if NewFlag=FALSE Update STRATEGY1 changes mode to DD_INSERT =Only new rows are inserted Update STRATEGY2 changes mode to DD_UPDATE =Only for update rows are inserted

SCD Type I Keep latest


Requirement - A new key is generated for target Target is used as lookup. Expression -If lookup does not find matching value then Lookup returns NewFlag=TRUE ELSE NewFlag=FALSE FILTER1 allows rows if NewFlag = TRUE. = FILTER dis-allows rest of rows = FILTER allows only rows meant for insert FILTER2 allows rows if NewFlag=FALSE, ChangedFlag=True Update STRATEGY1 changes mode to DD_INSERT =Only new rows are inserted Update STRATEGY2 changes mode to DD_UPDATE =Only for update rows are inserted

SCD TYPE-II Keep history with new flag


Requirement - A new key is generated for target Target is used as lookup. Changed flag is accessed

Stream 1 1. Generate new id (SEQ ) and current flag =1 2. Pass thru target lookup to get primarykey =null 3. Pass thru Detect change expression - newflag=TRUE from 4. Pass thur FILTER WITH newFlag=TRUE 5. Pass thru Ust as DD_INSERT 6. Insert with current flag=1

SCD TYPE-II Keep history with new flag


Requirement - A new key is generated for target Target is used as lookup. Changed flag is accessed Stream 2 1. Generate new id (SEQ ) and current flag =1 2. Pass thru target lookup to get primarykey =not null 3. Pass thru Detect change expression Changeflag=TRUE from 4. Pass thur FILTER WITH ChangedFlag=TRUE 5. Pass thru Ust as DD_INSERT 6. Generate current flag=1, add 1 to key 7. INSERT with current flag=1

SCD TYPE-II Keep history with new flag


Requirement - A new key is generated for target Target is used as lookup. Changed flag is accessed Stream 3 1. Generate new id (SEQ ) and current flag =1 2. Pass thru target lookup to get primarykey =not null 3. Pass thru Detect change expression - Changeflag=TRUE from 4. Pass thur FILTER WITH ChangedFlag=TRUE (take only id and changed flag) 5. Pass thru Ust as DD_UPDATE 6. Generate current flag=0 7. UPDATE target with current flag=0

SCD TYPE-II Keep history with version

Stream 1 1. Generate new id (SEQ ) and version =0 2. Pass thru target lookup to get primarykey =null 3. Pass thru Detect change expression newflag=TRUE from 4. Pass thur FILTER WITH newFlag=TRUE 5. Pass thru Ust as INSERT 6. Insert with version=0

SCD TYPE-II Keep history with version

Stream 2 1. Generate new id (SEQ ) and version =0 2. Pass thru target lookup to get primarykey =NOT null 3. Pass thru Detect change expression - changedFlag=TRUE from 4. Pass thur FILTER WITH changedFlag=TRUE 5. Pass thru UPDATE ST as DD_INSERT 6. Exp - Generate PRIMARY KEY as +1 , take same as version 7. INSERT with new version

SCD TYPE-II Keep history Effective date

SCD TYPE-II Keep history Effective date


Insert and update Similar as SCD TYPE-II Keep history with new flag When insert insert current date and null When update choose only end date col update current date to same value and end date to current date insert with current date and null

SCD TYPE III Keep current and last

SCD TYPE III Keep current and last


From lookup, pick existing values also Pass it to filter, update strategy Use it to update to previous value Use it to update the <previous value>

Das könnte Ihnen auch gefallen