Re-engineer something you own
Convert a legacy SQL script or view into a dbt model and prove parity
- When a scheduled SQL script is the real production logic and nobody can prove a rebuild would match it.
- When a view with hard-coded table references is what a downstream report actually depends on.
Convert a legacy SQL script or view into a dbt model with sources and CTE structure, and prove the new relation is identical to the current one before the script is retired. Covers the conversion and its parity proof, not the decision to retire the original script.
Sample This Recipe has not been materialized in the Cookbook repository yet. Its trigger, description, prompt, agent guidance and acceptance conditions, and the explanation below, are prototype drafts. Its name, job, area and readiness come from the reconciled Cookbook seed snapshot. Readiness is a separate question from this one: it says whether the capability exists, not whether the writing has been reviewed.
Use this Recipe
Use the VibeData Recipe `legacy-sql-to-dbt` at https://getvibedata.ai/cookbook/legacy-sql-to-dbt Read the Recipe and execute it in the context of the current Intent.
Recipe id legacy-sql-to-dbt · Not yet materialized in the Cookbook repository, so the pointer addresses this page.
Verified by
What has to be observably true before this Recipe is finished.
- the new model's output matches the current table row for row over the agreed comparison window
- every hard-coded table reference is replaced with a declared source
- the script is not retired in the same change that introduces the model
- the model builds from committed sources with no inline connection strings
Recipe promptThe task specification the agent reads. Reference only — it is not what you copy.
Deliver: Convert a legacy SQL script or view into a dbt model and prove parity. Convert a legacy SQL script or view into a dbt model with sources and CTE structure, and prove the new relation is identical to the current one before the script is retired. Covers the conversion and its parity proof, not the decision to retire the original script. Execute inside the current Intent. Its Domain, repository, platform, environment and attached sources are the context for this work — read them rather than asking for them. The work is done when: - the new model's output matches the current table row for row over the agreed comparison window - every hard-coded table reference is replaced with a declared source - the script is not retired in the same change that introduces the model - the model builds from committed sources with no inline connection strings Report the evidence for each condition above with the result. A condition you cannot meet is something to say, not something to work around.
Agent guidanceHow the agent approaches the work, and what it will not do.
Write down the behaviour that has to stay constant before you touch the current form, and get that agreed. Rebuild in an isolated copy, then reconcile old against new at the grain the consumers read. The reconciliation is the deliverable; the diff is not.
Composes
- dbt model authoring and layering
- dbt in the project
- isolated-copy execution and gate verification
Asks first
Semantic decisions the Intent cannot supply. Never context Studio already holds.
- which Fabric target this work lands on, when the Domain carries both a Lakehouse and a Warehouse
Guardrails
- Build in an isolated copy. Production is read, never written.
- Do not edit the object being held constant. Parity that required a change to the original is not parity.
What you need
- Microsoft Fabric Lakehouse, Microsoft Fabric Warehouse, MotherDuck, or DuckDB.
- A dbt project you can build, and read access to the models it starts from.
- dbt in the project, or the intent to add it.
How it goes
- Name the thing you own, and what about its behaviour has to stay the same.
- Let it read the current form and write down the behaviour it is holding constant.
- Review the design before any SQL is written. Grain first.
- Let it rebuild in an isolated copy of your estate. Production is untouched throughout.
- Reconcile the new form against the old one, row by row.
- Read the acceptance conditions. They are the contract; the diff is not.
What you end up with
The deliverable, in your own repository, as transformation work a reviewer who knows the project reads as native to it. Alongside it, the evidence for every one of the acceptance conditions above — which is the part that is still there in three weeks when somebody asks.
