# 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).
## 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).
2. `dbt-buddy` uses dbt-macros from [dbt-codegen](https://github.com/dbt-labs/dbt-codegen) package. It is necessary to install it by simply adding it to project's `packages.yml` file:
```
packages:
- package: dbt-labs/codegen
version: 0.12.1
```
Then run command:
```bash
$ dbt deps
```
## 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
```
Raw data
{
"_id": null,
"home_page": null,
"name": "dbt-buddy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "dbt, LLM, YandexGPT, AI-documentation",
"author": "Egor Popov",
"author_email": "Egor.POPOV@uni.rest",
"download_url": "https://files.pythonhosted.org/packages/94/9d/16602f300c129ba4ed36ecfd8ea3ba978734e2f1feeaca407f49a177ceb4/dbt_buddy-0.0.3.tar.gz",
"platform": null,
"description": "# dbt-buddy\n# Autogenerated documentation for dbt-models using YandexGPT LLM\n `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).\n\n## Prerequisites\n1. You need to create `.env` file in the dbt-project working directory and add the following secret:\n - `API_KEY=<secret key>` - required to access [YandexGPT API](https://cloud.yandex.com/en/docs/iam/concepts/authorization/api-key).\n - `CATALOG_ID=<catalog identifier>` - Yandex Cloud catalog ID is a part of [API request](https://yandex.cloud/en/docs/yandexgpt/quickstart).\n2. `dbt-buddy` uses dbt-macros from [dbt-codegen](https://github.com/dbt-labs/dbt-codegen) package. It is necessary to install it by simply adding it to project's `packages.yml` file:\n```\npackages:\n - package: dbt-labs/codegen\n version: 0.12.1\n```\nThen run command:\n```bash\n$ dbt deps\n```\n## Available commands\n1. `document` - generates YAML-based documentation with AI-proposed columms description.\n\n### document\nYou can create documentation by simply running the command:\n```bash\n$ buddy document --model <dbt-model name>\n```\n**The result** will be a text string in the console, formatted in a documentation format acceptable for dbt.\n#### CLI Options\n1. `-m <model_name>`, `--model <model_name>`(**required**). The name of existing dbt-model.\n2. `--project-dir`. The path to directory with dbt_project.yml. Default is the current working directory.\n3. `--profiles-dir`. The path to directory with profiles.yml. Default is the current working directory.\n4. `-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.\n5. `-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).\n6. `-v`, `--verbose`. If specified, the response from the YandexGPT API will be displayed in the console.\n\nYou can get the full list of existing options by running the command:\n```bash\n$ buddy document --help\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "AI-based documentation for dbt-models",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [
"dbt",
" llm",
" yandexgpt",
" ai-documentation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "205581879838c109d284c882d3f0a0e7a956bd91bbe478c839acc170848691b7",
"md5": "fb8597266695d5a0b041ce43c4f72bb5",
"sha256": "ff7a0b8b1030bcb1a966f5b6e3b1a13626a88df9346e0700692cd148d80e77bb"
},
"downloads": -1,
"filename": "dbt_buddy-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb8597266695d5a0b041ce43c4f72bb5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 12095,
"upload_time": "2024-06-14T11:45:53",
"upload_time_iso_8601": "2024-06-14T11:45:53.340498Z",
"url": "https://files.pythonhosted.org/packages/20/55/81879838c109d284c882d3f0a0e7a956bd91bbe478c839acc170848691b7/dbt_buddy-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "949d16602f300c129ba4ed36ecfd8ea3ba978734e2f1feeaca407f49a177ceb4",
"md5": "4d34f903d35c55b8b756cb9d04d5c95c",
"sha256": "feab7798e5671911a3fdfd3876b11b3c6d89230ee86021f0f3b6bf802079b553"
},
"downloads": -1,
"filename": "dbt_buddy-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "4d34f903d35c55b8b756cb9d04d5c95c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 9810,
"upload_time": "2024-06-14T11:45:54",
"upload_time_iso_8601": "2024-06-14T11:45:54.734875Z",
"url": "https://files.pythonhosted.org/packages/94/9d/16602f300c129ba4ed36ecfd8ea3ba978734e2f1feeaca407f49a177ceb4/dbt_buddy-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-14 11:45:54",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dbt-buddy"
}