Time for action—keeping a history of product changes with the Dimension lookup/update step

Let's load a puzzles dimension along with the history of the changes in puzzle attributes:

  1. Create a new transformation.
  2. Drag a Table input step to the work area and double-click it.
  3. Select js as Connection.
  4. Type the following query in the SQL area:
    SELECT pro_code
    , man_code
    , pro_name
    , pro_theme
    FROM products
    WHERE pro_type LIKE 'PUZZLE'
    
  5. Click on OK.
  6. Add an Add constants step, and create a hop from the Table input, step toward it.
  7. Use the step to add a Date field named changedate. As Format type dd/MM/yyyy, and as Value, type 01/10/2009.
  8. Expand the Data Warehouse category of steps.
  9. Select the Dimension lookup/update step and drag it to the canvas.
  10. Create a hop from the Add constants step to this new step.
  11. Double-click the Dimension lookup/update step.
  12. As Connection select dw.
  13. As Target table type lk_puzzles.
  14. Fill the Key fields as shown:
    Time for action—keeping a history of product changes with the Dimension lookup/update step
  15. Select id as Technical key field.
  16. In the frame Creation of technical key, leave the default to Use table maximum + 1.
  17. As Version field, select version.
  18. As Stream Datefield, select changedate.
  19. As Date range start field, select start_date.
  20. As Table daterange end, select end_date.
  21. Select the Fields tab and fill it like this:
    Time for action—keeping a history of product changes with the Dimension lookup/update step
  22. Close the settings window.
  23. Save the transformation, and run it.
  24. Explore the js_dw database and do a preview of the lk_puzzles table.
  25. You should see this:
    Time for action—keeping a history of product changes with the Dimension lookup/update step

What just happened?

You loaded the puzzle dimension with the name and theme of the puzzles you sell. The dimension table has the usual columns for a dimension—technical id (field id), fields that store the key fields in the table of the operational database (prod_code and man_code), and columns for the puzzle attributes (name and theme). It also has some extra fields specially designed to keep history.

When you ran the transformation, all records were inserted in the dimension table. Also a special record was automatically inserted for unavailable data.

So far, there is nothing new except for a few extra columns with dates. In the next tutorial, you will learn more about those columns.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.142.232