-
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
[CT-764] Persist Column level comments when creating views #372
Comments
Perhaps it should be classified as a "bug" rather than an "enhancement" because there is currently no word in the docs about this limitation and I'd argue that it is quite unexpected for the user (it took my quite a while to figure out that it's not me doing something wrong and arrive here). |
Any plans or timelines that could be shared, @jtcohen6? |
Sorry for the delay in following up here! I think we'd need to implement this similar to how we implemented Relevant code is here. The specific entry point within the {% set query_columns = get_columns_in_query(sql) %}
{{ get_persist_docs_column_list(model_columns, query_columns) }} I'm going to mark this as |
Wouldn't it be better to run a |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Commenting so the issue wouldn't be closed. Btw, on Databricks I see some field descriptions synced while others not now 🤷. |
We have several column descriptions that are persisted from other table models upstream in the pipeline. This is nice since we don't need to rewrite the same definitions in multiple |
Re-opening until we confirm this is released in all places. |
Closing; this has been backported to |
@mikealfare, just a quick note the documentation website still says views are not supported: https://docs.getdbt.com/reference/resource-configs/persist_docs |
Update persist_docs.md to reflect fixed databricks persist column comments dbt-labs/dbt-spark#372 (comment)
Update persist_docs.md to reflect fixed databricks persist column comments dbt-labs/dbt-spark#372 (comment) ## What are you changing in this pull request and why? <!--- Describe your changes and why you're making them. If related to an open issue or a pull request on dbt Core, then link to them here! To learn more about the writing conventions used in the dbt Labs docs, see the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md). --> ## Checklist <!-- Uncomment when publishing docs for a prerelease version of dbt: - [ ] Add versioning components, as described in [Versioning Docs](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-entire-pages) - [ ] Add a note to the prerelease version [Migration Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade) --> - [ ] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. - [ ] For [docs versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#about-versioning), review how to [version a whole page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) and [version a block of content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content). - [ ] Add a checklist item for anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch." Adding or removing pages (delete if not applicable): - [ ] Add/remove page in `website/sidebars.js` - [ ] Provide a unique filename for new pages - [ ] Add an entry for deleted pages in `website/vercel.json` - [ ] Run link testing locally with `npm run build` to update the links that point to deleted pages
Describe the feature
The persist_docs config works for tables by materializing a model as a table and then running ALTER TABLE statements to update the comment on each column. This method does not work for views because ALTER VIEW doesn't support adding comments. Instead, comments need to be defined when running the CREATE OR REPLACE VIEW statement. There should be an option to handle column level comments for models materialized as views.
I originally opened this issue in dbt-databricks but they told me to open it here instead
Describe alternatives you've considered
I tried creating a macro that adds the necessary comment clause and put it at the top of my model but the SQL gets inserted after the AS in CREATE OR REPLACE VIEW AS
Who will this benefit?
This will benefit anyone using column level comments on views in databricks
Are you interested in contributing this feature?
Yes! I've created a macro to do this. Attaching below:
The text was updated successfully, but these errors were encountered: