I built an end-to-end ecommerce pipeline on the Brazilian Olist dataset, about 100,000 orders. Star schema in Postgres, dbt doing the modeling, Airflow running it daily, Kafka and Spark for a simulated live order stream. The repo is ecommerce-data-platform on my GitHub.
Two fact tables: fct_orders at order grain, fct_order_items at line-item grain. That split was the one decision that shaped everything downstream. Every question about basket size, revenue per order, or items per order depends on which fact you ask. Get the grain wrong and the query looks fine while the answer is wrong.
The mistake was dim_customers. In the raw data, one customer can have several customer_id values but only one customer_unique_id. I keyed the dimension off customer_id at first. Joins multiplied rows and my customer count came out about 30% too high. I did not notice until a simple sanity check on distinct customers did not match the source.
The fix was surrogate keys generated from customer_unique_id.…