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

Docs blocks don't work in exposures - 'doc' is undefined #2913

Closed
1 of 5 tasks
joellabes opened this issue Nov 25, 2020 · 1 comment · Fixed by #2920
Closed
1 of 5 tasks

Docs blocks don't work in exposures - 'doc' is undefined #2913

joellabes opened this issue Nov 25, 2020 · 1 comment · Fixed by #2920
Labels
bug Something isn't working good_first_issue Straightforward + self-contained changes, good for new contributors!

Comments

@joellabes
Copy link
Contributor

Describe the bug

Exposures containing a docs block don't compile in dbt Cloud because doc is undefined.

Steps To Reproduce

Create an exposure which references a doc block:

exposures:
  - name: licence_status_stats
    description: '{{ doc("licence_status_stats_descr") }}'
    type: dashboard
...
{% docs licence_status_stats_descr %}

A high-level answer to the question: _How many students/departments/schools/countries use EP?_
----------------------------------------------------------------------------------------------

You can find the definitions of each licence status [here](https://sites.google.com/educationperfect.com/epeeps-hub/must-read/data-definitions). 

{% enddocs %}

Expected behavior

The docs block to be rendered

Screenshots and log output

Compilation Error Failed to render models/exposures/licence_status_stats.yml from project educationperfect: Compilation Error Could not render {{ doc("licence_status_stats_descr") }}: 'doc' is undefined

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

0.18.1

The operating system you're using:
dbt Cloud
The output of python --version:

Additional context

Add any other context about the problem here.

@joellabes joellabes added bug Something isn't working triage labels Nov 25, 2020
@jtcohen6 jtcohen6 removed the triage label Nov 25, 2020
@jtcohen6
Copy link
Contributor

jtcohen6 commented Nov 25, 2020

Nice find @joellabes! This was definitely an oversight for v0.18.1; I imagine the fix to be quite straightforward, and I'd love to get it into v0.19.0.

In particular, I think a prospective contributor may find it fruitful to:

  1. Add exposures to the list of documentable resources:
    https://github.com/fishtown-analytics/dbt/blob/fec0e31a25d5b922cb1833cffcb5095eb4ee642b/core/dbt/node_types.py#L40-L49

  2. Add exposures as a step within process_docs, after first defining _process_docs_for_exposure, with the existing methods as a helpful guide:
    https://github.com/fishtown-analytics/dbt/blob/fec0e31a25d5b922cb1833cffcb5095eb4ee642b/core/dbt/parser/manifest.py#L625-L649

  3. With the prior two pieces in place, when the contributor goes to test their docs-block-using exposure, they will stumble upon a new error message like: Invalid exposures config... Additional properties are not allowed ('original_file_path', 'package_name', 'yaml_key' were unexpected). After some initial trepidation, they may be delighted to learn that they need change only one more line of code:

class UnparsedExposure(HasYamlMetadata, Replaceable):

That's just some wild speculation, though :)

@jtcohen6 jtcohen6 added the good_first_issue Straightforward + self-contained changes, good for new contributors! label Nov 25, 2020
@jtcohen6 jtcohen6 added this to the Kiyoshi Kuromiya milestone Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good_first_issue Straightforward + self-contained changes, good for new contributors!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants