Alternative to the Driving Key Implementation in Data… | VaultSpeed

Alternative to the driving key implementation in Data Vault 2.0

May 16th, 2019

Ba1a7016 1d6d 4296 a4bd fbdaa72780c9
Dirk Vermeiren
Alternative To The Driving Key Implementation In Data Vault 2 0 4

The Driving Key

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 own hash key, which is calculated over the combination of all parents 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 of them identify it unique. We can not identify the business object by using only the hash key of the link. The problem is not a modeling error, but we have to identify the correct record in the related satellite when querying 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.

The following tables demonstrate the relationship between an employee and a department from a source system.

Alternative To The Driving Key Implementation In Data Vault 2 0 1

Table 1: employee-department relationship

The following Data Vault model can be derived from this source structure.

Alternative To The Driving Key Implementation In Data Vault 2 0 2

Figure 1: Data Vault model

Alternative To The Driving Key Implementation In Data Vault 2 0 3

Table 2: link data

Alternative To The Driving Key Implementation In Data Vault 2 0 4

Table 3: Link Connection with counter attribute

Conclusion

Because identifying the driving key of a relation can be a problem in some situations you can use an alternative solution to avoid the driving key. All changes and deletes are tracked using a counter attribute in the non-historized link table. It stores also the descriptive attributes and the link hash key is calculated over all attributes.