Skip to content

Commit

Permalink
dbt-labs#1031 Add macro to add table description from schema.yml for BQ
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenhaken committed Feb 10, 2019
1 parent b17d706 commit f4c233a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/bigquery/dbt/include/bigquery/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@

{%- endmacro -%}

{% macro table_options() %}
{%- set raw_persist_docs = config.get('persist_docs', {}) -%}
{%- set raw_persist_relation_docs = raw_persist_docs.get('relation', false) -%}

{%- if raw_persist_docs is {} -%}
{{ return('') }}
{% endif %}

OPTIONS(
{% if raw_persist_relation_docs -%}
description={{ model.description }}
{% endif %}
)
{%- endmacro -%}

{% macro bigquery__create_table_as(temporary, relation, sql) -%}
{%- set raw_partition_by = config.get('partition_by', none) -%}
Expand All @@ -34,6 +48,7 @@
create or replace table {{ relation }}
{{ partition_by(raw_partition_by) }}
{{ cluster_by(raw_cluster_by) }}
{{ table_docs() }}
as (
{{ sql }}
);
Expand Down

0 comments on commit f4c233a

Please sign in to comment.