This project aims to create SQL queries from natural language. This sample proof of concept (POC) is centered around tables that exist in the database of the logged-in user within the provided instance. It employs the OpenAI gpt-3.5-turbo language model to generate SQL queries based on human input. The process involves using the "show table" statement to retrieve the table structure, which is then utilized to construct prompts for the language model. The model generates SQL query statements, which are subsequently submitted to Teradata for execution. The results are then displayed as output.
Here are the steps for executing the project:
- Clone the project using the command "git clone".
- Open the project in PyCharm.
- Set up the Run Configurations for "main.py" by adding the following environment variables or define .env at project level to specify the Teradata instance details and OpenAI API key.
- TERADATA_HOST=whomooz;
- TERADATA_USER=guest;
- TERADATA_PASSWORD=please;
- USER_QUERY=query.
- AZURE_OPENAI_ENDPOINT=azureendpointurl
- AZURE_OPENAI_API_KEY=azurere openai key
- AZURE_OPENAI_MODEL=modelname to use