Skip to main content

AI powered DBT helper application

Project description

DBT AI

An application that allows AI powered DBT development and recommendations for your DBT models.

Features

  • Scans all dbt models and generates a report containing recommendations for each model
    • By default only basic recommendations are provided
    • Ability to request for more advanced recommendations
  • Create DBT models by using AI prompts
  • Lists dbt models that are missing associated metadata e.g. in a schema.yml file or equivalent
  • DBT model lineage description is listed in the terminal (more features coming soon)

Installation

First time installation:

pip install dbt-ai

To upgrade to the latest version:

pip install dbt-ai --upgrade

To install a specific version:

pip install dbt-ai==<version>

Replace <version> with your desired version e.g. 0.2.0. You can view available versions in the Releases section of this repo or on our Pypi page. WARNING: This is an early phase application that may still contain bugs

Prerequisites

  • In order to benefit from AI features, you need your own OpenAI API Key with the initial version of this application
    • Once you sign up to OpenAI you can create an API key.
    • Trial version gives you a certain amount of credits allowing you to make many API calls
    • Usage beyond the trial credits require billing details. API usage pricing provides more info
  • Ideally you already have dbt project to test this out on
  • Python 3.10 or greater is required

Usage

Setting up your API key is needed for all the AI features

  • Set up your OpenAI API key as an environment variable:
export OPENAI_API_KEY="your_openai_api_key"

Generate Recommendations (AI)

This feature will generate the recommendation report and also inform you about any models missing metadata

Basic Usage

The default setting is to provide basic recommendations

  1. Run the application passing in the path to your dbt project:
dbt-ai -f path/to/dbt/project

For example, if you are already inside your dbt project directory, you can run:

dbt-ai -f .

Available Settings

  • Database: specify which database system your dbt models are written for. Default: snowflake
    • -d / --database
    • Available values: snowflake, postgres, redshift, bigquery
    • Usage example:
    dbt ai -f . -d snowflake
    
  • Advanced Recommendations: Request for advanced recommendations. Default: No setting defaults to basic recommendations
    • -a / --advanced-rec
    • Available values: Only flag required
    • Usage example:
    dbt ai -f . -a 
    
    Or
    dbt ai -f . --advanced-req
    

Please allow some time for the AI model to process your dbt models. The application will process all dbt model files in your project and generate an HTML report with suggestions for each model. The report will be saved as dbt_model_suggestions.html within the dbt project directory. Upon generation of the report, it will be opened in a new browser tab.

Create DBT Models from prompt (AI)

This feature lets you specify a prompt, which creates AI generated DBT model files in the models/ directory of the specified dbt project. The AI model has access to your sources.yml file, if you wish to refer to any sources in your prompt. Being specific will provide better results.

  1. Run the application with the --create-models flag to specify the prompt you wish to use to create your DBT models
dbt-ai -f path/to/dbt/project --create-models 'your prompt goes here'

Here is an example:

dbt-ai -f . --create-models 'Write me a model that uses all the sources available in sources.yml and joins them together using the id column'

Generated Report

This shows an example of a report generated from a DBT project containing 3 models

Contributing

We welcome contributions to the project! Please feel free to open issues or submit pull requests with your improvements and suggestions.

See CONTRIBUTING.md to get started and develop in this repo.

Project details


Download files

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

Source Distribution

dbt-ai-0.2.20.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

dbt_ai-0.2.20-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file dbt-ai-0.2.20.tar.gz.

File metadata

  • Download URL: dbt-ai-0.2.20.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for dbt-ai-0.2.20.tar.gz
Algorithm Hash digest
SHA256 adb1200aa02cb3c6fb2dfe279f7d7148b1991baaea151f3cc1f23a0a281c1e12
MD5 ed394e3431e5f1e056a65aedc53e96e7
BLAKE2b-256 7a2349d72097fe86ed0eb7c458d3ccc26e352616aab059baeecb00bbee04ae67

See more details on using hashes here.

File details

Details for the file dbt_ai-0.2.20-py3-none-any.whl.

File metadata

  • Download URL: dbt_ai-0.2.20-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for dbt_ai-0.2.20-py3-none-any.whl
Algorithm Hash digest
SHA256 f8b7714fdaa48a74b3a823e0a0f8d6b4801e20d6b5748ddb85c74c27afb71d3c
MD5 6bd6b6f9b4c5053f7fd3ed1703eb90ec
BLAKE2b-256 3cc7dd304449582d5d689f526c27825f20dc3a1ad2d90f16585e9b8b894dbdad

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