Summary
Create a new fact_payments mart model for Phase 2.2.
Goal
Expose payment-level analytical data in marts, starting from stg_payments, with a clearly documented grain and basic model tests.
Tasks
- Create
dbt/models/marts/facts/fact_payments.sql from stg_payments.
- Add
order_purchase_date using a safe join by order_id with either:
int_orders_enriched, or
fact_orders
- Create
dbt/models/marts/facts/_fact_payments.yml.
- Add model tests for:
not_null
relationships
- grain/uniqueness validation aligned with the final design.
Acceptance Criteria
dbt build --project-dir ./dbt --profiles-dir ./dbt --select fact_payments passes.
- Grain is documented in YAML and/or model docs.
- Final grain is explicitly defined as:
1 row per payment_key.
order_purchase_date is populated through a documented join path.
- Tests pass locally.
Out of scope
- No changes to existing marts unless strictly necessary.
Notes
If the chosen join path has tradeoffs, document them briefly in the PR.