Part 07 / Topic 2 of 6
Staging and core tables
Load a batch into a staging table first, validate it there, then move it into the core table people query:
-- 1. truncate staging; bulk-load the raw batch into it
-- 2. run checks against staging (counts, nulls, referential sanity)
-- 3. only then: upsert staging into core in one transaction
The payoff is blast-radius control: a bad batch dies in staging, where nobody's dashboard can see it. The customer's analysts never meet your half-loaded data, and a failed load leaves core exactly as it was. Staging tables also give the quarantine report from Part 6 a natural home — rows that fail checks stay in staging, flagged.
🧪 Quick quiz — answer from memory, then check.
- Why load into a staging table before the main table?
Show the answer
You can validate and fix the batch before it touches the tables people use. Staging isolates bad batches from production data.
Done here? The practice set for Part 7 — 4 exercises with solutions — is on the part page.