Overview
Schema changes are deceptively simple. A request like “add a nullable column and backfill it” can affect landing tables, staging models, dimensional tables, marts, reporting logic, lineage assumptions, validation checks, rollback procedures, and release sequencing.
The examples use retail customer data because the dependencies are easy to see, but the same kinds of handoffs show up in many analytics and platform teams.
This cookbook demonstrates a practical pattern for using agents as a change-analysis and implementation assistant for database engineering work. Instead of asking one model to produce a final SQL script directly, the workflow breaks the task into explicit stages:
- Parse the natural-language request into structured JSON.
- Analyze impacted objects and operational risks.
- Create a rollout plan with prechecks, postchecks, and rollback guidance.
- Generate SQL across platform layers.
- Run deterministic sanity checks.
- Save a machine-readable artifact.
- Optionally run Promptfoo evals against the current flow.
The result is not just a generated SQL script. It is an auditable bundle containing the interpreted change request, impact analysis, plan, SQL, validation results, optional RAG evidence summaries, and eval outputs.