dbt-buddy
is a python package with CLI that allows automatically create YAML-based documenation for existing dbt-model. Built-in method fill_yaml_with_column_description()
will add columns description in Russian language using LLM-model YandexGPT.
- You need to create
.env
file in the dbt-project working directory and add the following secret:API_KEY=<secret key>
- required to access YandexGPT API.CATALOG_ID=<catalog identifier>
- Yandex Cloud catalog ID is a part of API request.
dbt-buddy
uses dbt-macros from dbt-codegen package. It is necessary to install it by simply adding it to project'spackages.yml
file:
packages:
- package: dbt-labs/codegen
version: 0.12.1
Then run command:
$ dbt deps
document
- generates YAML-based documentation with AI-proposed columms description.
You can create documentation by simply running the command:
$ buddy document --model <dbt-model name>
The result will be a text string in the console, formatted in a documentation format acceptable for dbt.
-m <model_name>
,--model <model_name>
(required). The name of existing dbt-model.--project-dir
. The path to directory with dbt_project.yml. Default is the current working directory.--profiles-dir
. The path to directory with profiles.yml. Default is the current working directory.-s
,--save
. If specified, the generated documentation is saved in a YAML-file in the same directory and with the same name as the specified model.-e
,--examples
. If specified, YandexGPT will try to add column's possible accepted values (especially relevant if the SQL-query explicitly specifies values with theCASE
statement).-v
,--verbose
. If specified, the response from the YandexGPT API will be displayed in the console.
You can get the full list of existing options by running the command:
$ buddy document --help