Skip to content

Commit

Permalink
Switch SCD example to entity type natural
Browse files Browse the repository at this point in the history
We recommend using the `natural` type for what is normally the `primary` entity in an SCD semantic model layout.

The distinction is that `primary` indicates one row per entity value, while `natural` does not, and in an SCD context there is one row per entity value/time window set, rather than one row per entity value as in standard conformed dimension tables.
  • Loading branch information
tlento authored Dec 12, 2023
1 parent 46a3a5c commit 52c289c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions website/docs/docs/build/dimensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ This example shows how to create slowly changing dimensions (SCD) using a semant
| 333 | 2 | 2020-08-19 | 2021-10-22|
| 333 | 3 | 2021-10-22 | 2048-01-01|

Take note of the extra arguments under `validity_params`: `is_start` and `is_end`. These arguments indicate the columns in the SCD table that contain the start and end dates for each tier (or beginning or ending timestamp column for a dimensional value).
Take note of the extra arguments under `validity_params`: `is_start` and `is_end`. These arguments indicate the columns in the SCD table that contain the start and end dates for each tier (or beginning or ending timestamp column for a dimensional value). Note also the entity is tagged as `natural` - this is to distinguish it from a `primary` entity, where we expect one row per entity value. Here, we expect one row per entity value/validity window combination.

```yaml
semantic_models:
Expand Down Expand Up @@ -282,7 +282,7 @@ semantic_models:
entities:
- name: sales_person
type: primary
type: natural
expr: sales_person_id
```

Expand Down

0 comments on commit 52c289c

Please sign in to comment.