dbt-labs / dbt-codegen

Macros that generate dbt code
https://hub.getdbt.com/dbt-labs/codegen/latest/
Apache License 2.0
484 stars 106 forks source link

Suggestion to materialize base models as view or table #79

Closed davesgonechina closed 1 year ago

davesgonechina commented 2 years ago

This is a:

Description & motivation

Add materialization parameter to generate_base_model to allow users to choose whether to materialize the model as a table or a view.

Since base models ought not to do much transformation and provide a lightweight layer atop source tables, it is not uncommon to materialize them as views while having the default materialization for a project be tables, since heavier transformation models ought not be computed on the fly as they would be on a view.

This change would also make it possible to generate base models materialized as views in bulk using the dbt-generator package.

Checklist