From 276ccff9f34aba626c47672d7021df9802b88eb1 Mon Sep 17 00:00:00 2001 From: rong fengliang <1141591465@qq.com> Date: Wed, 8 Jan 2025 20:46:11 +0800 Subject: [PATCH] Update replace.sql (#186) Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Colin Rogers <111200756+colin-rogers-dbt@users.noreply.github.com> Co-authored-by: Adrian --- .changes/unreleased/Fixes-20240425-133610.yaml | 6 ++++++ dbt/include/global_project/macros/relations/replace.sql | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixes-20240425-133610.yaml diff --git a/.changes/unreleased/Fixes-20240425-133610.yaml b/.changes/unreleased/Fixes-20240425-133610.yaml new file mode 100644 index 00000000..5d9689f6 --- /dev/null +++ b/.changes/unreleased/Fixes-20240425-133610.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix is_replaceable check with wrong variable +time: 2024-04-25T13:36:10.684598+08:00 +custom: + Author: rongfengliang + Issue: "187" diff --git a/dbt/include/global_project/macros/relations/replace.sql b/dbt/include/global_project/macros/relations/replace.sql index adba77dc..2ba856df 100644 --- a/dbt/include/global_project/macros/relations/replace.sql +++ b/dbt/include/global_project/macros/relations/replace.sql @@ -8,7 +8,7 @@ {# /* use a create or replace statement if possible */ #} - {% set is_replaceable = existing_relation.type == target_relation_type and existing_relation.can_be_replaced %} + {% set is_replaceable = existing_relation.type == target_relation.type and existing_relation.can_be_replaced %} {% if is_replaceable and existing_relation.is_view %} {{ get_replace_view_sql(target_relation, sql) }}