ChatDB is an interactive ChatGPT-like application that assists users in learning how to query data in database systems, including SQL and NoSQL databases. Unlike traditional query interfaces, ChatDB offers a natural language approach to database interactions while maintaining the ability to execute queries and display results in real-time.
- Select and explore different databases (MySQL and MongoDB)
- View tables/collections and their attributes
- Browse sample data to understand database structure
- Generate sample queries using various SQL/NoSQL constructs
- Support for different query types including:
- GROUP BY operations
- HAVING clauses
- ORDER BY statements
- Aggregation functions
- WHERE conditions
- JOIN operations
- Input queries in natural language
- Pattern recognition for query generation
- Converts natural language to SQL/MongoDB queries
- Real-time query execution and results display
- Dynamic query template generation
- Explanation of query components
- Error handling with helpful feedback
- Sample query generation based on database content
/
βββ README.txt # this file
βββ requirements.txt # List of dependencies
βββ application/
β βββ __init__.py # Application initialization
β βββ static/ # static files (CSS, JS, images...)
β β βββ images/
β β β βββ logo.png
β β βββ style.css
β β βββ script.js
β βββ templates/ # HTML template
β β βββ index.html
β βββ mongo_component/ # components for mongodb
β β βββ mongoApi.py # functions to interact with mongo db
β β βββ mongoQueryBuilder.py # builder standard mongo query
β βββ mysql_component/ # components for mysqldb
β β βββ mysqlApi.py # functions to interact with mysql db
β β βββ mysqlQueryBuilder.py # builder standard mysql query
β βββ toolkit/
β β βββ sampleGeneratator.py # generate samples
β β βββ templateBuilder.py # templates queries, and input parsing
β βββ constant.py # Environment variables & configuration
β βββ chatbot.py # chatbot module
βββ app.py # start the Flask application
- Frontend: HTML, CSS, JavaScript, jQuery
- Backend: Python Flask
- Databases:
- MySQL for relational data
- MongoDB for NoSQL operations
- Additional Libraries:
- flask_pymongo for MongoDB integration
- flask_pymysql for MySQL connectivity
- pandas for data processing
- Regular expressions (re) for pattern matching
- Clone the repository
git clone [repository-url]- Install required dependencies
pip install -r requirements.txt- Configure database connections
- Update MySQL configuration in
constant.py - Set MongoDB connection string in
constant.py
- Run the application
python app.py- Open your browser and navigate to:
http://127.0.0.1:5001.
-
Database Selection
- Choose between MySQL and MongoDB interfaces
- Upload your dataset through the web interface
-
Query Exploration
- Use the "Show Samples" option to see example queries
- Learn different query patterns and structures
-
Natural Language Queries
- Type queries in natural language
- Example: "Show me the total sales by product category"
- View generated database queries and results
Made with β€οΈ by Team ChatDB 40