Skip to content

Commit

Permalink
Only set the comment when persist_docs.relation is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Aug 10, 2023
1 parent 7c0ac71 commit 2432b48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changes/unreleased/Fixes-20230810-233738.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Fixes
body: Only set the comment when persist_docs.relation is set
time: 2023-08-10T23:37:38.828664+02:00
custom:
Author: Fokko
Issue: "317"
PR: "343"
8 changes: 6 additions & 2 deletions dbt/include/trino/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@
{%- endmacro -%}

{% macro comment(comment) %}
{%- if comment is not none and comment|length > 0 -%}
comment '{{ comment | replace("'", "''") }}'
{%- set persist_docs = model['config'].get('persist_docs', {}) -%}
{%- if persist_docs is not none -%}
{%- set persist_relation = persist_docs.get('relation') -%}
{%- if persist_relation and comment is not none and comment|length > 0 -%}
comment '{{ comment | replace("'", "''") }}'
{%- endif -%}
{%- endif -%}
{%- endmacro -%}
Expand Down

0 comments on commit 2432b48

Please sign in to comment.