You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{%- macro default__get_create_intermediate_sql(relation, sql) -%}
-- get the standard intermediate name
{% set intermediate_relation = make_intermediate_relation(relation) %}
-- drop any pre-existing intermediate
{{ get_drop_sql(intermediate_relation) }};
{{ get_create_sql(intermediate_relation, sql) }}
{%- endmacro -%}
Why
Before MV/DTs, when materializing a dbt model as a table or view, dbt would first check if the target name already existed, and drop it if so.
For example, when creating a table with the target three-part name foo.bar.baz, dbt will check to see if that name is being already used by a view.
Furthermore, dbt’s out-of-the-box materializations will create backup and temp objects so if dbt run fails, the user is back to where they started, instead of having dropped all database objects were in dbt’s way.
Now, dbt must also check that the current model and corresponding backup and temp relations won’t collide with any existing materialized views.
The two-adapter related features here are
checking if a relation exists, and if so, what type it is
@benc-db if this strikes you as a lot of moving pieces and I haven't yet explained everything, you'd be right! Please let me know how I can help. Thanks for agreeing to being our guinea pig
The text was updated successfully, but these errors were encountered:
@dataders can you schedule a meeting with me and either you or someone else from your team to go over the details. I did what was called out in the migration guide for 1.7.0, but I suspect this work was pushed out along with MV/ST and want to make sure I have all the context before I pick it back up.
What
Restructure macros so that operations so that within a materialization, macros need not get more relation-specific.
This means there's now a catch all macro that can be used regardless of the underlying relation type
examples
drop_relation()
get_create_intermediate_sql()
Why
Before MV/DTs, when materializing a dbt model as a table or view, dbt would first check if the target name already existed, and drop it if so.
For example, when creating a table with the target three-part name
foo.bar.baz
, dbt will check to see if that name is being already used by a view.Furthermore, dbt’s out-of-the-box materializations will create backup and temp objects so if
dbt run
fails, the user is back to where they started, instead of having dropped all database objects were in dbt’s way.Now, dbt must also check that the current model and corresponding backup and temp relations won’t collide with any existing materialized views.
The two-adapter related features here are
Relevant PRs
@benc-db if this strikes you as a lot of moving pieces and I haven't yet explained everything, you'd be right! Please let me know how I can help. Thanks for agreeing to being our guinea pig
The text was updated successfully, but these errors were encountered: