-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support persist_docs for column descriptions #170
Support persist_docs for column descriptions #170
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @cristianoperez! A few small comments from me, after which this looks good to go.
I'd love to add a test for this, but I think the right place for that test is actually in dbt-adapter-tests
. We wrote those tests at a time when persist_docs
was a brand-new feature; today, it's functionality that a dbt user can reasonably expect across a good number of adapters.
{% for column_name in column_dict %} | ||
{% set comment = column_dict[column_name]['description'] %} | ||
{% set comment_query %} | ||
ALTER TABLE {{ relation }} ALTER COLUMN {{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} COMMENT '{{ comment }}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Per comments in Support persist_docs for column descriptions #84, didn't you find that
CHANGE COLUMN
was more effective thanALTER COLUMN
(even though it doesn't seem there should be a difference)? - Style nit: We prefer to lowercase keywords in DDL/DML statements
Thanks for the info, I spent a few time thinking about how to create a test for this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @cristianoperez! Could you add a note to the changelog, under dbt next
, and add yourself to the list of contributors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cristianoperez!
resolves #84
Description
Adds support for column descriptions when its in Delta format and
persist_docs = {'columns': true}
Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.