runtime
CRM + ERP Integration · milestone 10 / 12

milestone 10/12 Stage, validate & atomically promote a refresh

Validate staged data before replacing a published result.

CRM + ERP Integration · Follow extraction reconciliation, authoritative integration, date quarantine, quality gates, stable keys, replay-safe loads, and atomic promotion. Finish with a customer-grain capstone and field-level lineage.

approach

Build and validate the candidate before replacing published data. A transaction makes related writes commit together; rollback retains the old snapshot. In this controlled lab the candidate is known to pass. Production needs explicit blocking gates, failure handling, and workload-specific isolation. SQL Server TRUNCATE syntax is not executed here.

worked-example.sql
BEGIN;
DELETE FROM published_totals;
INSERT INTO published_totals
SELECT *
FROM refresh_stage;
ROLLBACK;
SELECT customer_id,total_sales
FROM published_totals;

data for this milestone

published_totals2 columns · 2 rows
customer_idtext · keytotal_salesreal
C001289
C002116

all 2 rows

refresh_stage2 columns · 2 rows
customer_idtexttotal_salesreal
C001300
C002120

all 2 rows

challenge 1

Simulate an interrupted promotion: BEGIN, DELETE published_totals, INSERT from refresh_stage, ROLLBACK. Return customer_id,total_sales; the old snapshot must remain.

Return customer_idtotal_salesany row ordertable changes are checked too

challenge-1.sql
 
3 steps left · check both queries and pass the concept checkNext milestone
Stage, validate & atomically promote a refresh — CRM + ERP Integration · Runtime