materialized
- Project file
- Property file
- Config block
dbt_project.yml
config-version: 2
models:
  <resource-path>:
    +materialized: <materialization_name>
models/properties.yml
version: 2
models:
  - name: <model_name>
    config:
      materialized: <materialization_name>
models/<model_name>.sql
{{ config(
  materialized="<materialization_name>"
) }}
select ...
Definition
Materializations are strategies for persisting dbt models in a warehouse. These are the materialization types built into dbt:
- ephemeral— ephemeral models are not directly built into the database
- table— a model is rebuilt as a table on each run
- view— a model is rebuilt as a view on each run
- materialized_view— allows the creation and maintenance of materialized views in the target database
- incremental— incremental models allow dbt to insert or update records into a table since the last time that model was run
You can also configure custom materializations in dbt. Custom materializations are a powerful way to extend dbt's functionality to meet your specific needs.
Creation Precedence
Materializations are implemented following this "drop through" life cycle:
- If a model does not exist with the provided path, create the new model.
- If a model exists, but has a different type, drop the existing model and create the new model.
- If --full-refreshis supplied, replace the existing model regardless of configuration changes and theon_configuration_changesetting.
- If there are no configuration changes, perform the default action for that type (e.g. apply refresh for a materialized view).
- Determine whether to apply the configuration changes according to the on_configuration_changesetting.
0