Hey, we using dbt and we have the following steps:
- dbt seed for loading CSV > project_stage_base schema
- dbt run for creating base tables in project_stage_base schema
- dbt test for testing sources.
- dbt run for creating all the models at project_stage schema
- dbt test for testing the models at project_stage schema
- dbt run_operation to move all base tables from project_stage_base to project_base
- dbt run to generate all models at project schema
The idea is to run all steps in the ‘stage’ schema, test it, and if test passed to deploy it to the main project schema.
For base schema, all the models are tables and its easy to move them (copy) but for the main schema most of the models are views.
The view models contain references and variables and its not easy to move them with SQL operation.
It’s important not to ‘brake’ the main schema if tests not passed.
Is there any pattern on how to ‘deploy’ the new models using dbt?
Thanks in advance!