This project is a Spring Boot application that generates and executes SQL queries based on human-readable input. It uses OpenAI's API to interpret the input and generate the corresponding SQL query.
- Generate SQL queries from human-readable questions.
- Execute the generated SQL queries.
- Log the results of the executed queries.
- Java
- Spring Boot
- Maven
- SQLite
- OpenAI API
- Java 11 or higher
- Maven
- SQLite
git clone https://github.com/madhankumar-anandan/sqlproject.git
cd sqlproject- Update the
application.propertiesfile with your OpenAI API key:
spring.ai.openai.api-key=<YOUR_API_KEY>- Ensure the SQLite database file path is correct in the
application.propertiesfile:
spring.datasource.url=jdbc:sqlite:/path/to/your/olist.sqliteYou can download the olist.sqlite database from the following link:
https://www.kaggle.com/datasets/terencicp/e-commerce-dataset-by-olist-as-an-sqlite-database/data
mvn clean install
mvn spring-boot:runThe application will start on port 8086 by default.
To generate and execute an SQL query, send a POST request to the appropriate endpoint with the human-readable query. The application will return the generated SQL query and the results of its execution. Postman collection is available in the repository to test the application.
- OpenAI for providing the API used to generate SQL queries.
- Spring Boot for the application framework.
- SQLite for the database.