0
0
dbtdata~10 mins

Column descriptions in dbt - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Column descriptions
Define model SQL
Add column descriptions in schema.yml
Run dbt docs generate
View docs site
See column descriptions in docs
This flow shows how to add descriptions to columns in dbt models and view them in generated documentation.
Execution Sample
dbt
models/my_model.sql:
select id, name, created_at from source_table

schema.yml:
models:
  - name: my_model
    columns:
      - name: id
        description: "Unique identifier"
      - name: name
        description: "Name of the entity"
This code defines a model selecting columns and adds descriptions for those columns in the schema.yml file.
Execution Table
StepActionFile AffectedResult
1Write SQL model selecting columnsmodels/my_model.sqlModel created with columns: id, name, created_at
2Add column descriptions in schema.ymlmodels/schema.ymlDescriptions added for id and name columns
3Run 'dbt docs generate'Command lineDocumentation site generated with column descriptions
4Open docs site in browserBrowserColumn descriptions visible under my_model columns
5Check column without descriptionDocs sitecreated_at shows no description (empty)
💡 All columns with descriptions appear in docs; columns without descriptions show empty.
Variable Tracker
VariableStartAfter Step 2After Step 3Final
model_columns[][id, name, created_at][id, name, created_at][id, name, created_at]
column_descriptions{}{"id": "Unique identifier", "name": "Name of the entity"}{"id": "Unique identifier", "name": "Name of the entity"}{"id": "Unique identifier", "name": "Name of the entity"}
docs_generatedFalseFalseTrueTrue
Key Moments - 2 Insights
Why does the created_at column show no description in the docs?
Because in the schema.yml file, only id and name columns have descriptions. created_at was not given a description, so it appears empty in the docs (see execution_table step 5).
Do column descriptions affect the SQL model output?
No, descriptions only add metadata for documentation. The SQL model output remains the same (see execution_table step 1 and 2).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step are column descriptions added?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Check the 'Action' column in execution_table rows for when descriptions are added.
According to variable_tracker, what is the value of docs_generated after step 3?
AFalse
BUndefined
CTrue
DNull
💡 Hint
Look at the docs_generated row in variable_tracker after step 3.
If you add a description for created_at in schema.yml, what changes in the docs?
Acreated_at column will show its description
BNo change, descriptions are ignored
CModel SQL will change
DDocs site will fail to generate
💡 Hint
Refer to key_moments about columns without descriptions and their effect on docs.
Concept Snapshot
dbt Column Descriptions:
- Add descriptions in schema.yml under models > columns
- Descriptions do not affect SQL output
- Run 'dbt docs generate' to build docs
- View descriptions in docs site
- Columns without descriptions show empty
Full Transcript
In dbt, you write SQL models selecting columns. To add descriptions for these columns, you edit the schema.yml file and list each column with a description. Running 'dbt docs generate' creates a documentation site where these descriptions appear. Columns without descriptions show no text in docs. Descriptions help explain columns but do not change the SQL output. This process helps teams understand data better by reading docs.