0
0
dbtdata~5 mins

Generating documentation site in dbt

Choose your learning style9 modes available
Introduction

Generating a documentation site helps you see and share details about your data models and sources in one easy place.

You want to explain your data models to teammates clearly.
You need a quick way to check column descriptions and data sources.
You want to share your data project structure with others.
You want to keep documentation updated automatically as your project changes.
Syntax
dbt
dbt docs generate

dbt docs serve

dbt docs generate creates the documentation files.

dbt docs serve starts a local web server to view the docs in your browser.

Examples
This command builds the documentation site files based on your current dbt project.
dbt
dbt docs generate
This command opens a local website so you can browse your documentation interactively.
dbt
dbt docs serve
This runs both commands one after the other to build and then view the docs immediately.
dbt
dbt docs generate && dbt docs serve
Sample Program

This example shows how to generate and then serve your dbt documentation site so you can open it in a browser and explore your data models and sources.

dbt
# Step 1: Generate the documentation files
!dbt docs generate

# Step 2: Serve the documentation site locally
!dbt docs serve
OutputSuccess
Important Notes

Make sure your dbt project has descriptions in your schema.yml files to see useful info in the docs.

You can customize the docs site by adding markdown descriptions to models, columns, and sources.

The docs site updates every time you run dbt docs generate.

Summary

Generating docs creates a website showing your data models and sources.

Use dbt docs generate to build docs and dbt docs serve to view them.

This helps share and understand your data project easily.