A dbt project that transforms raw e-commerce data into a conversion funnel analysis and customer segmentation model. Designed to run against the DataOS demo Postgres database.
raw.customers ─┐
raw.orders ────┤─→ stg_* ─→ int_customer_events_sessionized ─→ fct_conversion_funnel
raw.products ──┤ int_order_items_enriched ─────────→ fct_revenue_by_region_category
raw.events ────┘ └────────→ dim_customer_segments
| Table | Description |
|---|---|
raw.customers |
5 customers across US-West, US-East, EU-West, APAC |
raw.orders |
7 orders (completed, shipped, pending) |
raw.products |
5 products (Electronics, Furniture) |
raw.events |
8 clickstream events (page_view, add_to_cart, purchase) |
| Table | Description |
|---|---|
mart.fct_conversion_funnel |
Daily funnel: sessions per step + conversion rates |
mart.dim_customer_segments |
Customer segmentation by LTV tier + activity status (PII-free) |
mart.fct_revenue_by_region_category |
Revenue drill-down by region and product category |
-
The DataOS demo Postgres must be running with seed data:
# From the dataos repo: task demo-seed -
Python with dbt-postgres:
pip install dbt-postgres
# Install dbt packages
dbt deps
# Validate the project
dbt debug
# Run all models
dbt run
# Run tests
dbt test
# Generate and serve docs
dbt docs generate && dbt docs serveBy default connects to localhost:5433 (the DataOS demo Postgres). Override via env vars:
export DBT_HOST=localhost
export DBT_PORT=5433
export DBT_USER=demo
export DBT_PASSWORD=demo
export DBT_DBNAME=demo