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 609f644
Showing 1 changed file with 6 additions and 2 deletions.
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 609f644

Please sign in to comment.