This guide covers how to extend SourceMedium’s data models by building your own tables, views, or queries in your Managed Data Warehouse.
Before you start
Understand our table types:
obt_* (One Big Tables) — Best starting point for most analyses. Pre-joined, business-ready.
fct_* / dim_* — Granular building blocks for custom joins.
rpt_* — Pre-aggregated for specific reporting use cases.
Start with obt_ tables when possible. They’re designed as a semantic layer and handle most common joins for you.
Recommended approach
1. Start with OBT tables
For most custom analyses, obt_orders and obt_customers provide everything you need:
2. Join fact + dimension tables for granular needs
When OBTs don’t have the grain you need:
3. Use report tables for pre-aggregated metrics
Don’t re-aggregate what’s already computed:
Common join keys
Always filter by sm_store_id (SourceMedium store identifier) when working across brands or stores to avoid cross-contamination.
Best practices
Filter to valid orders
Always include is_order_sm_valid = TRUE to exclude test orders, cancelled orders, and other invalid transactions:
Use consistent revenue definitions
Pick one and stick with it across your models:
order_net_revenue — After discounts and refunds; excludes shipping, taxes, and shipping taxes
order_total_revenue — Net revenue plus net shipping, net taxes, and net shipping taxes
order_gross_revenue — Before discounts and refunds
Partition and cluster your models
If creating persistent tables, optimize for query performance:
Document your models
Add descriptions so others (and future you) understand the logic:
Common patterns
Customer-level aggregations
Channel attribution analysis
Product affinity (what’s bought together)
Next steps