In this lesson, you will learn how to improve your team’s data discoverability by adding descriptive business metadata directly to your dbt model columns.
As data pipelines grow, columns like status_id or val_amt often become cryptic to business users. While lineage graphs show where data comes from, they don't explain what the values actually represent. By utilizing the description field in your schema.yml files, you turn your code repository into a searchable, self-documenting data dictionary.
Using Descriptions in YAML
To implement this, you define your documentation within your model’s YAML configuration. This approach allows you to bridge the gap between technical data engineering and business context.
version: 2
models:
- name: stg_orders
description: "Staging table containing raw transactional data from the ERP."
columns:
- name: order_id
description: "Primary key for the order. Unique identifier across all regions."
- name: status_code
description: "Current state of the order: 1 = Pending, 2 = Shipped, 3 = Delivered, 4 = Cancelled."
Why This Matters
When you run dbt docs generate, dbt parses these descriptions and renders them into your web-based documentation site. Instead of asking a data engineer "What does status_code mean?", a stakeholder can simply look up the model in the documentation portal and read the definition.
Best Practices for Documentation
- Focus on Business Logic: Avoid repeating technical details (e.g., "This is an integer"). Instead, describe the business meaning (e.g., "The net total after discounts and tax").
- Standardize Definitions: If a column exists in both your staging and mart layers, try to keep the description consistent so users have a unified understanding of the metric.
- Use Markdown: You can include links, bullet points, or bold text within these strings to make the documentation more readable for non-technical users.
By embedding this metadata, you treat documentation as code, ensuring it stays version-controlled and evolves alongside your pipeline transformations.
Key Takeaway: Implementing column-level descriptions transforms your dbt documentation from a technical reference into a collaborative business dictionary, empowering users to understand and trust the data independently.