Mage Pro (auto-generate and serve)
Only in Mage Pro.Try our fully managed solution to access this advanced feature.
- Set the environment variable
ENABLE_DBT_DOCS=true. - Mage will discover dbt projects under
/dbt, generate docs (if missing), and serve them. - Open a project’s docs from the UI:
- In File Browser, right-click the dbt project folder and click “Open dbt docs”.
- The docs are available at
/dbt_docs/[dbt_project_name]. - The path
/dbt_docsshows the status for all dbt projects (running port, errors, etc.).
dbt docs generate.
Generating docs
Before enabling dbt docs in production, we need to make sure the static files for the docs are generated.- Configure the dbt super project.
- Your dbt projects should be in the
/path/to/<mage_project>/dbtdirectory.- The
/dbtdirectory will serve as a “super-project” for all of your dbt projects in your Mage project.
- The
- Make sure the
/.../<mage_project>/dbtdirectory has the filesdbt_project.yml,profiles.yml, andpackages.yml. These files are needed for dbt to create docs for all the projects within this directory.dbt_project.ymlprofiles.yml: The config in this file is not used, but it needs to still be a valid output target in order for the project to compile.packages.yml: Add all projects that you want to be included in the documentation.
- Your dbt projects should be in the
- Generate the dbt docs
Terraform
GCP
In the mage-ai-terraform-templates repository, the terraform templates for GCP have commented out resources at the end of the following files for enabling the dbt docs service. Once you uncomment those resources, you should see an outputdocs_service_ip at the end of terraform apply with the IP to access the dbt docs in the cloud.