Metadata-Version: 2.1
Name: dbt-buddy
Version: 0.1.0
Summary: AI-based documentation for dbt-models
Author-email: Egor Popov <Egor.POPOV@uni.rest>
License-File: LICENSE
Keywords: AI-documentation,LLM,YandexGPT,dbt
Requires-Python: >=3.9
Requires-Dist: click<8.1.4,>=7.0
Requires-Dist: dbt-core<1.7,>1.6
Requires-Dist: dbt-postgres<1.7,>1.6
Requires-Dist: pyfiglet<1.0.0
Requires-Dist: python-dotenv==1.0.1
Requires-Dist: yandex-cloud-ml-sdk>=0.13.1
Provides-Extra: dev
Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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
```
