This is simple python application to generate SQL Database queries using GPT-3 from OpenAI.
- Getting SQL schemas from MySQL and compile prompt from SQL Schema
- Wait for user input
- Generate SQL query from prompt + user input
- Show SQL query and ask user to confirm or edit if it is correct before executing it
- Execute SQL query and show results in a table
- DATABASE_HOST: MySQL database URL
- DATABASE_PORT: MySQL database port
- DATABASE_USER: MySQL database user
- DATABASE_PASS: MySQL database password
- DATABASE_DB: MySQL database name
- OPENAI_TOKEN: OpenAI API token (Not nessessary, you can set it in the UI)
- APP_PORT: Port to run the application (default: 5000)
- OPENAI_ENGINE: OpenAI engine to use (default: text-davinci-003, not nessessary). You can set some free to use model: text-chat-davinci-002-20221122
- DEBUG_MODE: Activate the debug mode or note. It also enables Flask hot reloading
- Set environment variables in
.env
file in project root or in your system - Run the application using
make run
and openhttp://localhost:5000
in your browser