Skip to content

Data Mart families

Two families write the mart layer: the dimension load and the fact load. Both load from exactly one designer-authored view, and both strip the mart prefix from this.name because the template re-adds its own.

Templates: databricks/data_mart/dimension.jinja

Roots: this, cdc, source, sources

The dimension load. A mart table loads from exactly one designer-authored view, so sources is always a one-element list: honest, not padding. One naming rule is load-bearing: this.name is the bare name with the mart prefix stripped, because the template re-adds its own prefix (an unstripped name would produce dim_dim_customer).

FieldTypeMeaning
this.namestringThe prefix-stripped bare name.
this.physicalNamestringThe finished physical name: the dim prefix joined to the snake-cased bare name.
this.fqnstringThe stored fully qualified name as the catalog row carries it (no mart body reads it).
this.columns[]arrayThe mart table’s own columns.
this.descriptionstringThe table comment, rendered as the object’s COMMENT; empty when absent.
this.transformation.grainColumnstring?The declared grain column, when set.
sourceview refThe designer view this dimension loads from: name, nameSnakeCase (read inside table_changes), fqn (dialect-cased), columns (ordinal-sorted; empty when unresolvable), ulid when resolved. Identical object to sources[0].
cdc.keysstring[]The change-feed KEYS; never empty after a successful resolve.
cdc.keysClausestringThe keys joined with a comma, precomputed.
cdc.sequenceBystringThe SEQUENCE BY column; default _commit_timestamp.
cdc.applyAsDeleteWhenstring?Conditional: the APPLY AS DELETE WHEN expression; absent when the tombstone handling emits none (soft delete and ignore emit none; delete_row and unset emit _change_type = 'delete').
cdc.exceptColumnsstring[]Columns excluded from the tracked set.
cdc.scdType1 or 2Slowly-changing-dimension type the load deploys as.
cdc.trackHistoryColumnsstring[]?Explicit history-tracking columns; only ever set by an override.

Templates: databricks/data_mart/fact.jinja

Roots: this, excludedColNames, dimRefs, source, sources

The fact load. this and source follow mart-dimension exactly (the physical name uses the fact prefix). What is specific here is the dimension join model.

FieldTypeMeaning
excludedColNamesstring[]Columns the fact’s main column loop must skip: every dimension reference’s surrogate key column, plus the grain column when set (the grain branch re-emits it once and last; selecting it in the loop too would duplicate it and the platform would reject the statement).
dimRefs[]arrayOne entry per joined reference dimension.
dimRefs[].namestringThe role name, or the dimension’s bare name when no role is declared.
dimRefs[].tableNamestringThe dimension’s bare (prefix-stripped) name.
dimRefs[].surrogateKeyColumnstringThe dimension column holding the surrogate key; validated at build time against the dimension’s real columns.
dimRefs[].businessKeystringThe business key the fact joins on.
dimRefs[].scdTypenumberThe dimension’s slowly-changing-dimension type; type 2 adds the current-row filter (__END_AT IS NULL).
dimRefs[].aliasstringThe join’s SQL alias: d_ plus the snake-cased role name.
dimRefs[].surrogateKeyAliasstringThe output column the surrogate key is selected as: the snake-cased role name plus _sk.
dimRefs[].dimensionPhysicalNamestringThe physical dimension table the join targets.