moises-m-limon/text-to-sql-demo
0
Data A.N.A.L.Y.S.T.S.
This project uses Gradio to create a UI that interacts with a Snowflake database using OpenAI's GPT-4 to convert natural language queries into SQL.
Setup Instructions
Prerequisites
- Python 3.7 or higher
- OpenAI API key (sign up at OpenAI)
- Snowflake account credentials
Step 1: Install Dependencies
Below are the required packages:
gradio
pandas
snowflake-connector-python
snowflake-sqlalchemy
langchain
langchain_community
openaiInstall all required packages from the requirements.txt file:
pip install -r requirements.txtStep 2: Run the Application
Activate the virtual environment (if not already activated).
python main.pyThis will launch the Gradio UI in your browser.
How to Use
- OpenAI Sign In: Enter your OpenAI API key and sign in.
- Snowflake Sign In: Enter your Snowflake credentials (username, password, account, warehouse, database, schema).
- Convert Natural Language to SQL: Enter a natural language query, click "Get SQL Query", and see the SQL query and explanation.
- Run SQL Query: Enter a SQL query and execute it to view the results.
