persist_docs
- Models
- Sources
- Seeds
- Snapshots
dbt_project.yml
models/<modelname>.sql
{{ config(persist_docs={"relation": true, "columns": true}) }}select ...
Definition
Optionally persist resource descriptions as column and relation comments in the database. By default, documentation persistence is disabled, but it can be enabled for specific resources or groups of resources as needed.
▶Changelog
Support
The persist_docs
config is supported on all core dbt plugins: BigQuery,
Redshift, Snowflake, and Postgres. Some databases impose limitations on the
types of descriptions that can be added to database objects. At present, the
persist_docs
flag has the following known limitations:
- Column-level comments are not supported on Snowflake views
Usage
Documenting columns and relations
Supply a description for a model:
models/schema.yml
version: 2models:- name: dim_customersdescription: One record per customercolumns:- name: customer_iddescription: Primary key
Enable persist_docs
for columns and relations in your project:
dbt_project.yml
models:+persist_docs:relation: truecolumns: true
Run dbt and observe that the created relation and columns are annotated with your descriptions: