DT7: dbt: transformations as tested code

Lesson 3 of 5 · reading 15–25 minutes; practice and project time is on the module page

Documentation and lineage

🎯You'll be able to

Document models and columns next to the code, generate a documentation site with lineage, and write descriptions people can act on.

🏠The everyday picture

Medicine packs carry their leaflet inside the box, written when the medicine was made. A separate leaflet kept in a cupboard would soon describe an older version.

📘What it really is

yaml - name: net_amount_paise description: The amount if the line was delivered, otherwise 0. Sum this for net revenue.

📝A worked example

Input: in the solution, run dbt docs generate --profiles-dir ..

Expected output: Catalog written to .../warehouse/target/catalog.json, and target/index.html exists. Opening the site with dbt docs serve --profiles-dir . shows mart_daily_sales with its description, columns and a lineage graph back to clean.order_lines.

🌍Where it's used

📝Case scenario

A bank's regulator asked how a reported liquidity figure was calculated. The team spent two weeks tracing scheduled queries by hand. A year later, with the figure built in dbt, the answer was a lineage graph and the descriptions of eight models, exported in an hour.

🖱️Try it

Pick three columns in the starter's marts that have no description and write one for each, saying what it includes, what it leaves out and its unit. Success: someone outside the team could use each column correctly from your sentence.

⚠️Common mistakes

🛠️For your project

Project 2 test 10 checks every mart model and every column in the marts has a description.

✅Quick check

What should a column description say?

Show the answer

What it means, what it includes and leaves out, and its unit.

What question does lineage answer?

Show the answer

Where a table's data comes from, and what depends on it.

← PreviousTests that run on every build
ProLearners Assist