SCD Type1
SCD Type1
SCD Type1
Name
State
101
SARADA
New York
After SARADA moved from New York to Los Angeles, the new
information replaces the new record, and we have the following table:
Customer Key
Name
State
101
SARADA
Los Angeles
Advantages
This is the easiest way to handle the Slowly Changing Dimension
problem, since there is no need to keep track of the old information.
Disadvantages
All history is lost. By applying this methodology, it is not possible
to trace back in history. For example, in this case, the company
would not be able to know that SARADA lived in New York before.
Implementation of SCD type 1 by using the customer table as an
example. The source table
CREATE TABLE CUSTOMERS
(
CUSTOMER_ID Number,
CUSTOMER_NAME Varchar2(30),
LOCATION
Varchar2(30)
)
The TARGET table
CREATE TABLE CUST_SCD1
(
CUST_KEY NUMBER PRIMARY_KEY,
CUSTOMER_ID Number,
CUSTOMER_NAME Varchar2(30),
LOCATION
Varchar2(30))
Steps to Create SCD Type 1 Mapping
Create SCD Type 1 mapping in informatica
Create the SOURCE (CUSTOMERS) and TARGET (CUST_SCD1) tables
in the database.
Open the Informatica Designer -> source analyzer and import the
source table from database.
Go to the Target designer and import the Target table.
Go to the mapping designer tab and create new
mapping(m_scd_type1).
Drag the source(CUSTOMERS) into the mapping.
Edit the LOOKUP transformation, go to the Ports tab, and add a new
port In_CUSTOMER_ID. This new port needs to be connected to the
CUSTOMER_ID port of Source Qualifier transformation.
Now create ROUTER transformation and drag the following attributes from expression to router
transformation.
CUST_KEY,SRC_CUSTOMER_ID,SRC_CUSTOMER_NAME,SRC_LOCATION,NEW_FLAG,CH
ANGED_FLAG.
Create two groups in ROUTER one for INSERT and another one for UPDATE.
In Insert group, set the condition NEW_FLAG=1
Update group, set the condition CHANGED_FLAG=1
Create work flow with session (s_m_scd1) for this mapping and assign source and target
relational connections and run the workflow.
Source Data
After 1st Run
the
workflow
the source data
loaded in to
target table
Update
LOCATION
column data
for
CUSTOMER_ID=102 in Source(CUSTOMERS)
After 2nd Run the workflow the source data loaded in to target table
as follows
After
sarada
moved
from
banglore
to
GNT,
the new
information replaces the new record, and we have the following data.