Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Data Vault mapping task template configuration tutorial

Data Vault mapping task template configuration tutorial

Step 2. Configure customer-order relationships in a link table

Step 2. Configure customer-order relationships in a link table

We need to define customer and order relationships and write the business keys to a link table. To do this we use the Data Vault – Link mapping task template.
The following image shows the mapping this template is based on:
When the task runs, it calculates customer and order hash keys, and a primary hash key for the link table. It then writes the keys and the date inserted to the target.
  1. On the
    Templates
    page, click the
    Data Vault – Link
    tile and then click
    Create a mapping task
    .
  2. On the
    General
    tab, select the runtime environment to run the task and then click
    Next
    .
  3. On the
    Sources
    tab, configure the following sources:
    1. Hub_Table_1 source. Select the Snowflake connection and H_ORDER hub table.
    2. Hub_Table_2 source. Select the Snowflake connection and H_CUSTOMER hub table.
    3. Link_Table. The template is preconfigured to check if records are already present in the target link table. Select the target Snowflake connection and LNK_ORDER_CUSTOMER link table.
    4. Src_Landing_Table. Select the Snowflake connection and the ORDER landing table.
  4. On the
    Targets
    tab, select the Snowflake target connection and link table, LNK_ORDER_CUSTOMER.
  5. Select the
    Insert
    operation.
  6. On the
    Input Parameters
    tab, resolve the following parameters:
    1. Hub Key Expression 1. Defines the hash key in the ORDER landing table and outputs the value to the Hub_Key_Calculated1 field. You assign the hash key to the POS_TRANSACTIONID field using the following expression:
      MD5(TO_CHAR(TRUNC(POS_TRANSACTIONID)))
    2. Hub Key Expression 2. Defines the customer hash key and outputs the value to the Hub_Key_Calculated2 field. You assign the hash key to the POS_CUSTOMER_ID field using the following expression:
      MD5(LTRIM(RTRIM(POS_CUSTOMER_ID)))
    3. Hub 1 – Join Condition: Defines the join condition between the H_ORDER hub table and the hub order key we calculated in step 6a. You enter the following expression:
      Hub_Key_Calculated1 = Hub1_ORDER_HUB_KEY
    4. Hub 2 – Join Condition. Defines the join condition between the H_CUSTOMER hub table and the hub customer key we calculated in step 6b. You enter the following expression:
      Hub_Key_Calculated2 = Hub2_CUSTOMER_HUB_KEY
    5. Join Condition New Record. Joins new records with existing data. You enter the following expression:
      Hub_Key_Calculated1 = Link_ORDER_HUB_KEY AND Hub_Key_Calculated2 = Link_CUSTOMER_HUB_KEY
    6. Link Key: Generates the hash key for the link table. Concatenate the customer and order keys with the following expression:
      MD5(Concat(Hub1_BK_ORDER_ID,Hub2_BK_CUSTOMER_ID))
    7. Target Field Mapping. Defines the field mapping between incoming fields and target fields. The following table shows how to configure the field mapping:
      Target field
      Incoming field
      ORDER_HUB_KEY
      Hub_Key_Calculated1
      CUSTER_HUB_KEY
      Hub_Key_Calculated2
      DATE_INSERTED
      DATE_INSERTED
      ORDER_CUSTOMER_LINK_KEY
      LINK_KEY
  7. Click
    Save
    .
When the task runs, it writes new customer-order relationships in the link table as shown in the following image:
The task doesn’t reinsert existing relationships.

0 COMMENTS

We’d like to hear from you!