Skip to content

Commit

Permalink
fix: update_table_description like the seed materialization
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwamizamurai committed Mar 29, 2024
1 parent 89c2eb0 commit ac75ff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions dbt/adapters/bigquery/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,12 @@ def update_columns(self, relation, columns):

@available.parse_none
def update_table_description(
self, relation: BigQueryRelation, description: str
self, database: str, schema: str, identifier: str, description: str
):
conn = self.connections.get_thread_connection()
client = conn.handle
table_ref = self.get_table_ref_from_relation(relation)

table_ref = self.connections.table_ref(database, schema, identifier)
table = client.get_table(table_ref)
table.description = description
client.update_table(table, ["description"])
Expand Down
4 changes: 3 additions & 1 deletion dbt/include/bigquery/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@
{% macro bigquery__persist_docs(relation, model, for_relation, for_columns) -%}
{% if for_columns and config.persist_column_docs() and model.columns %}
{% do alter_column_comment(relation, model.columns) %}
{% do adapter.update_table_description(relation, model.description) %}
{% endif %}
{% if config.persist_relation_docs() and 'description' in model %}
{{ adapter.update_table_description(model['database'], model['schema'], model['alias'], model['description']) }}
{% endif %}
{% endmacro %}

Expand Down

0 comments on commit ac75ff2

Please sign in to comment.