DBT Autodoc Documentation
dbt-autodoc is the ultimate tool for Automated Documentation and Logging for your dbt projects. It combines the power of Google Gemini AI with a robust Database Logging system to ensure your documentation is always up-to-date, accurate, and auditable.
🌟 Why dbt-autodoc?
- 🤖 Automatic AI Documentation: Generate comprehensive descriptions for your tables and columns automatically.
- 💾 Database Logging & History: Every description is stored in a database (
duckdborpostgres). This acts as a "Source of Truth" and provides a full history of changes. - 🔄 Full Synchronization: Seamlessly integrates with
dbt-osmosisto keep your YAML files in sync with your SQL models. - 🔒 Protect Manual Work: Respects human-written documentation. If you write it, we lock it.
- 👥 Team Ready: Use Postgres to share documentation cache across your entire team.
🛠️ Setup
-
Install:
pip install dbt-autodoc
-
Configuration: Run
dbt-autodoc --helpto generatedbt-autodoc.yml. Important: Editcompany_contextin this file to give the AI knowledge about your business logic. -
Environment Variables:
GEMINI_API_KEY=your_api_key_here POSTGRES_URL=postgresql://user:pass@host:port/db (optional)
📋 Recommended Workflow
For the best results, follow this step-by-step workflow to ensure accuracy and control:
-
Preparation: Update your dbt project, generate the manifest, and context.
dbt run && dbt docs generate # Edit dbt-autodoc.yml with company_context
-
Sync Structure (No AI): Regenerate YAML files to match the SQL models. This ensures all new columns are present.
dbt-autodoc --regenerate-yml -
Generate Model Descriptions (YAML): Generate AI descriptions for your models (tables/views).
dbt-autodoc --generate-docs-model-ai --model-path models/staging
-
Manual Review (Important): Open your YAML files. Review the structure and any existing descriptions. If you manually update a description here, it will be protected from AI overwrites in the next step.
-
Generate Model Column Descriptions (YAML): Use AI to fill in the missing column descriptions.
dbt-autodoc --generate-docs-model-columns-ai --model-path models/staging
-
Propagate & Save: Run inheritance rules on the entire dbt project, then run the tool again to save the final state (including inherited descriptions) to the database.
dbt-autodoc --regenerate-yml-with-inheritance dbt-autodoc --generate-docs-model-columns-ai --model-path models/staging
-
Next Layer: Repeat steps 2-6 for
models/intermediate,models/marts, etc.
🚀 Quick Start (Automated)
If you trust the process and just want to run everything at once:
dbt-autodoc --generate-docs-ai
🧠 How the AI Works
When generating a description for a column or table, the AI considers multiple inputs to produce the most accurate result:
- Company Context: The high-level business logic defined in your config.
- Model SQL: The actual code of the model being documented.
- Existing Descriptions: Any existing documentation or comments in the file.
- Upstream Logic: (Implicitly via Osmosis inheritance) Context from upstream models.
It synthesizes all these inputs to write a concise, technical description.
📖 Arguments Reference
| Argument | Description |
|---|---|
--regenerate-yml |
Structure Only. Regenerate YAML files from dbt models. Does not sync to DB or call AI. |
--regenerate-yml-with-inheritance |
Structure + Inheritance. Regenerate YAML files with inheritance enabled. Use this to propagate descriptions from upstream models. |
--model-path |
Restrict processing to a specific directory (e.g. models/staging). |
--generate-docs-model-ai |
Generate model descriptions in .yml files using AI. |
--generate-docs-model-columns-ai |
Generate column descriptions in .yml files using AI. |
--generate-docs-model |
Sync model descriptions in .yml files from cache (no AI). |
--generate-docs-model-columns |
Sync column descriptions in .yml files from cache (no AI). |
--generate-docs-ai |
🔥 Full Auto. Runs the complete workflow: Model generation, YAML sync, and Column generation using AI. |
--generate-docs |
🔄 Full Sync. Runs the complete workflow using only the database cache (no AI). |
--cleanup-db |
Reset Database. Wipes the description cache and history. |
--concurrency |
Max threads for AI/DB requests (default: 10). |
--sort-yml |
Sort keys in YAML files (name, description, columns for models; name, description for columns). |
📄 License
MIT License - see LICENSE for details.
🙏 Attribution
Brought to you by JustDataPlease.
Metadata
Release files for dbt-autodoc 1.0.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dbt_autodoc-1.0.21.tar.gz | 19.9 kB | Without provenance | Details for dbt_autodoc-1.0.21.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dbt_autodoc-1.0.21-py3-none-any.whl | Python 3 | none | any | Details for dbt_autodoc-1.0.21-py3-none-any.whl |
Total release size: 36.1 kB
Release files / dbt_autodoc-1.0.21.tar.gz
| Download URL | dbt_autodoc-1.0.21.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
251b30a3f0cb1c6912d179a13d7bf5f81fd10046d470fe87df2c1d502277dac3
|
|
BLAKE2b-256 checksum How to use checksums |
ed64e9720f325006be41fd8ff54d07961425b912fea16853fa0b7404599239e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Release files / dbt_autodoc-1.0.21-py3-none-any.whl
| Download URL | dbt_autodoc-1.0.21-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
200c366f69d74e3d46331bb5ba01ee71f8e5399eca4a3d2478aee18db64ac3c9
|
|
BLAKE2b-256 checksum How to use checksums |
129eff52c9d443f7230c8c8ce30241f1c0421fd803b38baaa2d491e254d8b956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Security for dbt-autodoc 1.0.21
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.