Skip to content

bibuwei/gpt-sql-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT-3 SQL Query Generator and UI

This is simple python application to generate SQL Schema + prompt to ask GPT-3 to generate SQL queries. It also has a simple UI to show results in a table.

How it works:

  1. Getting SQL schemas from PostgreSQL
  2. Compile prompt from SQL Schema
  3. Wait for user input
  4. Generate SQL query from prompt + user input
  5. Show SQL query and ask user to confirm or edit if it is correct before executing it
  6. Execute SQL query and show results in a table

Environment

  • DATABASE_URL: PostgreSQL database URL
  • OPENAI_TOKEN: OpenAI API token
  • APP_PORT: Port to run the application (default: 5000)

How to run

  1. It better to create a virtual environment using python3 -m venv venv
  2. Install dependencies using pip install -r requirements.txt
  3. Set environment variables in .env file in project root or in your system
  4. Run the application using python app.py and open http://localhost:5000 in your browser

Contact

If you have any questions, please contact me at t.me/define

About

Text to SQL generator GPT-3 (Python + Vue) and also AI chart generator!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 56.8%
  • Python 43.2%