A Python library that bridges the gap between non-technical users and complex database operations through natural language processing and LLMs
Project description
HyperXQL
HyperXQL is a Python library that bridges the gap between non-technical users and complex database operations through natural language processing and Large Language Models (LLMs).
Features
- ✨ Convert natural language to SQL queries with high accuracy
- 🔄 Execute database operations with plain English commands
- 🌐 Interactive web interface for user-friendly interactions
- 📊 Database schema visualization with interactive features
- 🔌 Support for SQLite, PostgreSQL, and MySQL databases
- 🤖 Integration with OpenAI and Together AI models
- 💬 Conversational explanations of SQL operations
- 📑 Detailed query results displayed in tables or text format
- 🔒 Secure API key and database credential management
- 🖥️ CLI interface for quick operations
- 🔄 Version control and migration support
- 📐 Customizable prompts and system instructions
Installation
# Install from PyPI
pip install hyperxql
# Optional: Install graphviz for schema visualization
# On Ubuntu/Debian
apt-get install graphviz
# On macOS
brew install graphviz
# On Windows (using Chocolatey)
choco install graphviz
Quick Start
CLI Usage
# Initialize HyperXQL configuration
hyperxql init
# Run a natural language query
hyperxql query "Show me all users who joined last month"
# View or update configuration
hyperxql config
Python Library Usage
from hyperxql import Config, LLMClient, DatabaseManager, SQLGenerator
# Initialize configuration
config = Config()
# Create SQL generator
llm_client = LLMClient(config)
sql_generator = SQLGenerator(llm_client)
# Initialize database manager
db_manager = DatabaseManager(config)
# Generate SQL from natural language
nl_query = "Find all products with price greater than $100"
sql_response = sql_generator.generate_sql(nl_query, db_manager.get_database_info())
# Execute the generated SQL
result = db_manager.execute_sql(sql_response.sql)
print(result)
Web Interface
To start the web interface:
# From the command line
python main.py
# Visit http://localhost:5000 in your browser
Supported LLM Providers
-
OpenAI
- gpt-4o (default)
- gpt-3.5-turbo
-
Together AI
- meta-llama/Llama-3.3-70B-Instruct-Turbo-Free (default)
- meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo-classifier
- mistralai/Mixtral-8x22B-Instruct-v0.1
- and other supported Together AI models
Database Schema Visualization
HyperXQL provides interactive database schema visualization with:
- Entity-relationship diagrams
- Zoom and pan functionality
- Dark/light mode toggle
- Schema download options
- Primary and foreign key indicators
- Table relationship visualization
Documentation
For detailed documentation, please visit:
Contributing
Contributions are welcome! Please check out our contributing guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 Distributions
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 hyperxql-1.0.0.tar.gz.
File metadata
- Download URL: hyperxql-1.0.0.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0c71712076b39756de06b4ec742d21f97afc2309687041c281025fd429af56f
|
|
| MD5 |
345ff0ab0f61dd4a2c71685a5f8946df
|
|
| BLAKE2b-256 |
47cecab7260a390874cc6f5f188f91beb4551025b5aee9eea8fb938ac5b22abf
|
File details
Details for the file hyperxql-1.0.0-py3-none-any.whl.
File metadata
- Download URL: hyperxql-1.0.0-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b0ab18d4ebb0c98df82a5acf790755f112b3a5e254b81e21fbc9ee712fd1742
|
|
| MD5 |
3c62d3652892d4610729ebba68b8238d
|
|
| BLAKE2b-256 |
9288a002bdb518ed310505fe9b0fda0c0080b6c3d23a42eed5f093e82ab98d47
|
File details
Details for the file hyperxql-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: hyperxql-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 51.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d81c3b2b2ba16ee50626022df164987d5005d5b3b91b102ccefe7daa444d820
|
|
| MD5 |
80aa7380be210120c55f80599638a087
|
|
| BLAKE2b-256 |
da2934c9cca53af67fdc619f99b314860a5f1023fad903bee2dff76c679ef624
|