Skip to content

PlagueHO/genai-database-explorer

Repository files navigation

Generative AI Database Explorer

Continuous Integration Continuous Delivery Contributors Forks Stargazers Issues MIT License LinkedIn

With Generative AI Database Explorer, you can explore your database schema and stored procedures using Generative AI. This tool helps you understand your database schema and stored procedures by generating SQL queries based on the schema and explaining the schema and stored procedures in the database to the user based on the stored schema.

Although there are many other tools available that perform similar functions, this tool produces a semantic model of the database schema, combined with a data dictionary and enriched using Generative AI.

The reason that this approach of enriching a semantic model rather than just querying the database directly is:

  1. Many databases are not normalized and have grown organically over time. This can make it difficult to understand the schema and stored procedures by just looking at the table & column names.
  2. Data dictionaries are often not maintained or are incomplete, but can still be useful to provide additional information about the schema.
  3. Additional grounding information may need to be provided by a user to ensure that the Generative AI can provide accurate information.
  4. Enables greater control and the database owner can review and adjust the semantic model to ensure it is correct.
  5. The semantic model can be stored in version control and used as an asset that is deployed as part of another application.

Components

Console App (GenAIDBExplorer.Console)

A console application that provides commands to manage Generative AI Database Explorer projects, including functions for:

  • init-project: Initializing a new project folder with a settings.json file to contain the configuration for the project.e!!!! XOX
  • extract-model: Extract a representation of the database schema as a semantic model in the project folder based on the settings.json file.
  • data-dictionary: Update an extracted semantic model with additional information provided from a set of data dictionary files.
  • enrich-model: Enrich an existing semantic model of a database schema in the project folder based on the settings.json file using Generative AI to produce an enriched semantic model.
  • show-object: Show the details of a table, column, or stored procedure in the semantic model.
  • query-model: Answer questions based on the semantic model by using Generative AI. This includes recommending SQL.

Web App (GenAIDBExplorer.Web)

This planned app is a simple web application that can take an enriched model and enable a user to explore the database schema and stored procedures using chat.

Generative AI Database Explorer project

All commands require the -p/--project setting that specifies a folder on disk called a "project folder" that will contain a settings.json file that the user will configure before being able to execute any other commands.

Semantic Model

This is a representation of the database schema that is enriched by Generative AI. The semantic model is stored in subfolder in the project folder with the name of the database in a file called semanticmodel.json. The semantic model must be produced by the console tool before it can be used to querying or with the web application.

Disclaimer

This repository is provided "as is" without warranty of any kind, whether express or implied. Use at your own risk! The author will not be liable for any losses or damages associated with the use of this repository.

It is intended to be used as a starting point for your own project and not as a final product.

License

Copyright (c) 2024 Daniel Scott-Raynsford

Licensed under the MIT license.

Contact

Acknowledgments

TBC

References

TBC

About

A tool for exploring relational databases using a large language model

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages