BG_MartFact_ForeignKey_Identity
Applies to
Platform: Microsoft SQL Server · Snowflake · Databricks · Databricks dbt · Fabric Lakehouse · Fabric Warehouse · Oracle
Architecture: Data Mart
BG_MartFact_ForeignKey_Identity is the reference from a Mart Fact to a Mart Dimension: the surrogate key of the related Mart Dimension row. The loader looks it up from the business key of the relationship.
Objects that carry it
Mart Fact. The term is created for each relationship from the Mart Fact to a Mart Dimension, not when the Mart Fact itself is created. Its name has the form <referenced model object>_<role>_SK, for example common_pos_common_POS_SK.
Value
The Lookup view of the Mart Fact joins the Mart Dimension on the foreign-key terms of the relationship and takes its BG_MartDimension_Identity. When the Mart Dimension is historized and BG_EffectiveTimestamp is mapped, the lookup selects the version that is valid at that timestamp. A business key without a match gets -1, the key of the unknown-member row.
Data type
- Microsoft SQL Server, Fabric Warehouse:
int - Oracle:
NUMBER - Snowflake:
INTEGER - Databricks, Databricks dbt, Fabric Lakehouse:
long
Example
A Mart Fact on Microsoft SQL Server references the Mart Dimension common_pos with the role POS. Its Lookup view calculates the term as:
ISNULL([r1].[common_pos_SK], -1)
AS [common_pos_common_POS_SK]
Here [r1] is the Result view of the Mart Dimension, joined on the point of sale ID.
Related articles
- Reference: BG_MartDimension_Identity, BG_EffectiveTimestamp
- See also: Create a Mart Fact, Mart Dimension