I have a markdown file with a table in it and I have another dbt schema.yml file which is used to serve and generate docs. Traditionally I enter the table name and column name and description of the column name in schema.yml but now that I think of I'd want to reference the column names from the md document into the yaml file rather than manually entering.
This is how my doc.md
file looks like
{% docs column_description %}
| COLUMN\_NAME | DESCRIPTION |
| ------------------------------ | ------------------------------------------------------------------------- |
| cycle\_id | Customer cycle\_id(todays start sleep time to next days start sleep time) |
| user\_id | Customers user\_id |
| yes\_alcohol | User consumed alcohol or not |
| blank\_alcohol | User did not answer or user answered "No" |
{% enddocs %}
And, currently, this is how my schema.yml file looks
version: 2
models:
- name: journal_pivot_dev
description: One for for each journal entry of within one customer cycle
columns:
- name: cycle_id
description: Customer cycleid
tests: ¬_null
- not_null:
severity: warn
- name: user_id
description: customer userid
tests:
- not_null:
severity: warn
- name: yes_alcohol
description: User consumed alcohol or not
tests: &values_accepted
- accepted_values:
severity: warn
values: [0,1]
- name: blank_alcohol
description: User did not answer
tests: *values_accepted
What I tried:
version: 2
models:
- name: journal_pivot_dev
description: One for for each journal entry of within one customer cycle
columns:
- name: cycle_id
description: '{{ doc(column_description") }}'
tests: ¬_null
- not_null:
severity: warn
- name: user_id
description: '{{ doc(column_description") }}'
tests:
- not_null:
severity: warn
- name: yes_alcohol
description: '{{ doc(column_description") }}'
tests: &values_accepted
- accepted_values:
severity: warn
values: [0,1]
- name: blank_alcohol
description: '{{ doc(column_description") }}'
tests: *values_accepted
But when I do that the description is not rendering to just cycle_id but it is giving me the whole table in the md file.
I am expecting something like this