Skip to content
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

Description doesn't inherit code blocks when using upstream_descriptions. #111

Closed
diegodewilde opened this issue Jan 10, 2023 · 5 comments
Closed
Labels
bug Something isn't working Stale

Comments

@diegodewilde
Copy link

Describe the bug

When using the generate_model_yaml functionality with upstream_descriptions it seems that the generated yaml file doesn't use the exact yaml description from upstream. Instead it uses the "compiled" description. This is a problem when using code blocks and goes directly against the reason to use code blocks.

Steps to reproduce

You can skip A by using the attached zip file which contains the necessary files.
reproduce-files.zip

A. We need the following steps (1->3) to setup a demo environment.

  1. Create a model file dummy_model.sql with the following content:
select
    'foo' as first_column
  1. Create a yaml file dummy_model.yml with the following content:
version: 2

models:
  - name: dummy_model
    description: "" # Let's keep this line out of scope, as you probably never want to use upstream descriptions here.
    columns:
      - name: first_column
        description: "{{ doc('dummy_model__first_column') }}"
  1. Create a md file dummy_model.md with the following content:
{% docs dummy_model__first_column %}

The description about the `first column` model! 

{% enddocs %}
  1. Create a second model file second_dummy_model.sql with the following content:
select
    *
from {{ ref('dummy_model') }}

B. Now we can execute the following commands to generate the model yaml (using upstream descriptions).

dbt compile
dbt run-operation generate_model_yaml --args '{"model_names": ["second_dummy_model"], "upstream_descriptions": true}'

Expected results

The generated yaml file should contain the same column descriptions as the upstream model. In this case, this would need to be "{{ doc('dummy_model__first_column') }}".
Full expected result would be:

version: 2

models:
  - name: second_dummy_model
    description: ""
    columns:
      - name: first_column
        description: "{{ doc('dummy_model__first_column') }}"

Actual results

However, the result is the "compiled" description as you can see below:

version: 2

models:
  - name: second_dummy_model
    description: ""
    columns:
      - name: first_column
        description: "The description about the `first column` model!"

Screenshots and log output

Not required.

System information

Not required.

Are you interested in contributing the fix?

Certainly, but I can't find a way to get the original description. Couldn't find it in the used graph object myself, so hopefully someone can lend a hand here! Asked it in the #advice-dbt-for-power-users channel on Slack as well with this post.

@diegodewilde diegodewilde added the bug Something isn't working label Jan 10, 2023
@wtfzambo
Copy link

wtfzambo commented Mar 9, 2023

Absolutely would love this feature.

However, I'm afraid that the inherited description comes from the graph object, and not from a parsing of the parent yml files, thus returning the actual description and not the macro.

I don't know if it would be possible to obtain what you're looking for. Not using pure dbt macros anyway.

@github-actions
Copy link

github-actions bot commented Sep 6, 2023

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 comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Sep 6, 2023
@github-actions
Copy link

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2023
@ian-fahey
Copy link

This call is coming from inside the house (dbt internal data team) and I also think this functionality would be incredible as I carry dozens of field descriptions from one rev rec model through the next five.

@shelly-leaflink
Copy link

Hi! Would love to inherit doc blocks instead of the description itself. Any chance of this being worked on in the near future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

4 participants