You almost wrote that. We’ll take it from here.
AlmostSQL is a multi-agent AI system that simplifies MySQL database interaction by enabling users to execute CRUD queries (Create, Read, Update, Delete), load data from CSV files, and revert queries using natural language or SQL inputs.
Built using LangChain, GROQ Cloud (for accessing the llama-3.3-70b-versatile LLM), Python, and Streamlit, it automates query parsing, validation, execution, and rollbacks.
The application is targeted towards SQL learners, developers, educators, DB admins, and AI researchers, offering interactive learning, streamlined query execution, and safe experimentation, with use cases including SQL education and data prototyping.
Here’s the link to LinkedIn post and demo
- Parses natural language queries into SQL using LLM.
- Processes CSV uploads to create and populate tables.
- Reverts queries (e.g., undo an
INSERTwith a correspondingDELETE). - Handles errors with clarification prompts and confirms risky queries before execution.
Core components of AlmostSQL's perception, cognition, feedback, and memory.
High-level architecture of AlmostSQL’s multi-agent flow from natural language input to SQL execution and feedback.
To learn more about the detailed instructions and explanations, please refer to the User Guide
- Python 3.8+ installed on system.
- A running MySQL Server with access credentials.
- GROQ API Key is required to access the language model for query parsing. Obtain one from GROQ. Other API keys can be used with config file adjustments.
- Clone the Repository
git clone https://github.com/bhargaviHQ/almostsql
cd almostsql- Create a Virtual Environment
python -m venv venv
source venv/bin/activate
# On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Set up MySQL and ensure your MySQL server is running. Note the host, user, password, and database name for configuration.
- Start the Streamlit App:
streamlit run main.py- Access the UI by opening your browser and navigating to http://localhost:8501 (or the port shown in the terminal).
- GROQ API Key- GROQ API key used for query parsing
- Database Host- Typically localhost or MySQL server’s IP address (127.0.0.1)
- Database User
- Database Password
- Database Name- The schema name (e.g., mydb).
Click Save and Proceed to connect. If successful, the main interface will load.
Similar to Jupyter Notebook, AlmostSQL is an open-source, interactive web application that enables you to perform CRUD operations on your database. It also allows modifying the connection to make it accessible to other MySQL databases.
- Choose or create a schema via the sidebar.
- Upload a CSV, specify the table name in the query or sidebar. Tables are created with VARCHAR(255) columns if needed.
- Destructive queries like DELETE, UPDATE, or ALTER queries require confirmation.
- View past queries and revert to a specific version or clear history.


