
π Data Engineering & Analytics Β· Database ERD
A classic star schema for sales analytics: one fact table of order lines surrounded by date, customer, product, store and promotion dimensions.
Drawing diagramβ¦
Star schema for retail sales: a fact_sales table with one row per order line (quantity, net amount, discount, cost) linked to dim_date, dim_customer (with valid_from and valid_to for history), dim_product, dim_store and dim_promotion.
erDiagram
DIM_DATE ||--o{ FACT_SALES : "sold on"
DIM_CUSTOMER ||--o{ FACT_SALES : buys
DIM_PRODUCT ||--o{ FACT_SALES : "sold as"
DIM_STORE ||--o{ FACT_SALES : "sold at"
DIM_PROMOTION ||--o{ FACT_SALES : applies
FACT_SALES {
bigint sales_key PK
int date_key FK
int customer_key FK
int product_key FK
int store_key FK
int promotion_key FK
int quantity
decimal net_amount
decimal discount
decimal cost
}
DIM_DATE {
int date_key PK
date full_date
string month
string fiscal_quarter
boolean is_holiday
}
DIM_CUSTOMER {
int customer_key PK
string customer_id
string city
string segment
date valid_from
date valid_to
}
DIM_PRODUCT {
int product_key PK
string sku
string category
string brand
}
DIM_STORE {
int store_key PK
string name
string region
}
DIM_PROMOTION {
int promotion_key PK
string name
string type
}A typical modern data stack: data is loaded from apps and SaaS tools into a cloud warehouse, modelled with dbt, orchestrated with Airflow and served to BI dashboards.
How every insert, update and delete in an operational database is streamed to the data lake and search index in near real time using change data capture.
The steps of a nightly batch pipeline with data quality gates: extract, validate, transform, load and publish, stopping safely when checks fail.
Where a real-time analytics stack runs: Kafka for events, Flink for stream processing, a real-time OLAP database and live dashboards.
The states of a single pipeline run in an orchestrator like Airflow, including retries, upstream failures and manual reruns.
The medallion pattern for a data lake: raw data lands in bronze, is cleaned in silver, and turned into business-ready tables in gold.