Understanding Ephemeral dbt Models
Lab Steps
Introduction
Ephemeral models are very helpful when it comes to the need to define intermediate transformations or temporary models that need to be then leveraged by other models as a starting point. The peculiarity of these models is that they are not stored into the database.
In this lab step, you will learn more about ephemeral dbt models.
Ephemeral Models
In dbt, ephemeral models are not materialized in any way, but they are temporarily built and seen as common table expressions. These models are beneficial when you need to split the transformation and modeling logic into multiple parts instead of overloading a single model. Furthermore, they are useful when you want to have some kind of transformed data as a starting point for one or more models, but you don't need to materialize that kind of transformation.
Following the dbt style guide, these models should be stored in a folder named intermediate. These intermediate models are not 1:1 mappings with sources and are not final models. All, or at least most of your ephemeral models should live within this folder.
In order to let dbt create an ephemeral model you only need to set the materialized property to ephemeral.