Skip to content

feat(marts): add fact_payments model (Phase 2.2)#7

Merged
Flames4fun merged 1 commit intoFlames4fun:mainfrom
thoalecorn:feat/fact-payments
Mar 19, 2026
Merged

feat(marts): add fact_payments model (Phase 2.2)#7
Flames4fun merged 1 commit intoFlames4fun:mainfrom
thoalecorn:feat/fact-payments

Conversation

@thoalecorn
Copy link
Collaborator

Related issue

Closses #6
##Description
Implements fact_payments mart model as specified in Phase 2.2.

Changes

  • dbt/models/marts/facts/fact_payments.sql — built from stg_payments
    with order_purchase_date via LEFT JOIN with int_orders_enriched
  • dbt/models/marts/facts/_fact_payments.yml — documents grain and
    defines not_null, unique, and relationships tests

Changes

  • dbt/models/marts/facts/fact_payments.sql — built from stg_payments
    with order_purchase_date via LEFT JOIN with int_orders_enriched
  • dbt/models/marts/facts/_fact_payments.yml — documents grain and
    defines not_null, unique, and relationships tests

Grain

1 row per payment_key (surrogate key of order_id + payment_sequential)

Join path & tradeoff

order_purchase_date is sourced from int_orders_enriched via LEFT JOIN
on order_id. int_orders_enriched was chosen over fact_orders to avoid
a mart-to-mart dependency, which is an anti-pattern in dbt layering.
LEFT JOIN ensures no payments are lost if an order_id has no match.

Verification

dbt build --project-dir ./dbt --profiles-dir ./dbt --select fact_payments
Done. PASS=9 WARN=0 ERROR=0 SKIP=0 TOTAL=9
image

@Flames4fun Flames4fun merged commit f740afa into Flames4fun:main Mar 19, 2026
1 check passed
@Flames4fun
Copy link
Owner

Great work!, merging right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants