Create a Driving Key Link

A Model Object of type Driving Key Link can be created in the Raw Vault Layer.

What is a Driving Key Link

A relation or transaction is often identified by a combination of business keys in one source system.
In Data Vault 2.0, this is modeled as a normal link connecting multiple Hubs, each containing a Business Key.

A Link also contains its hash key, calculated over the combination of all parent business keys. So, when the Link connects four Hubs and one Business Key changes, the new record will show a new Link hash key.
There is a problem when four Business Keys describe the relation, but only three identify it uniquely.  We cannot identify the business object by using only the hash key of the link.
The problem is not a modeling error, but we should identify the correct record in the related Satellite when we query the data.
In Data Vault 2.0, this is called a Driving Key. It is a consistent key in the Relationship and often the primary key in the source system.

Hint: More information in this article from Roelant Vos.

In biGENIUS-X, the Combined LSAT approach is implemented - look at the last figure in Roelant's article.

Use case example

The statements to reproduce the example are available here: ManualData.sql.

Source data

Our initial source data correspond to an employee, Sepp MAIER, who works at the company Trivadis and has been happy with this situation since February 2, 2012:

  • Table MD_Company
  • Table MD_Employee
  • Table MD_Company_Employee

Data Vault Model

We create in biGENIUS-X:

  • 2 Hubs: MD_Company_Hub (based on MD_Company) and MD_Employee_Hub (based on MD_Employee)
  • 1 Driving Key Link: MD_Company_Employee_Link (based on MD_Company_Employee) with two relationships:
    • To Employee_Hub: Driving the Relationship (Property Driving Key will be set to True)
    • To Company_Hub: Not driving the Relationship (Property Driving Key set to False)
  • 1 Link Satellite: MD_Company_Employee_LinkSatellite (based on MD_Company_Employee + MD_Employee) with FirstName, Name, Mood and MoodDate as terms

Load of initial data

Generate, deploy, and load the project.

Then check the data:

-- Check the data of the Link and the Link Satellite
SELECT * FROM [RDV].[RDV_LNK_MD_Company_Employee_Link];
SELECT * FROM [RDV].[RDV_LSAT_MD_Company_Employee_LinkSatellite];

You should have this result:

  • LnkEmployeeCompany table:
    • one record
    • MD_Company_Hub_HK = 0xE91FE173F59B063D620A934CE1A010F2B114C1F3 (Hash key from Trivadis)
    • MD_Employee_Hub_HK = 0xAA4DA1A93F07E2E4B09F8D5E2C45905E26A45E79 (Hash key from Sepp)
  • LnkSatEmployeeCompany table:
    • 1 record: mood happy at 2012-02-02

First change

  • Sepp MAIER changes the company and moves from Trivadis to biGENIUS
  • His mood changed now from Happy to Excited on 2018-01-01

Update the source data:

UPDATE [dbo].[MD_Company_Employee]
SET [CompanyID] = 2, [Mood] = 'Excited', [MoodDate] = CONVERT(date,'2018-01-01')
WHERE [EmployeeID] = 10;

Load the project again.

Then, check the data. You should have this result:

  • LnkEmployeeCompany table:
    • two records
    • Sepp has a new relation to biGENIUS company
  • LnkSatEmployeeCompany table:
    • two records
    • The Link HK has changed for the second record because Sepp changed the company, and now there's a new link between Employee and Company
    • Mood and MoodDate has changed to Excited / 2018-01-01

Second change

  • Sepp Maier still works at biGENIUS, but he is not satisfied
  • His mood changes now from Excited to Sad on 2018-07-01

Update the source data:

UPDATE [dbo].[MD_Company_Employee]
SET [Mood] = 'Sad', [MoodDate] = CONVERT(date,'2018-07-01')
WHERE [EmployeeID] = 10;

Load the project again.

Then, check the data. You should have this result:

  • LnkEmployeeCompany table:
    • Still the same two records
  • LnkSatEmployeeCompany table:
    • three records (only the last two ones are presented below in the picture)
    • The Link HK has not changed because Sepp didn't change the company
    • Mood and MoodDate has changed to Sad / 2018-07-01

Third change

  • Sepp Maier changes back from biGENIUS to Trivadis
  • Sepp Maier becomes happy again at 2019-01-01

Update the source data:

UPDATE [dbo].[MD_Company_Employee]
SET [CompanyID] = 1, [Mood] = 'Happy', [MoodDate] = CONVERT(date,'2019-01-01')
WHERE [EmployeeID] = 10;

Load the project.

Then, check the data. You should have this result:

  • LnkEmployeeCompany table:
    • Still the same two records
  • LnkSatEmployeeCompany table:
    • four records (only the last two ones are presented below in the picture)
    • The Link HK has changed because Sepp changed the company from biGENIUS to Trivadis
    • Mood and MoodDate has changed to Happy / 2019-01-01

Creation steps

There are two possibilities to create a Driving Key Link Model Object:

      • Set the Property Driving Key of each Relationship to True or False

    At least one Relationship should have the Property Driving Key set to True. 

    Properties

    A Driving Key Link Model Object can be configured through the following Properties

    Default Terms

    A Driving Key Link Model Object will include the following Default Terms:  

    Business Rules

    The following Business Rules are checked during the Model Object creation: