Skip to main content

Document tool for dbt

Project description

Downloads

dbtdoc

Create dbt document from SQL files

Install

pip install dbtdoc

Features

Currently support document for following

  • model
  • seed
  • common macro and test
  • materialization

Usage

Prepare

dbtdoc will extract the information from SQL comment block /* */ for each macro and test.

A typical comment block will look like this:

/*
This information will be used in dbt document.
Information insides dbt block is used to create dbt yml file 
```dbt
arguments:
  - name: arg01
    type: string
    description: the first argument
```
* any thing after `dbt` block will be ignored
*/

By default, every macro, tests will be displayed in dbt document navigator. Remove item from document by adding following setting.

/*
this will no be displayed in dbt doc
```dbt
docs:
   show: false
```
*/

Usage

Default syntax is below:

dbtdoc [-h] [-v] [-c] [-b] [-d DOC] [-u] [-o] [-p PREFIX] [-r] [-s SCHEMA] [-S] [-D DEBUG] [-T TARGET]

By default dbtdoc scans the default DBT project directory (consulting the DBT_PROJECT_DIR environment variable if set or the current directory if the environment variable is unset) and all of its sub-folders for sql files, creates 2 file dbt_schema.yml and docs.md for each folder (the names of the file could be changed by .dbtdoc) If dbtdoc finds a dbt_project.yml file in the target folder, it will only scan the folders defined by model-paths, macro-paths, and test-paths in that configuration file.

Parameter -o can be used to limit dbtdoc to only process the root folder and ignore its sub-folders.

Note: when error happens, use the command with -D DEBUG for more details about the errors.

Configuration

A configuration file .dbtdoc is searched in the current folder. A typical configuration file looks like this:

schema_file: "dbt_schema.yml"
doc_file: "docs.md"
quote_string: true

If the configuration does not exists, default values are used.

SCHEMA_FILE = "dbt_schema.yml"
DOC_FILE = "docs.md"
QUOTE_STRING = False

Other

This project was inspired by dbt_docstring.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

dbtdoc-0.2.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file dbtdoc-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dbtdoc-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for dbtdoc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e089b4be7b0d1a3645433cd9cf37673da30ebc0f964086611a4ba476e8dc49dd
MD5 a9a2f70a9d6859598ccf472d2a7019fa
BLAKE2b-256 ba6bd7a88c2d478dad1d7cd96819201d0d2a37af6eb3b235549d85df05525c66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page