Text2SQL Demo
This demo showcases an AI-powered interface that converts natural language questions into SQL queries and executes them against TiDB. Built with PyTiDB, OpenAI GPT, and Streamlit, it provides a seamless way to interact with your database using plain English.
Prerequisites
- Python 3.10+
- A TiDB Cloud Serverless cluster: Create a free cluster here: tidbcloud.com ↗️
- OpenAI API Key: Get your API key at OpenAI Platform ↗️
How to run
Step 1: Clone the repository
Step 2: Install the required packages
Step 3: Run the Streamlit app
Step 4: Run streamlit app
Open the browser and visit http://localhost:8501
- Input OpenAI API key in left sidebar
- Input the TiDB Cloud connection string in left sidebar, the format is
mysql+pymysql://root@localhost:4000/test
Related Resources
- Source Code: View on GitHub
-
Category: Ai-Apps
-
Description: Convert natural language queries into SQL statements using AI models.