Database Personal Assistant - An AI-powered database management system with advanced text-to-SQL capabilities
Project description
Database Personal Assistant (DBPA)
DBPA is an advanced AI-powered database management system that provides natural language interface for database operations. It uses a modular, agent-based architecture to convert natural language queries into optimized SQL, analyze database schemas, and provide intelligent suggestions.
Features
- Natural Language to SQL: Convert human language queries into optimized SQL
- Schema Analysis: Intelligent database schema analysis and optimization
- Query Templates: Dynamic generation and management of query templates
- Multi-Agent Architecture: Specialized agents for different tasks
- Vector Store: Efficient semantic search for query examples
- Multilingual Support: Process queries in multiple languages
- Security-First: Built-in security best practices
- Modern UI: Streamlit-based user interface
Installation
pip install dbpa
For development:
pip install dbpa[dev]
Quick Start
from dbpa.txt2sql.agents.schema import SchemaAnalyzer
from dbpa.txt2sql.vector_store import VectorStore
# Initialize components
analyzer = SchemaAnalyzer()
store = VectorStore()
# Analyze database schema
schema_info = analyzer.analyze_schema(
"postgresql://user:pass@localhost/db"
)
# Generate query templates
templates = analyzer.generate_templates(schema_info)
# Store templates
store.add_examples(templates)
# Convert natural language to SQL
query = "Find all active users who registered last month"
results = store.find_similar_queries(query)
sql = results[0].sql_query
Architecture
DBPA uses a multi-agent architecture with specialized components:
Core Agents
- SchemaAnalysisAgent: Database structure analysis
- DataManagementAgent: Vector store management
- QualityAssuranceAgent: Query optimization
- TranslationAgent: Multilingual support
- MonitoringAgent: Performance tracking
- SecurityAgent: Access control
Key Components
- Vector Store: Semantic search engine
- Template Generator: Query pattern management
- Schema Analyzer: Database structure analysis
- UI Components: Streamlit interface
Documentation
Security
DBPA implements several security measures:
- Query sanitization
- Input validation
- Access control
- Secure credential management
- Audit logging
See our Security Guide for details.
Testing
Run the test suite:
# Unit tests
pytest tests/unit
# Integration tests
robot tests/robot/tests
# Coverage report
pytest --cov=dbpa
Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch
- Make your changes
- Run the test suite
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- SQLAlchemy team for the amazing database toolkit
- Sentence Transformers for vector embeddings
- Streamlit for the UI framework
- PyPI for package hosting
Contact
- GitHub: achimdehnert/dbpa
- Issues: GitHub Issues
Roadmap
- Support for more database types
- Advanced query optimization
- Enhanced multilingual capabilities
- Real-time performance monitoring
- Extended security features
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 dbpa-0.2.0.tar.gz.
File metadata
- Download URL: dbpa-0.2.0.tar.gz
- Upload date:
- Size: 10.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f68fae5d170c893d56f7c2488ac4e19d014c67d03d251cdc5df45748744f5a51
|
|
| MD5 |
dfa9c38c5cc2e719bbab618a357f9373
|
|
| BLAKE2b-256 |
7f6a99b510174506ef5f02e41521c68c5b846c04f66d87acfe005938e45cef00
|
File details
Details for the file dbpa-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dbpa-0.2.0-py3-none-any.whl
- Upload date:
- Size: 53.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6174fb421d55bb4b62844afb77dfeeb276bf5002779ae5a175be96fc255c41df
|
|
| MD5 |
3d86bef733861dfa62e3731710e6201a
|
|
| BLAKE2b-256 |
7fbed47d57831bca12916045e29841e232d75e2edc4d6c41116af33a2ed9c1aa
|