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

[CT-3067] [Bug] Docs blocks don't work in model versions #8540

Closed
2 tasks done
Tracked by #7979
Gonzalo933 opened this issue Sep 1, 2023 · 4 comments · Fixed by #8771
Closed
2 tasks done
Tracked by #7979

[CT-3067] [Bug] Docs blocks don't work in model versions #8540

Gonzalo933 opened this issue Sep 1, 2023 · 4 comments · Fixed by #8771
Assignees

Comments

@Gonzalo933
Copy link

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Currently, .yml with model definitions do not support using doc blocks inside the fields.

I believe this could be similar to #2913

Commenting or removing the doc block removes the error.

Expected Behavior

I would expect the doc to be loaded as a string.

Steps To Reproduce

with this model configuration:

version: 2

models:
  - name: working_model
        columns:
          - name: column_id
            description: '{{ doc("column_id_doc") }}'
  - name: error_model
    description: my description
    latest_version: 1
    versions:
      - v: 1
        config:
          alias: my_alias
        columns:
          - name: column_id
            description: '{{ doc("column_id_doc") }}'
      - v: 2
        columns:
          - name: other_id

DBT cloud Raises an error when trying to run the tests for the model.

Compilation Error
  Could not render {{ doc("column_id_doc") }}: 'doc' is undefined

Also, running dbt docs generate creates the right documentation for working_model and an empty string for the column column_id in the model error_model

Relevant log output

No response

Environment

dbt cloud

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

@Gonzalo933 Gonzalo933 added bug Something isn't working triage labels Sep 1, 2023
@github-actions github-actions bot changed the title [Bug] Docs blocks don't work in model versions [CT-3067] [Bug] Docs blocks don't work in model versions Sep 1, 2023
@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 5, 2023

Thanks @Gonzalo933! I was able to reproduce using the example you've provided, and I agree that the intended behavior is to support docs blocks for column-level descriptions at all levels.

Basically, while docs blocks are supported in the description field specified for columns at the top level, it isn't supported when specified for columns on a specific version:

models:
  - name: versioned_model
    description: '{{ doc("any_doc_block") }}'  # this works
    columns:
      - name: id
        description: '{{ doc("any_doc_block") }}'  # this works
    versions:
      - v: 1
        columns:
          - name: id
            description: '{{ doc("any_doc_block") }}'  # this does NOT work

@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 8, 2023

@aranke
Copy link
Member

aranke commented Sep 18, 2023

Next step: @aranke to check if fix for #8509 fixes this issue as well.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Oct 2, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants