Skip to content

Repository for a CS452 Database project where we translate human requests into SQL using OpenAI's GPT API.

Notifications You must be signed in to change notification settings

chill389cc/AI-SQL-Gen

Repository files navigation

BYU CS452 Natural Language DB with AI

Project by Caleb Hill, Jake Schilling, and Kevin Kinney.

The following lines are from the template repo.

Example SQL Lite DB with Python Client

To build and run queries with the SQLite Python client, change into the python_sql_lite directory:

cd python_sql_lite

Then run the build script build the database and create the tables:

python3 build.py

This command creates the file pythonssqlite.db

Finally, to execute query run this command:

python3 query.py --query "{your query goes here}"

For example, try running this query:

python3 query.py --query "SELECT * FROM menu where unit_price >=55.0"

You should see this result printed to your terminal:

Executing query: SELECT * FROM menu where unit_price >=55.0
(4, 'Espresso', 2, 55.0)
(5, 'Cappucino', 2, 55.0)
(6, 'Latte', 2, 55.0)
(7, 'Mocha', 2, 55.0)
(8, 'Passion Fruit', 3, 60.0)
(9, 'Mango Juice', 3, 60.0)
(10, 'Orange Juice', 3, 60.0)

Note: for the full table schema definitions, see schema.py

About

Repository for a CS452 Database project where we translate human requests into SQL using OpenAI's GPT API.

Resources

Stars

Watchers

Forks