SCDs
Slowly Changing Dimensions ..

SCD table
First step in these series of workshops, is to create a simple DIM_SCD table that has the required fields to illustrate a Type 1 change - just overwrite the value - and Type 2 - where you need to record when any change in the value occurs.
Start PDI.
In your DB management tool, execute the following statement.

Data grid
This step allows you to enter a static list of rows in a grid. This is usually done for testing, reference or demo purposes.
Drag the Data Grid step onto the canvas.
Open the Data Grid properties dialog box.
Ensure the following details are configured, as outlined below:

On the Data tab enter the following values:

Get system info
The Get System Info step retrieves information from the Kettle environment.
This step generates a single row with the fields containing the requested information. It also accepts input rows.
Drag the Get System Info step onto the canvas.
Open the Get System Info properties dialog box.
Ensure the following details are configured, as outlined below:

Dimension lookup/update
The Dimension Lookup/Update step allows you to implement Ralph Kimball's slowly changing dimension for both types: Type I (update) and Type II (insert) together with some additional functions. Not only can you use this step to update a dimension table, it may also be used to look up values in a dimension.
Drag the Dimension lookup/update step onto the canvas.
Open the Dimension lookup/update properties dialog box.
Ensure the following details are configured, as outlined below:
Connection: your
sampledataconnectionTarget table:
DIM_SCDTechnical key field:
TKVersion field:
versionLookup key:
id
Add ‘London’ to the Data Grid.


Ensure that the Dimension Lookup / Update is set to: Lookup Mode.

Click on the Fields tab.

Click the Run button in the Canvas Toolbar.
Preview data for the Dimension lookup/update step.

Open the Dimension Lookup / Update properties dialog box.
Ensure the following details are configured, as outlined below:

Click on the Get Fields button.
Click on the Fields tab and map the stream name field to the dimension name field and ensure:

Click the Run button in the Canvas Toolbar.
Click on the Preview tab:

Examine the table in your SQL Query Tool:

Try different scenarios
Double-click on the Data Grid step.
Add the following City: Madrid

Double-click on the Dimension lookup/update step.
Click on the Fields tab and set the following:

Execute the transformation and view the results.

Double-click on the Data Grid step.
Add the following City: Pariss (intentionally misspelled)

Keep the Fields strategy the same:

RUN Transformation
Click the Run button in the Canvas Toolbar.
Click on the Preview tab:

Examine the table in your SQL Query Tool:
Execute the transformation and view the results.

Try out different Strategies
Double-click on the Data Grid step.
Edit the Pariss value to: Paris

Double-click on the Dimension lookup/update step.
Click on the Fields tab and set the following:

RUN the Transformation
Click the Run button in the Canvas Toolbar.
Examine the table in your SQL Query Tool:.

Let's start with a clean table to clearly illustrate the results. Truncate the table.
Repeat the workflow above and check the results.

Double-click on the Data Grid step.
Edit the Pariss value to: Paris

Data grid - edit Paris Double-click on the Dimension lookup/update step.
Click on the Fields tab and set the following:

RUN the Transformation
Click the Run button in the Canvas Toolbar.
Examine the table in your SQL Query Tool:

Punch through
Edit the Fields tab in the Dimension Lookup/update step to Punch through:

RUN the Transformation
Click the Run button in the Canvas Toolbar.
Examine the table in your SQL Query Tool:

Last updated
Was this helpful?
