dbt-labs / dbt-labs/dbt

[Feature] Support doc block in meta

Open
#10,403 2 comments 0 reactions 0 assignees View on GitHub
engine:v1 status:triage type:feature
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this your first time submitting a feature request?

- [X] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [X] I have searched the existing issues, and I could not find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

### Describe the feature

Currently experimenting the synchronization of the documentation from DBT to Metabase using the dbt package dbt-metabase, I use the Metabase metadata semantic_type to describe the semantic type of the columns of my models. In order to maintain the documentation of all my models, I have a single .md file where I write all my columns definition because few of them uses the same columns definition. I would like to be able to do the same for the semantic type or any other metadata. Unfortunately, I was expecting the doc block to work well inside a metadata key, but it appears that it's not supported.

What I have:
```
models:
...
columns:
- name: acquisition_timestamp
description: "{{ doc('column_desc_acquisition_timestamp') }}"
meta:
metabase.semantic_type: null
- name: channel_birthday
description: "{{ doc('column_desc_channel_birthday') }}"
meta:
metabase.semantic_type: type/Birthday
```

What I should be able to do:
```
models:
...
columns:
- name: acquisition_timestamp
description: "{{ doc('column_desc_acquisition_timestamp') }}"
meta:
metabase.semantic_type: "{{ doc('column_semtype_acquisition_timestamp') | as_native }}"
- name: channel_birthday
description: "{{ doc('column_desc_channel_birthday') }}"
meta:
metabase.semantic_type: "{{ doc('column_semtype_channel_birthday') }}"
```

Error I get:
`Compilation Error
Could not render {{ doc('column_semtype_channel_birthday') }}: 'doc' is undefined`

The feature I request is to be able to use the doc block inside any metadata key of the meta: block.
Thanks!

### Describe alternatives you've considered

No alternative as far as I know. If the semantic type of a column changes, I have to update it in all my models documentation.

### Who will this benefit?

Anybody that uses metadata.

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.