A company has three source tables:
raw.stripe_charges
raw.salesforce_accounts
raw.product_usage_events
An analyst wants a final mart called monthly_customer_health showing for each customer, per month: total revenue, number of active users, and pricing plan.
(1) Design the dbt model structure using the three-layer architecture (staging, intermediate, marts). List every model name and what it does.
(2) Write the SQL for one staging model — pick whichever you find most informative. Include type casting and renaming.
(3) What dbt tests would you add to the staging models, and why is each one important? Be specific about not_null, unique, relationships, and any custom tests.
(4) Should monthly_customer_health be materialized as a table, view, or incremental model? Justify your choice based on query frequency, build cost, and freshness needs.