An interactive Streamlit application that connects to a MySQL database, allowing users to ask questions in natural language and receive both the corresponding SQL queries and query results.
- 🔒 Connect to a MySQL database using host, port, user, password, and database name.
- 🧠 Translates questions in Spanish into valid SQL queries.
- 🛠 Automatically executes the generated SQL statement.
- 📊 Displays the query results in a clear and readable format.
- 🤖 SQL assistant-like interface for real-time interaction.
Chat-with-MySQL.mp4
- Python 3.8 or higher
- MySQL Server (local or remote)
- Active database connection
- Clone the repository:
git clone https://github.com/your-username/chat-with-mysql.git
cd chat-with-mysql
- Install the dependencies:
python -m venv .venv
.venv\Scripts\activate.bat
pip install -r requirements.txt
- Run the application:
streamlit run chat-with-mysql-v2.py
Add this to your requirements.txt
:
streamlit
mysql-connector-python
- Fill in the connection credentials in the sidebar.
- Ask a question like:
"Quiero saber qué planta ha ganado más partidas y cuántas."
- The app will generate the corresponding SQL and show the query results.
📁 chat-with-mysql
├── chat-with-mysql.py
├── chat-with-mysql-v2.py
├── README.md
├── query-samples.txt
├── requirements.txt
├── .env
└── img/
This project was built as a conversational SQL assistant, ideal for students and developers who want to interact with databases more intuitively.
MIT License.