From 5a826e16b2ad84421c43be4c24175f40eed4ff0e Mon Sep 17 00:00:00 2001 From: Manrique Vargas Date: Fri, 13 Oct 2023 12:37:16 -0600 Subject: [PATCH 1/2] Update seed.sql --- dbt/include/spark/macros/materializations/seed.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt/include/spark/macros/materializations/seed.sql b/dbt/include/spark/macros/materializations/seed.sql index 196479cb0..d239295be 100644 --- a/dbt/include/spark/macros/materializations/seed.sql +++ b/dbt/include/spark/macros/materializations/seed.sql @@ -27,7 +27,7 @@ {% endfor %} {% set sql %} - insert into {{ this.render() }} values + insert {% if loop.index0 == 0 -%} overwrite {% else -%} into {% endif -%} {{ this.render() }} values {% for row in chunk -%} ({%- for col_name in agate_table.column_names -%} {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%} From 3b8c7cb6870c3c0116a04f6edfe702d2937741c0 Mon Sep 17 00:00:00 2001 From: Manrique Vargas Date: Fri, 13 Oct 2023 12:38:11 -0600 Subject: [PATCH 2/2] Create Fixes-20231013-120628.yaml --- .changes/unreleased/Fixes-20231013-120628.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Fixes-20231013-120628.yaml diff --git a/.changes/unreleased/Fixes-20231013-120628.yaml b/.changes/unreleased/Fixes-20231013-120628.yaml new file mode 100644 index 000000000..a448944ad --- /dev/null +++ b/.changes/unreleased/Fixes-20231013-120628.yaml @@ -0,0 +1,7 @@ +kind: Fixes +body: Overwrite existing rows on existing seed tables. For unmanaged databases (no location specified), the current seed command in + dbt-spark appends to existing seeded tables instead overwriting. +time: 2023-10-13T12:06:28.078483-06:00 +custom: + Author: mv1742 + Issue: "112"