A natural language interface for querying datasets using LLMs
Project description
QueryBot
A powerful web application that enables users to upload various data formats, execute SQL queries, and download results through an intuitive interface.
Table of Contents
Overview
QueryBot is built with FastAPI for the backend and a responsive HTML/Bootstrap frontend. It provides a seamless experience for data analysis by allowing users to query multiple data sources through a unified SQL interface.
Features
-
Enterprise Data Integration:
- Native support for CSV, Parquet, SQLite, Excel, JSON, and DuckDB files
- Direct MySQL database connectivity with secure connection handling
- Remote file access capabilities for cloud-stored datasets
- Automatic schema inference with type validation
- Multi-dataset querying with automatic join optimization
-
AI-Powered Query Processing:
- Natural language to SQL conversion using state-of-the-art LLMs
- Multi-model support with cost-optimized options:
- GPT-4.1-nano
- GPT-4.1-mini
- o4-mini
- Gemini 2.5 Flash
- Context-aware query generation with dataset understanding
- Intelligent column name handling with special character support
- Custom system prompts for specialized analytical workflows
-
Advanced Analytics Engine:
- Complex temporal analysis with multi-format date handling
- Advanced text analytics with case-insensitive pattern matching
- Window functions and complex aggregations
- Custom analytical workflows through system prompts
- Automatic query optimization and execution planning
-
Interactive Data Visualization:
- Dynamic chart generation with Chart.js integration
- Context-aware visualization recommendations
- Custom visualization descriptions
- Real-time data exploration
- Export capabilities with CSV formatting
-
Enterprise-Grade Architecture:
- Query history persistence with result caching
- Dataset-specific query suggestions
- Comprehensive error handling and logging
- Environment-based configuration management
- Scalable FastAPI architecture with DuckDB backend
- Custom JSON encoder for complex data types
- Secure API key management
-
User Experience:
- Responsive design for desktop and mobile
- Dark theme support
- Recent files history
- Recent queries per file
- Toast notifications for operations
- Loading indicators
- Error handling with detailed messages
-
Development Features:
- FastAPI backend
- DuckDB for efficient data processing
- Custom JSON encoder for complex data types
- Environment variable configuration
- Extensible architecture
Getting Started
Installation
Note: Installation is optional as
uvxwill handle the necessary setup.
pip install querybot
Running the Application
- Start the application with a single command using
uv:uvx querybot - Open your web browser and navigate to http://localhost:8001 to access the QueryBot interface.
Usage
-
Upload Data: Use the interface to specify data sources by:
- Entering file paths (multiple paths can be separated by commas, without quotes)
- Uploading files directly through the browser
-
Supported Data Formats:
- CSV files (
.csv) - Parquet files (
.parquet) - SQLite databases (
.db) - Excel spreadsheets (
.xlsx) - External MySQL databases (from relational-data.org)
- CSV files (
-
Execute Queries: Write SQL queries in the editor and click "Run Query" to see results.
-
Export Results: Download query results as CSV files for further analysis or reporting.
Project Structure
/querybot
│
├── querybot # Main package directory
│ ├── app.py # FastAPI application entry point
│ ├── __init__.py # Package initialization
│ ├── static # Static assets
│ │ ├── index.html # Main frontend interface
│ │ └── js # JavaScript resources
│ │ └── script.js # Frontend functionality
├── pyproject.toml # Project metadata and dependencies
├── .gitignore # Git ignore configuration
├── uv.lock # Dependency lock file
├── README.md # Project documentation
Development
Prerequisites
- Python 3.8+
Setting Up Development Environment
-
Clone the repository:
git clone https://github.com/gramener/querybot.git cd querybot
-
Install dependencies:
pip install -e ".[dev]"
Deployment
Modify the pyproject.toml file to change the version number.
uv build
uv publish
This is deployed to pypi as s.anand@gramener.com
License
This project is licensed under the MIT License - see the LICENSE file for details.
Additional Resources
Query Result
Contribution Guidelines
We welcome contributions! Please see our CONTRIBUTING.md for more details.
FAQ
Q: What data formats are supported? A: The application supports CSV, Parquet, SQLite, Excel, and MySQL formats.
Q: How do I report an issue? A: Please use the Issue Tracker to report any issues you encounter.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file querybot-0.3.1.tar.gz.
File metadata
- Download URL: querybot-0.3.1.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95c17532cd549ae97ad13bdbe99ee972687fde19b36cbb1ae67a0abe63a14ca1
|
|
| MD5 |
61ef7d001822d4a54fa6ab7e5f871f03
|
|
| BLAKE2b-256 |
e909533be80970a1f78468e77a32aff13b4a423ad13b2f58f7ceac09d22061e9
|
File details
Details for the file querybot-0.3.1-py3-none-any.whl.
File metadata
- Download URL: querybot-0.3.1-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b05fdcc16654308ece370392889ae537a640d47fe3faba5c7591ebaf97605ccf
|
|
| MD5 |
e15a155bb5f5a8b41f7c02c5b1e0a6c8
|
|
| BLAKE2b-256 |
e28bb6b71b78ad89e82384c5ae59911c0c24d28eeb17e88e85e127a127cf402b
|