Skip to content

Commit

Permalink
Fix hardcoded file format in python materializations (#955)
Browse files Browse the repository at this point in the history
* Fix hardcoded file format in python materializations

* Add changelog
  • Loading branch information
ben-schreiber authored Dec 21, 2023
1 parent f774bcb commit 5210d0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20231221-081949.yaml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion dbt/include/spark/macros/materializations/table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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()%}
Expand Down

0 comments on commit 5210d0a

Please sign in to comment.