Skip to content

henomis/ai-sql-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 ai-sql-assistant

Build Status GoDoc Go Report Card GitHub release

This is a simple AI SQL query builder helper written in GO. It uses OpenAI API to generate a plausible SQL query from a given question. Generated query is executed and results are displayed. And, if you provide a plot question, it will generate a plot for you.

It only supports MySQL and SQLite for now. This project is powered by LinGoose 🪿

ai-sql-assistant

ai-sql-assistant

If you like this project, give it a ⭐️ and share it with friends!

Installation

Be sure to have a working Go environment, then run the following command:

go install github.com/henomis/ai-sql-assistant@latest

From source code

Clone the repository and build the binary:

go build .

Pre-built binaries

Pre-built binaries are available for Linux, Windows and macOS on the releases page.

Usage

⚠️ ai-sql-assistant requires an OpenAI API key as OPENAI_API_KEY environment variable.

Usage of ./ai-sql-assistant:
  -k string
        openai api key (defaults to OPENAI_API_KEY env var)
  -n string
        name of the datasource (database path|connection string)
  -p string
        instructions to plot the datasource
  -q string
        question to ask the datasource
  -t string
        type of the datasource (sqlite|mysql)
ai-sql-assistant -n ./Chinook_Sqlite.sqlite -t sqlite -q "give me top 4 artists name and number of songs"

License

© Simone Vellei, 2023~time.Now() Released under the MIT License