appspace / appspace/kwwhat

[Audit] Add primary key tests to dim_dates

Open
#101 2 comments 0 reactions 0 assignees View on GitHub
kwwhat-audit
Dominant language
No language data
Stars
14
Forks
3
PR merge metrics
No merged PRs in 30d

Description

## Context

`dim_dates` has no `not_null` or `unique` data test on `date_day` / `date_id`. The MetricFlow `granularity: day` config is not a data quality assertion — it tells the semantic layer how to interpret the time column, but it does not verify that the column contains no duplicates or nulls.

A date dimension with duplicate or null rows will cause fan-out in any fact-to-dim join that touches the time spine, silently inflating every time-series metric in the project.

This is a small, standalone fix but its blast radius if left unaddressed is large.

## Acceptance criteria

- [ ] `date_day` (or `date_id`, whichever is the primary key) has a `not_null` test
- [ ] `date_day` (or `date_id`) has a `unique` test
- [ ] If both `date_day` and `date_id` exist, it is clear in the column docs which one is the primary key and only the primary key column has the uniqueness test
- [ ] `dbt test --select dim_dates` passes with no failures
- [ ] No SQL changes to the model are required — tests only

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.