DEN-3Recommended
Build every warehouse table from reviewed code
Write every table the warehouse builds as SQL or code in version control, reviewed and deployed by CI. No shared table is built from a saved query in a BI tool or a notebook.
How to do it
A table built by hand cannot be rebuilt, reviewed or traced. A transformation tool such as dbt or SQLMesh does this, or a folder of SQL files run in order. CI builds the changed models and runs their tests on every pull request, as Run the checks on every change says. Metrics follow Define each metric once.
How to check
A script compares the warehouse's list of shared tables with the model files in the repository and fails on any table without a model. Only the deploy job's account can create tables in shared schemas.
Related rules
- ENG-16 Run the checks on every change in Engineering
- DAT-53 Define each metric once in Data and databases
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data-engineering/warehouse-and-models/transformations-as-code">Agent Wranglers data engineering playbook</a>. In code you write, add a comment next to it with the same link.