Shadow Mode
Shadow mode writes pipeline output to shadow tables instead of (or alongside) production tables. This lets you validate changes (new logic, schema migrations, adapter upgrades) without affecting production data.
How it works
Section titled “How it works”- Rocky rewrites target table names by appending a suffix (default:
_rocky_shadow) or routing to a dedicated schema - The pipeline runs normally, writing to shadow targets
- A comparison engine checks row counts, schemas, and optionally sample data between shadow and production
- Results show pass/warn/fail with detailed diffs
Shadow target rewriting
Section titled “Shadow target rewriting”Suffix mode (default)
Section titled “Suffix mode (default)”production: analytics.marts.fct_revenueshadow: analytics.marts.fct_revenue_rocky_shadowSchema override mode
Section titled “Schema override mode”production: analytics.marts.fct_revenueshadow: analytics.rocky_shadow.fct_revenueSchema override keeps the table name clean and groups all shadow tables together.
Comparison engine
Section titled “Comparison engine”The comparison evaluates three dimensions:
Row count
Section titled “Row count”Compares the number of rows between shadow and production:
shadow: 148,203 rowsproduction: 148,205 rowsdiff: -2 rows (-0.001%)verdict: PASS (within 1% warn threshold)Schema diff
Section titled “Schema diff”Compares column names, types, and order:
| Diff type | Description |
|---|---|
ColumnAdded |
Column in shadow but not production |
ColumnRemoved |
Column in production but not shadow |
ColumnTypeDiff |
Same column, different type |
ColumnOrderDiff |
Same columns, different order |
Sample comparison
Section titled “Sample comparison”Hash-based comparison of sample rows to detect value differences even when row counts match.
Thresholds
Section titled “Thresholds”Configure pass/warn/fail thresholds:
| Threshold | Default | Description |
|---|---|---|
row_count_diff_pct_warn |
0.01 (1%) | Warn if row count differs by more than this |
row_count_diff_pct_fail |
0.05 (5%) | Fail if row count differs by more than this |
allow_column_order_diff |
true | Whether column reordering is acceptable |
Verdicts
Section titled “Verdicts”| Verdict | Meaning |
|---|---|
| Pass | All comparisons within thresholds |
| Warn | Minor differences detected (e.g., row count within warn threshold, column order change) |
| Fail | Significant differences (e.g., row count beyond fail threshold, missing columns, type changes) |
Use cases
Section titled “Use cases”- Schema migrations: Verify a column rename doesn’t change output
- Logic changes: Compare old vs new calculation results
- Adapter testing: Validate a new warehouse adapter against the production adapter
- dbt migration: Compare Rocky output against dbt output (via
rocky validate-migration)