Skip to content

[Feature] Read .sql files for docs blocks #12798

@arjobsen

Description

@arjobsen

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

Currently only .md files are read and searched for docs blocks. I would like to be able to write docs blocks at the tops of our models. For example:

my_model.sql

{% docs my_model %}
The description of my model
{% enddocs %}
select *
from my_table

_marts.yml

models:
  - name: my_model
    description: "{{ doc('my_model') }}"

So I propose that dbt generate docs also scans .sql files for docs blocks. Or that maybe a new option can be set in dbt_project.yml. E.g. docs-extentions: [".md", ".sql"]

Describe alternatives you've considered

I've considered using the Python module dbt_docstring. But that would involve another step in the development process, and/or pre-commit hooks etc. I'd prefer to make use of the functionality of dbt which is already there: docs blocks.

Who will this benefit?

Developers who want to see (and update) the model's description while editing the model.

Are you interested in contributing this feature?

No

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions