Package: dbt-ai
DBT AIAn application that allows AI poweredDBTdevelopment and recommendations for yourDBTmodels.FeaturesScans all dbt models and generates a report containing recommendations for each modelBy default only basic recommendations are providedAbility to request for more advanced recommendationsCreate DBT models by using AI promptsLists dbt models that are missing associated metadata e.g. in aschema.ymlfile or equivalentDBT model lineage description is listed in the terminal (more features coming soon)InstallationFirst time installation:pipinstalldbt-aiTo upgrade to the latest version:pipinstalldbt-ai--upgradeTo install a specific version:pipinstalldbt-ai==<version>Replace<version>with your desired version e.g.0.2.0. You can view available versions in theReleasessection of this repo or on ourPypi page.
WARNING: This is an early phase application that may still contain bugsPrerequisitesIn order to benefit from AI features, you need your own OpenAI API Key with the initial version of this applicationOnce you sign up toOpenAIyou can create an API key.Trial version gives you a certain amount of credits allowing you to make many API callsUsage beyond the trial credits require billing details.API usage pricingprovides more infoIdeally you already have dbt project to test this out onPython 3.10 or greater is requiredUsageSetting up your API key is needed for all the AI featuresSet up your OpenAI API key as an environment variable:exportOPENAI_API_KEY="your_openai_api_key"Generate Recommendations (AI)This feature will generate the recommendation report and also inform you about any models missing metadataBasic UsageThe default setting is to provide basic recommendationsRun the application passing in the path to your dbt project:dbt-ai-fpath/to/dbt/projectFor example, if you are already inside your dbt project directory, you can run:dbt-ai-f.Available SettingsDatabase:specify which database system your dbt models are written for. Default:snowflake-d/--databaseAvailable values:snowflake,postgres,redshift,bigqueryUsage example:dbtai-f.-dsnowflakeAdvanced Recommendations:Request for advanced recommendations. Default: No setting defaults to basic recommendations-a/--advanced-recAvailable values: Only flag requiredUsage example:dbtai-f.-aOrdbtai-f.--advanced-reqPlease 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 themodels/directory of the specified dbt project. The AI model has access to yoursources.ymlfile, if you wish to refer to any sources in your prompt. Being specific will provide better results.Run the application with the --create-models flag to specify the prompt you wish to use to create your DBT modelsdbt-ai-fpath/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 ReportThis shows an example of a report generated from a DBT project containing 3 modelsContributingWe welcome contributions to the project! Please feel free to open issues or submit pull requests with your improvements and suggestions.SeeCONTRIBUTING.mdto get started and develop in this repo.