Replies: 1 comment
-
|
Update: This workaround seems to work for now: # in dbt_project.yml
models:
...
+post-hook:
# force existing column docs to update (https://github.com/databricks/dbt-databricks/discussions/1275)
- '{{ persist_docs(this.incorporate(type="table"), model) }}' Note that the When I then initially (accurately) passed So then I settled on incorporating This now leads me to realize though that the current implementation of {% macro alter_relation_comment_sql(relation, description) %}
COMMENT ON {{ relation.type.render().upper() }} {{ relation.render() }} IS '{{ description | replace("'", "\\'") }}'
{% endmacro %}should instead be: {% macro alter_relation_comment_sql(relation, description) %}
-COMMENT ON {{ relation.type.render().upper() }} {{ relation.render() }} IS '{{ description | replace("'", "\\'") }}'
+COMMENT ON TABLE {{ relation.render() }} IS '{{ description | replace("'", "\\'") }}'
{% endmacro %}Explanation: Databricks' Additionally, {% macro materialized_view_execute_build_sql(build_sql, existing_relation, target_relation, post_hooks) %}
...
{% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %}
{% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}
+
+ {%- do persist_docs(target_relation, model) %}
{{ run_hooks(post_hooks, inside_transaction=True) }}
{% endmacro %}... same as the other materializations do ...
... to avoid having to apply this workaround in the first place. 🙃 |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Don't have time to be super detailed right now (which is why I didn't do a bug report yet) but I wanted to start the discussion. I have models with
+materialized: materialized_viewand+persist_docs: {relation: true, columns: true}. When I made a change to (only) the descriptions, the SQL to alter the comment did not get issued duringdbt build. It seems dbt-databricks currently only adds the comments on creation / full refresh.I may be able to work around this by just manually calling
persist_docs(this, model, true, true)in a post hook -- I'm gonna try that and see how it goes.Beta Was this translation helpful? Give feedback.
All reactions