semvec/pypi-packages huggingface dataset:
dbt-buddy 0.1.0
AI-based documentation for dbt-models
Requires Python: >=3.9
Keywords: AI-documentation, LLM, YandexGPT, dbt

# dbt-buddy
# Autogenerated documentation for dbt-models using YandexGPT LLM
 `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](https://cloud.yandex.ru/en/services/yandexgpt).

## Installation

1. Install uv if you haven't already:
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

2. Clone the repository and navigate to the project directory:
```bash
git clone <repository-url>
cd dbt-buddy
```

3. Install dependencies:
```bash
uv sync
```

## Prerequisites
1. 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](https://cloud.yandex.com/en/docs/iam/concepts/authorization/api-key).
   - `CATALOG_ID=<catalog identifier>` - Yandex Cloud catalog ID is a part of [API request](https://yandex.cloud/en/docs/yandexgpt/quickstart).

## Available commands
1. `document` - generates YAML-based documentation with AI-proposed columms description.

### document
You can create documentation by simply running the command:
```bash
$ buddy document --model <dbt-model name>
```
**The result** will be a text string in the console, formatted in a documentation format acceptable for dbt.

#### CLI Options
1. `-m <model_name>`, `--model <model_name>`(**required**). The name of existing dbt-model.
2. `--project-dir`. The path to directory with dbt_project.yml. Default is the current working directory.
3. `--profiles-dir`. The path to directory with profiles.yml. Default is the current working directory.
4. `-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.
5. `-e`, `--examples`. If specified, YandexGPT will try to add column's possible accepted values (especially relevant if the SQL-query explicitly specifies values with the `CASE` statement).
6. `-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:
```bash
$ buddy document --help
```