Skip to content
  • There are no suggestions because the search field is empty.

Link_HK

Applies to
Platform: Microsoft SQL Server · Snowflake · Snowflake dbt · Databricks · Databricks dbt · Fabric Lakehouse · Fabric Warehouse · Oracle
Architecture: Data Vault

Link_HK is the hash key that identifies a relationship between business keys in a Link. Link Satellites carry the same value to reference their Link.

Objects that carry it

  • Link, Driving Key Link, Hierarchical Link, Same As Link and their Business Vault counterparts: the identity and primary key of the table.
  • Link Satellite, Effectivity Link Satellite, Record Tracking Link Satellite, Non-Historized Link Satellite and their Business Vault counterparts: the reference to the Link.

Every object of these types gets the term when it is created. The generator calculates the value, so you do not map it; you can change its data type in Manage Default Terms.

Value

The Hashing view hashes the business-key terms of the Link in their term order, with the project Hash Algorithm. These are the foreign-key terms that reference the Hubs, plus business keys of the Link itself. A Link Satellite hashes its foreign-key terms in the term order of the Link, so it gets the same value as the Link. How the values are prepared and joined is explained in How biGENIUS-X builds hash values.

The Link also stores one hash per referenced Hub, see DVLINK_ForeignKey_Identity. The unknown-member row has a Link_HK that consists of zero bytes only.

Data type

PlatformType
Microsoft SQL Serverbinary(20)
Fabric Warehousevarbinary(20)
OracleRAW(20)
Snowflake, Snowflake dbtBINARY(32)
Databricks, Databricks dbt, Fabric Lakehousebinary

The data type must match the length of the selected Hash Algorithm.

Example

A Driving Key Link on Microsoft SQL Server references an employee Hub and a job function Hub through EMPLOYEE_ID and JOBFUNCTION_ID. Its Hashing view calculates:

CAST(HASHBYTES('SHA1', CAST('' AS VARCHAR(MAX))
    + ISNULL(CAST([FK_common_employee_EMPLOYEE_EMPLOYEE_ID]
        AS NVARCHAR(4000)), N'_NULL_')
    + N'_'
    + ISNULL(CAST([FK_common_jobfunction_jobfunction_JOBFUNCTION_ID]
        AS NVARCHAR(4000)), N'_NULL_'))
    AS VARBINARY(20)) AS [Link_HK]

Employee 7 changes from job function 2 to 4 in the second load, so the Link gets a second row:

EMPLOYEE_ID  JOBFUNCTION_ID  Link_HK
7            2               0xCCF7607B8C8266232B829A18F7B19491133528CA
7            4               0xCCE46EF3F5DEAE3CAD8A12429B720FBC810F0116
8            3               0x53E79910417D737A7645D6C925FF1D0D568B4810

Release differences

  • Generator 2.4: Snowflake uses SHA2-256 with BINARY(32) by default. Up to Generator 2.3 the default was HASH with a numeric type, see Generators Release - 2.4.0.
  • Generator 2.2: Databricks and Fabric Lakehouse store hash values as binary. Up to Generator 2.0 they were string.

Related articles