Build a 180-day customer activity layer at customer x store grain, then a segment model on top tagging VIPs, big spenders, and category-loyal customers. Seven prompts. Both models materialized to your dev schema.
Segmentation scenario walkthrough. Seven steps, ~2 minutes. Builds the activity layer and the segment model.
Marketing wants a targeted high-value audience based on recent purchase behavior, by store. The output needs to be a queryable table, not a one-off query.
The design is two models: a reusable activity layer (customer x store, 180-day window) and a segment model on top. Future churn, RFM, and dashboard work can sit on the activity layer without re-deriving the same aggregates.
A customer can belong to more than one segment. The model unions rows so a single customer appears with multiple segment_name values.
avg_transaction_value > $100 AND transaction_count >= 3
max_transaction_value > $300 (frequency-independent)
category_transaction_count >= 10 for any single category
Copy each prompt as written, or rephrase. Run in order.
Six entity types in scope: customers, stores, orders, order lines, products, categories.
Find the models related to customers, stores, orders, order lines, products, and categories.
Then ask for grain and joins.
Show the grain and joins for those models.
Confirm three things: where category lives (product / order-line / order header), the grain of orders vs. order lines, and whether store is on the order, on the customer, or both.
Check recent order dates and category values needed for a 180-day segmentation model.
Two common bugs: a stale max(order_date) that silently shrinks the 180-day window, and a category field with nulls, whitespace, or mixed case that breaks category-loyal logic.
Create a 180-day customer activity model by store.
current_date or on max(order_date). If categories are dirty, decide exclude-vs-coalesce now.
Reusable intermediate model (not the segment model yet). Per customer x store aggregates over the trailing 180 days: transaction_count, avg_transaction_value, max_transaction_value, and category_transaction_count at customer x store x category grain.
Create a segment model for VIPs, big spenders, and category-loyal customers, built on top of the activity model.
Built on the activity layer. Expected columns: customer identifier, store_name, segment_name, transaction_count, avg_transaction_value, max_transaction_value, category, category_transaction_count. Verify multi-segment logic and thresholds.
Compile and preview the segment model. Exclude customers with no segment.
The SQL compiles, sample rows render, nothing lands in the warehouse. The "exclude no segment" filter doubles as a data-quality check.
Materialize the segment model into my dev schema. Skip the verification pass - the preview already confirmed the output.
dbt Wizard runs the build against your dev schema (dev_lab_user_N). The instructor drops dev schemas after the lab via a cleanup script.
Verification is skipped because the Step 6 preview already validated the output. A full verification pass would consume ~10% of the 20-minute lab budget.
Skill definition, prompts, and instructor notes for scenario 3.
Every prompt in this scenario, formatted for print.
Broken model from an upstream column rename. Three paths.