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".
- cd tera_crystalball
- create .evn file with below environment variables and modify values with relavent information.
- 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
- Run pip install -r requirements_dev.txt
- Run python main.py