0

Trying to understand DBT Materialization strategies - Some of our models are using the {materialized = "view"} option, and still I see that an underlying table is created in the database (We are using AWS Redshift)

Documentation says that: "When using the view materialization, your model is rebuilt as a view on each run, via a create view as statement.." And that: "When using the table materialization, your model is rebuilt as a table on each run, via a create table as statement"

Still I see a table with the name of the model under "Tables" and no such view under "Views".

Can someone please explain this?

Thanks!

  • Where are you applying the view configuration? – Aleix CC Apr 17 '23 at 05:27
  • 1
    Did you start with the "table" materialization, and later switched to view? If so, dbt doesn't drop previously created objects, you have to drop it manually. – Limonka Apr 17 '23 at 09:23
  • @AleixCC - The configuration is part of the "config" section of the model itself: {{ config(materialized='view') }} SELECT col_a, ... – user5372615 Jun 11 '23 at 13:59
  • @Limonka - Interesting. I do not this this is the case, but I arrived to a pre-existing infrastructure, so do not know for sure. I think they have been just using the default, which is "view". Thanks! – user5372615 Jun 11 '23 at 14:00

0 Answers0