From 88fcce1ee9f518bd61032f56ff63da14ddf97a52 Mon Sep 17 00:00:00 2001 From: Ben Schreiber Date: Sun, 3 Dec 2023 20:26:25 +0200 Subject: [PATCH 1/2] Fix hardcoded file format in python materializations --- dbt/include/spark/macros/materializations/table.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt/include/spark/macros/materializations/table.sql b/dbt/include/spark/macros/materializations/table.sql index 39a9caba9..b7c56c424 100644 --- a/dbt/include/spark/macros/materializations/table.sql +++ b/dbt/include/spark/macros/materializations/table.sql @@ -98,7 +98,7 @@ else: msg = f"{type(df)} is not a supported type for dbt Python materialization" raise Exception(msg) -df.write.mode("overwrite").format("delta").option("overwriteSchema", "true").saveAsTable("{{ target_relation }}") +df.write.mode("overwrite").format("{{ config.get('file_format', 'delta') }}").option("overwriteSchema", "true").saveAsTable("{{ target_relation }}") {%- endmacro -%} {%macro py_script_comment()%} From faeb7296b8c17d5f66dd36b330ce0fc1c7f4a3c9 Mon Sep 17 00:00:00 2001 From: Ben Schreiber Date: Thu, 21 Dec 2023 08:21:56 +0200 Subject: [PATCH 2/2] Add changelog --- .changes/unreleased/Fixes-20231221-081949.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20231221-081949.yaml diff --git a/.changes/unreleased/Fixes-20231221-081949.yaml b/.changes/unreleased/Fixes-20231221-081949.yaml new file mode 100644 index 000000000..b10c8141e --- /dev/null +++ b/.changes/unreleased/Fixes-20231221-081949.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix hardcoded file format for python models +time: 2023-12-21T08:19:49.630806+02:00 +custom: + Author: ben-schreiber + Issue: "803"