A multi-brand retailer's analytics team was making decisions on data that was a full day old — not because fresh data was technically out of reach, but because nobody had ever built the infrastructure to deliver it reliably. Cron jobs failed silently two or three times a week, nobody trusted the numbers without re-checking them by hand, and a planned demand forecasting program had stalled because the underlying data simply wasn't reliable enough to train on. We rebuilt the pipeline from the source to the dashboard: observable, tested, and delivering core metrics in under 15 minutes.

The Challenge
The existing system had accumulated years of technical debt in the form of hand-written overnight SQL scripts and cron jobs that ran on a shared server nobody fully owned. When a job failed, the first sign was usually an analyst noticing a gap in a dashboard the next morning — hours after the failure had already cascaded into downstream tables. Fixing failures required reading through thousands of lines of undocumented SQL with no tests and no lineage map.
The demand forecasting initiative had been scoped, resourced, and stopped at the data layer. The data science team needed a clean, documented feature table with freshness guarantees — what they had was a set of manually-curated spreadsheets exported from dashboards the analytics team already didn't fully trust. Adding a forecasting model on top of that foundation wasn't a data science problem; it was a data engineering problem.
- Dashboards running 18–24 hours behind operational reality due to nightly batch scheduling
- Silent pipeline failures discovered by analysts, not monitoring — mean time to detect measured in hours
- No automated data-quality tests; correctness checked manually on an ad hoc basis
- Zero documentation of table lineage, transformation logic, or data ownership
Observable by Design
- ✓ Change data capture from Postgres and e-commerce platform into Snowflake, replacing batch SQL exports
- ✓ 120+ dbt data-quality tests gating every load, with failures blocking downstream models
- ✓ Dagster orchestration with per-asset SLAs, freshness checks, and automatic retry logic
- ✓ Slack alerts on pipeline failures within minutes — not discovered the following morning
The Approach
The first week was spent mapping rather than building. We documented every data source — the operational Postgres database, the e-commerce platform's API, three third-party feeds — alongside every consumer: the BI dashboards, the finance export, and the nascent forecasting project. For each source-to-consumer path we identified the business question the data needed to answer and the freshness requirement that made it actionable. This map became the project's backlog and the acceptance criteria for every model we'd build.
Rather than a big-bang rewrite, we wrapped the existing cron job logic in dbt tests before touching it — capturing current behavior so that regressions would surface immediately. Then we replaced jobs one domain at a time, starting with the highest-value tables (sales by brand and category) and working outward. Each domain went live in Dagster before the cron job for that domain was retired, so analysts could validate the new output against the old one with both running in parallel. No analytics downtime; no trust-destroying data gaps during the migration.

Architecture & Implementation
Ingestion moved to change data capture using Debezium against the operational Postgres, streaming row-level changes into Snowflake via a managed connector. The e-commerce platform's API was polled on a 5-minute schedule by a lightweight Python ingestion service that wrote directly to a raw Snowflake schema. Both paths land in an immutable raw layer — no transformations, no overwrites — so any issue with downstream models can be debugged against the original source data.
flowchart LR
subgraph SOURCES[Source Systems]
S1[PostgreSQL DB]
S2[Kafka Events]
S3[SaaS APIs]
end
subgraph INGEST[Ingestion Layer]
I1[Fivetran Batch]
I2[CDC Streaming]
end
subgraph WAREHOUSE[Snowflake Lakehouse]
W1[Raw Layer]
W2[Silver dbt Models]
W3[Gold Aggregations]
end
subgraph SERVE[Consumers]
C1[Looker BI]
C2[ML Features]
C3[Reverse ETL]
end
S1 & S3 --> I1 --> W1
S2 --> I2 --> W1
W1 --> W2 --> W3
W3 --> C1 & C2 & C3
style SOURCES fill:#fefce8,stroke:#fde047
style WAREHOUSE fill:#eff6ff,stroke:#93c5fd
style SERVE fill:#f0fdf4,stroke:#86efacTransformations were rebuilt as modular dbt models with a strict layer discipline: raw → staging → intermediate → mart. Staging models handled source-specific cleaning and type casting. Intermediate models handled business logic — SKU classification, brand attribution, promotional flag logic. Mart models produced the star schema tables consumed by the BI layer and the feature table consumed by the forecasting team. Every model has a documented owner, a description, and column-level documentation generated into a searchable dbt docs site.
Dagster orchestrates the full graph as software-defined assets, with per-asset freshness policies that trigger alerts when any asset exceeds its SLA. Retries are configured per asset class — transient API failures get three retries with exponential backoff; structural failures page the on-call engineer immediately. Snowflake compute was right-sized after profiling actual query patterns; incremental dbt models reduced warehouse credit consumption by approximately 30% compared to the previous full-refresh approach.
The Great Expectations suite runs 120+ column-level tests — null checks, referential integrity, value distribution bounds, and business-rule validations — as part of every Dagster run. A failing test blocks the affected model and all downstream dependencies from updating, preventing bad data from reaching dashboards.
"Before this, every Monday morning started with someone asking whether the weekend numbers could be trusted. Now the data is 15 minutes old and we know immediately when something breaks. The forecasting team is actually using it — that alone justified the whole project."
Outcomes
- Core table freshness reduced from ~24 hours to under 15 minutes — intraday decisions are now data-driven
- 120+ automated data-quality tests gating every pipeline run, with zero silent failures since launch
- Mean time to detect pipeline failures dropped from several hours to under 5 minutes via Slack alerts
- Demand forecasting program unblocked on a clean, documented feature table with contractual freshness guarantees
- Snowflake warehouse spend reduced by approximately 30% through incremental model patterns and right-sized compute
- Full lineage documentation, runbooks, and dbt docs site handed to the in-house analytics team at project close
Technologies Used
