# ๐๏ธ PyHybridDB - Hybrid Database System
> A Python-based hybrid database system combining SQL and NoSQL paradigms with a modern web-based admin panel
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[]()
[](https://github.com/Adrient-tech/PyHybridDB.git)
---
## ๐ Table of Contents
- [Features](#features)
- [Quick Start](#quick-start)
- [Installation](#installation)
- [Usage](#usage)
- [Authentication](#authentication)
- [Configuration](#configuration)
- [API Documentation](#api-documentation)
- [CLI Commands](#cli-commands)
- [Examples](#examples)
- [Project Structure](#project-structure)
- [Testing](#testing)
- [Security](#security)
- [License](#license)
---
## โจ Features
### Core Features
- ๐ **Hybrid Data Model** - SQL tables + NoSQL collections in one database
- ๐พ **Custom Storage Engine** - Efficient `.phdb` file format with B-Tree indexing
- ๐ **Unified Query Language** - Execute both SQL and MongoDB-style queries
- ๐ **REST API** - Complete FastAPI backend with auto-generated docs
- ๐จ **Web Admin Panel** - Beautiful, responsive UI for database management
- ๐ **JWT Authentication** - Secure token-based authentication
- ๐ **Role-Based Access Control** - Admin, user, and readonly roles
- ๐ **Real-time Statistics** - Dashboard with database metrics
- ๐ **ACID Transactions** - Transaction support with commit/rollback
- ๐ฆ **Import/Export** - JSON and CSV format support
### Advanced Features โจ NEW!
- ๐พ **Backup & Restore** - Automated backup with compression and rotation
- ๐ **Audit Logging** - Complete activity tracking and compliance
- ๐ฅ **User Management** - Full CRUD API for user administration
- ๐ **JOIN Operations** - INNER, LEFT, RIGHT, FULL OUTER joins
- ๐ **Data Visualization** - Charts and statistics generation
- ๐ **PostgreSQL Migration** - Import from PostgreSQL databases
- ๐ **MongoDB Migration** - Import from MongoDB collections
- ๐ **Encrypted Storage** - AES encryption for data at rest
### Technical Features
- B-Tree indexing for fast lookups
- Block-based storage with checksums
- Transaction logging with ACID compliance
- Query caching and optimization
- CORS support with configurable origins
- Environment-based configuration
- Comprehensive error handling
- SQLite-based audit logging
- Automatic backup rotation
- Password-based encryption
---
## ๐ Quick Start
### 1. Installation
```powershell
# Create virtual environment
python -m venv venv
# Activate virtual environment
.\venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install package
pip install -e .
```
### 2. Run Demo
```powershell
python DEMO.py
```
### 3. Start Server
```powershell
python -m pyhybriddb.cli serve
# Server runs at http://localhost:8000
# API docs at http://localhost:8000/docs
```
### 4. Open Admin Panel
Open `admin/index.html` in your web browser
**Default Login:**
- Username: `admin`
- Password: `admin123`
---
## ๐ป Usage
### Python API
```python
from pyhybriddb import Database
# Create database
with Database(name="my_app", path="./data") as db:
# SQL-like tables
users = db.create_table("users", {
"name": "string",
"age": "integer",
"email": "string"
})
# Insert records
users.insert({"name": "Alice", "age": 30, "email": "alice@example.com"})
# Query records
all_users = users.select()
young_users = users.select(where={"age": 25})
# Update records
users.update(where={"name": "Alice"}, updates={"age": 31})
# NoSQL-like collections
posts = db.create_collection("posts")
# Insert documents
posts.insert_one({
"title": "Hello World",
"tags": ["intro", "hello"],
"author": {"name": "Alice"}
})
# Query documents
all_posts = posts.find()
alice_posts = posts.find({"author.name": "Alice"})
```
### SQL Queries
```python
from pyhybriddb.core.connection import Connection
with Database("my_db") as db:
conn = Connection(db)
# CREATE TABLE
conn.execute("CREATE TABLE products (name string, price float)")
# INSERT
conn.execute("INSERT INTO products (name, price) VALUES ('Laptop', 999.99)")
# SELECT
result = conn.execute("SELECT * FROM products WHERE price > 500")
# UPDATE
conn.execute("UPDATE products SET price = 899.99 WHERE name = 'Laptop'")
conn.commit()
```
### NoSQL Queries
```python
# MongoDB-style queries
conn.execute('db.posts.insertOne({"title": "Hello", "tags": ["intro"]})')
conn.execute('db.posts.find({"tags": "intro"})')
conn.execute('db.posts.updateOne({"title": "Hello"}, {"$set": {"views": 100}})')
conn.execute('db.posts.aggregate([{"$sort": {"views": -1}}, {"$limit": 10}])')
```
---
## ๐ Authentication
### Overview
PyHybridDB uses **JWT (JSON Web Token)** authentication to secure the API and admin panel.
### Default Credentials
- **Username**: `admin`
- **Password**: `admin123`
โ ๏ธ **IMPORTANT**: Change these in production!
### API Authentication
```python
import requests
# Login
response = requests.post('http://localhost:8000/api/auth/login', json={
'username': 'admin',
'password': 'admin123'
})
data = response.json()
token = data['access_token']
# Use token for authenticated requests
headers = {'Authorization': f'Bearer {token}'}
response = requests.post(
'http://localhost:8000/api/databases',
json={'name': 'my_db'},
headers=headers
)
```
---
## โ๏ธ Configuration
### Environment Variables
PyHybridDB uses environment variables for configuration. After installing via pip, you can configure it in multiple ways:
### Method 1: Create .env File (Recommended)
Create a `.env` file in your project directory:
```bash
# Create .env file
touch .env # Linux/Mac
# or
New-Item .env # Windows PowerShell
```
Add your configuration:
```env
SECRET_KEY=your-super-secret-key-change-this
ADMIN_PASSWORD=your-secure-password
API_PORT=8000
DEFAULT_DB_PATH=./data
```
### Method 2: Set Environment Variables
```powershell
# Windows PowerShell
$env:SECRET_KEY = "my-secret-key"
$env:ADMIN_PASSWORD = "secure-password"
$env:API_PORT = "8080"
```
```bash
# Linux/Mac
export SECRET_KEY="my-secret-key"
export ADMIN_PASSWORD="secure-password"
export API_PORT="8080"
```
### Method 3: Programmatic Configuration
```python
import os
os.environ['SECRET_KEY'] = 'my-secret-key'
os.environ['DEFAULT_DB_PATH'] = './my_data'
from pyhybriddb import Database
db = Database("my_app")
```
### Available Settings
```env
# Security
SECRET_KEY=your-super-secret-key-change-this
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Admin Credentials
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin123
ADMIN_EMAIL=admin@pyhybriddb.com
# API Configuration
API_HOST=0.0.0.0
API_PORT=8000
# Database
DEFAULT_DB_PATH=./data
LOG_LEVEL=INFO
CORS_ORIGINS=*
```
### View Configuration
```powershell
python -m pyhybriddb.cli config
```
### Generate Secure SECRET_KEY
```python
import secrets
print(secrets.token_urlsafe(32))
```
---
## ๐ Advanced Features Usage
### Backup & Restore
```python
from pyhybriddb.utils.backup import BackupManager
backup_mgr = BackupManager()
# Create backup
backup_file = backup_mgr.create_backup("./data/my_db.phdb", compress=True)
# List backups
backups = backup_mgr.list_backups("my_db")
# Restore backup
restored = backup_mgr.restore_backup(backup_file)
# Auto-backup with rotation
backup_mgr.auto_backup("./data/my_db.phdb", max_backups=5)
```
### Audit Logging
```python
from pyhybriddb.utils.audit import get_audit_logger, AuditAction
audit = get_audit_logger()
# Log action
audit.log(
action=AuditAction.CREATE_DATABASE,
user="admin",
database_name="my_db",
success=True
)
# Get logs
logs = audit.get_logs(action=AuditAction.INSERT, limit=100)
# Get statistics
stats = audit.get_statistics()
```
### JOIN Operations
```python
from pyhybriddb.query.joins import JoinExecutor, JoinType
# Execute JOIN
result = JoinExecutor.execute_join(
left_table=users.select(),
right_table=orders.select(),
left_key="id",
right_key="user_id",
join_type=JoinType.INNER
)
```
### PostgreSQL Migration
```python
from pyhybriddb.migration import PostgreSQLMigration
from pyhybriddb import Database
# Connect to PostgreSQL
pg_migration = PostgreSQLMigration({
'host': 'localhost',
'port': 5432,
'database': 'mydb',
'user': 'postgres',
'password': 'password'
})
# Migrate to PyHybridDB
with Database("migrated_db") as db:
results = pg_migration.migrate_database(db)
print(f"Migrated {sum(results.values())} records")
```
### MongoDB Migration
```python
from pyhybriddb.migration import MongoDBMigration
from pyhybriddb import Database
# Connect to MongoDB
mongo_migration = MongoDBMigration({
'host': 'localhost',
'port': 27017,
'database': 'mydb'
})
# Migrate to PyHybridDB
with Database("migrated_db") as db:
results = mongo_migration.migrate_database(db)
print(f"Migrated {sum(results.values())} documents")
```
### Encrypted Storage
```python
from pyhybriddb.utils.encryption import EncryptionManager
# Setup encryption
encryption = EncryptionManager()
# Encrypt data
encrypted = encryption.encrypt_string("sensitive data")
# Decrypt data
decrypted = encryption.decrypt_string(encrypted)
# Encrypt files
encryption.encrypt_file("data.phdb", "data.phdb.encrypted")
encryption.decrypt_file("data.phdb.encrypted", "data.phdb")
```
---
## ๐ API Documentation
### Base URL
```
http://localhost:8000/api
```
### Interactive Docs
- **Swagger UI**: http://localhost:8000/docs
- **ReDoc**: http://localhost:8000/redoc
### Key Endpoints
#### Authentication
- `POST /api/auth/login` - Login and get JWT token
- `GET /api/auth/me` - Get current user info
#### Databases
- `POST /api/databases` - Create database
- `GET /api/databases` - List databases
- `GET /api/databases/{name}` - Get database details
- `DELETE /api/databases/{name}` - Delete database
#### Backup & Restore โจ NEW!
- `POST /api/databases/{name}/backup` - Create backup
- `GET /api/databases/{name}/backups` - List backups
- `POST /api/databases/{name}/restore` - Restore backup
#### Audit Logs โจ NEW!
- `GET /api/audit/logs` - Get audit logs (admin only)
- `GET /api/audit/statistics` - Get audit statistics (admin only)
#### User Management โจ NEW!
- `POST /api/users` - Create user (admin only)
- `GET /api/users` - List users (admin only)
- `GET /api/users/{username}` - Get user details
- `PUT /api/users/{username}` - Update user (admin only)
- `DELETE /api/users/{username}` - Delete user (admin only)
#### Data Visualization โจ NEW!
- `GET /api/databases/{db}/tables/{table}/visualize` - Generate charts
#### Tables
- `POST /api/databases/{db}/tables` - Create table
- `GET /api/databases/{db}/tables` - List tables
- `POST /api/databases/{db}/tables/{table}/records` - Insert record
- `GET /api/databases/{db}/tables/{table}/records` - Get records
#### Collections
- `POST /api/databases/{db}/collections` - Create collection
- `POST /api/databases/{db}/collections/{coll}/documents` - Insert document
- `GET /api/databases/{db}/collections/{coll}/documents` - Get documents
#### Query
- `POST /api/databases/{db}/query` - Execute query (SQL or NoSQL)
---
## ๐ฅ๏ธ CLI Commands
### Database Management
```powershell
# Create database
python -m pyhybriddb.cli create my_database
# Database info
python -m pyhybriddb.cli info my_database
```
### Server Management
```powershell
# Start server
python -m pyhybriddb.cli serve
# Custom host and port
python -m pyhybriddb.cli serve --host 127.0.0.1 --port 8080
# Enable auto-reload
python -m pyhybriddb.cli serve --reload
```
### Interactive Shell
```powershell
# Start shell
python -m pyhybriddb.cli shell my_database
# In shell:
phdb> CREATE TABLE users (name string, age integer)
phdb> INSERT INTO users (name, age) VALUES ('Alice', 30)
phdb> SELECT * FROM users
phdb> db.posts.insertOne({"title": "Hello"})
phdb> exit
```
### Configuration
```powershell
# View configuration
python -m pyhybriddb.cli config
```
---
## ๐ Examples
### Example 1: Basic CRUD
```python
from pyhybriddb import Database
db = Database("example_db", path="./data")
db.create()
# Create table
users = db.create_table("users", {"name": "string", "age": "integer"})
# Insert
user_id = users.insert({"name": "Alice", "age": 30})
# Select
all_users = users.select()
# Update
users.update(where={"name": "Alice"}, updates={"age": 31})
# Delete
users.delete(where={"name": "Alice"})
db.close()
```
### Example 2: NoSQL Collections
```python
from pyhybriddb import Database
with Database("blog_db") as db:
posts = db.create_collection("posts")
# Insert
posts.insert_one({
"title": "My First Post",
"tags": ["intro"],
"views": 0
})
# Find
all_posts = posts.find()
intro_posts = posts.find({"tags": "intro"})
# Update
posts.update_one(
{"title": "My First Post"},
{"$inc": {"views": 1}}
)
# Aggregate
popular = posts.aggregate([
{"$sort": {"views": -1}},
{"$limit": 5}
])
```
See `examples/basic_usage.py` for more examples.
---
## ๐ Project Structure
```
D:\python_db\
โโโ pyhybriddb/ # Main package
โ โโโ config.py # Configuration
โ โโโ core/ # Database core
โ โ โโโ database.py
โ โ โโโ table.py
โ โ โโโ collection.py
โ โโโ storage/ # Storage engine
โ โ โโโ engine.py
โ โ โโโ file_manager.py
โ โ โโโ index.py
โ โโโ query/ # Query layer
โ โ โโโ parser.py
โ โ โโโ sql_parser.py
โ โ โโโ nosql_parser.py
โ โ โโโ joins.py # โจ JOIN operations
โ โโโ api/ # REST API
โ โ โโโ server.py
โ โ โโโ models.py
โ โ โโโ auth.py
โ โ โโโ users.py # โจ User management
โ โโโ utils/ # Utilities
โ โ โโโ backup.py # โจ Backup & restore
โ โ โโโ audit.py # โจ Audit logging
โ โ โโโ encryption.py # โจ Encryption
โ โ โโโ visualization.py # โจ Data visualization
โ โ โโโ serializer.py
โ โ โโโ logger.py
โ โโโ migration/ # โจ Migration tools
โ โ โโโ postgresql.py # PostgreSQL migration
โ โ โโโ mongodb.py # MongoDB migration
โ โโโ cli.py # CLI
โโโ admin/ # Web admin panel
โ โโโ index.html
โ โโโ app.js
โ โโโ auth.js
โโโ examples/ # Examples
โโโ tests/ # Tests
โโโ DEMO.py # Demo script
โโโ config.env # Config template
โโโ requirements.txt
โโโ setup.py
โโโ README.md # This file
```
---
## ๐งช Testing
### Run Tests
```powershell
# Run all tests
python -m unittest discover tests
# Run specific test
python -m unittest tests.test_database.TestDatabase
```
### Example Test
```python
import unittest
from pyhybriddb import Database
class TestDatabase(unittest.TestCase):
def test_create_database(self):
db = Database("test_db", path="./test_data")
db.create()
self.assertTrue(db.db_file.exists())
db.close()
```
---
## ๐ Security
### Best Practices
1. **Change Default Credentials**
```env
ADMIN_PASSWORD=YourSecurePassword123!
```
2. **Use Strong SECRET_KEY**
```python
import secrets
print(secrets.token_urlsafe(32))
```
3. **Enable HTTPS in Production**
4. **Restrict CORS Origins**
```env
CORS_ORIGINS=https://yourdomain.com
```
5. **Set Appropriate Log Level**
```env
LOG_LEVEL=WARNING
```
### Security Features
- โ
JWT token authentication
- โ
Password hashing with bcrypt
- โ
Token expiration (30 minutes)
- โ
CORS protection
- โ
Input validation
- โ
Environment-based secrets
- โ
Audit logging for compliance
- โ
Encrypted storage option
---
## ๐ Implementation Status
### โ
**100% Feature Complete**
All features from the original PRD have been successfully implemented!
| Feature | Status | File Location |
|---------|--------|---------------|
| **Core Features** | | |
| Hybrid Data Model | โ
Complete | `core/database.py`, `core/table.py`, `core/collection.py` |
| Custom Storage Engine | โ
Complete | `storage/engine.py`, `storage/file_manager.py` |
| B-Tree Indexing | โ
Complete | `storage/index.py` |
| SQL Query Support | โ
Complete | `query/sql_parser.py` |
| NoSQL Query Support | โ
Complete | `query/nosql_parser.py` |
| ACID Transactions | โ
Complete | `core/database.py` |
| REST API | โ
Complete | `api/server.py` |
| Web Admin Panel | โ
Complete | `admin/index.html` |
| JWT Authentication | โ
Complete | `api/auth.py` |
| CLI Tools | โ
Complete | `cli.py` |
| Environment Config | โ
Complete | `config.py` |
| **Advanced Features** | | |
| Backup & Restore | โ
Complete | `utils/backup.py` |
| Audit Logging | โ
Complete | `utils/audit.py` |
| User Management | โ
Complete | `api/users.py` |
| JOIN Operations | โ
Complete | `query/joins.py` |
| Data Visualization | โ
Complete | `utils/visualization.py` |
| PostgreSQL Migration | โ
Complete | `migration/postgresql.py` |
| MongoDB Migration | โ
Complete | `migration/mongodb.py` |
| Encrypted Storage | โ
Complete | `utils/encryption.py` |
| Import/Export | โ
Complete | `admin/app.js` |
**Total: 20/20 Features (100%)**
### ๐ Project Metrics
- **Python Modules**: 40+
- **Lines of Code**: ~10,000+
- **API Endpoints**: 25+
- **Test Coverage**: Core functionality
- **Documentation**: Comprehensive
### ๐ฏ Production Ready
โ
All core features implemented
โ
All advanced features implemented
โ
Security features complete
โ
Operational tools ready
โ
Migration tools available
โ
Comprehensive documentation
โ
Working examples provided
โ
Server tested and running
---
## ๐ Quick Start Guide
### Installation
```powershell
# Clone repository
git clone https://github.com/Adrient-tech/PyHybridDB.git
cd PyHybridDB
# Create virtual environment
python -m venv venv
.\venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install package
pip install -e .
```
### Start Server
```powershell
python -m pyhybriddb.cli serve
```
Server will start at: http://localhost:8000
### Access Points
- **API Docs**: http://localhost:8000/docs
- **Admin Panel**: Open `admin/index.html` in browser
- **Default Login**: admin / admin123
### Run Demo
```powershell
python DEMO.py
```
---
## ๐ Support & Contributing
### Support
- **GitHub Issues**: Report bugs and request features
- **Documentation**: See this README and inline docs
- **Examples**: Check `examples/` directory
### Contributing
Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request
### Development Setup
```powershell
# Install dev dependencies
pip install -r requirements.txt
# Run tests
python -m unittest discover tests
# Start with auto-reload
python -m pyhybriddb.cli serve --reload
```
---
## ๐ Learning Resources
1. **Quick Start**: This README
2. **API Reference**: http://localhost:8000/docs (when server running)
3. **Examples**: `examples/basic_usage.py`
4. **Demo Script**: `python DEMO.py`
5. **Original PRD**: `project.md`
---
## ๐ License
MIT License
Copyright (c) 2025 Adrient.com - Developed by Infant Nirmal
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
## ๐ Support
- **Issues**: Report bugs on GitHub Issues
- **Documentation**: See this README and `project.md`
- **Examples**: Check `examples/` directory
- **Demo**: Run `python DEMO.py`
---
## ๐ฏ Roadmap
### Phase 1: Core Features โ
COMPLETE
- โ
Core storage engine
- โ
Hybrid data model
- โ
SQL & NoSQL query support
- โ
REST API
- โ
Admin panel
- โ
JWT Authentication
- โ
CLI Tools
### Phase 2: Advanced Features โ
COMPLETE
- โ
Backup & Restore
- โ
Audit Logging
- โ
User Management
- โ
JOIN Operations
- โ
Data Visualization
- โ
PostgreSQL Migration
- โ
MongoDB Migration
- โ
Encrypted Storage
- โ
Import/Export
### Phase 3: Future Enhancements (Optional)
- Multi-Factor Authentication (2FA)
- Full-Text Search
- Compound Indexes
- Advanced Query Optimization
- Replication & High Availability
- Sharding & Horizontal Scaling
- GraphQL API
- Real-time Subscriptions
- Cloud Storage Backends (S3, Azure, GCP)
- Plugin System & Extensions
---
## ๐ Acknowledgments
Inspired by:
- **PostgreSQL** - Relational model
- **MongoDB** - Document model
- **SQLite** - Embedded database
- **phpMyAdmin** - Admin interface
---
## ๐ Project Stats
- **Lines of Code**: ~10,000+
- **Python Modules**: 40+
- **Total Files**: 45+
- **API Endpoints**: 25+
- **Features**: 20/20 (100% Complete)
- **Version**: 1.0.0 (Production Ready)
- **Python**: 3.10+
- **Platform**: Cross-platform
- **License**: MIT
---
**Built with โค๏ธ by Infant Nirmal at Adrient.com**
**GitHub**: [https://github.com/Adrient-tech/PyHybridDB.git](https://github.com/Adrient-tech/PyHybridDB.git)
*Last Updated: October 25, 2025*
Raw data
{
"_id": null,
"home_page": "https://github.com/Adrient-tech/PyHybridDB",
"name": "pyhybriddb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Infant Nirmal <contact@adrient.com>",
"keywords": "database, hybrid, sql, nosql, mongodb, postgresql, fastapi, rest-api, backup, audit, encryption",
"author": "Infant Nirmal",
"author_email": "Infant Nirmal <contact@adrient.com>",
"download_url": "https://files.pythonhosted.org/packages/3c/e2/144dafc505371175469a0c389c3899fc54a3d8a03b9b2f8299230d0ccda3/pyhybriddb-1.0.1.tar.gz",
"platform": null,
"description": "# \ud83d\uddc4\ufe0f PyHybridDB - Hybrid Database System\r\n\r\n> A Python-based hybrid database system combining SQL and NoSQL paradigms with a modern web-based admin panel\r\n\r\n[](https://www.python.org/downloads/)\r\n[](https://opensource.org/licenses/MIT)\r\n[]()\r\n[](https://github.com/Adrient-tech/PyHybridDB.git)\r\n\r\n---\r\n\r\n## \ud83d\udccb Table of Contents\r\n\r\n- [Features](#features)\r\n- [Quick Start](#quick-start)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Authentication](#authentication)\r\n- [Configuration](#configuration)\r\n- [API Documentation](#api-documentation)\r\n- [CLI Commands](#cli-commands)\r\n- [Examples](#examples)\r\n- [Project Structure](#project-structure)\r\n- [Testing](#testing)\r\n- [Security](#security)\r\n- [License](#license)\r\n\r\n---\r\n\r\n## \u2728 Features\r\n\r\n### Core Features\r\n- \ud83d\udd04 **Hybrid Data Model** - SQL tables + NoSQL collections in one database\r\n- \ud83d\udcbe **Custom Storage Engine** - Efficient `.phdb` file format with B-Tree indexing\r\n- \ud83d\udd0d **Unified Query Language** - Execute both SQL and MongoDB-style queries\r\n- \ud83c\udf10 **REST API** - Complete FastAPI backend with auto-generated docs\r\n- \ud83c\udfa8 **Web Admin Panel** - Beautiful, responsive UI for database management\r\n- \ud83d\udd10 **JWT Authentication** - Secure token-based authentication\r\n- \ud83d\udd12 **Role-Based Access Control** - Admin, user, and readonly roles\r\n- \ud83d\udcca **Real-time Statistics** - Dashboard with database metrics\r\n- \ud83d\udd04 **ACID Transactions** - Transaction support with commit/rollback\r\n- \ud83d\udce6 **Import/Export** - JSON and CSV format support\r\n\r\n### Advanced Features \u2728 NEW!\r\n- \ud83d\udcbe **Backup & Restore** - Automated backup with compression and rotation\r\n- \ud83d\udcdd **Audit Logging** - Complete activity tracking and compliance\r\n- \ud83d\udc65 **User Management** - Full CRUD API for user administration\r\n- \ud83d\udd17 **JOIN Operations** - INNER, LEFT, RIGHT, FULL OUTER joins\r\n- \ud83d\udcca **Data Visualization** - Charts and statistics generation\r\n- \ud83d\udd04 **PostgreSQL Migration** - Import from PostgreSQL databases\r\n- \ud83d\udd04 **MongoDB Migration** - Import from MongoDB collections\r\n- \ud83d\udd10 **Encrypted Storage** - AES encryption for data at rest\r\n\r\n### Technical Features\r\n- B-Tree indexing for fast lookups\r\n- Block-based storage with checksums\r\n- Transaction logging with ACID compliance\r\n- Query caching and optimization\r\n- CORS support with configurable origins\r\n- Environment-based configuration\r\n- Comprehensive error handling\r\n- SQLite-based audit logging\r\n- Automatic backup rotation\r\n- Password-based encryption\r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### 1. Installation\r\n\r\n```powershell\r\n# Create virtual environment\r\npython -m venv venv\r\n\r\n# Activate virtual environment\r\n.\\venv\\Scripts\\activate\r\n\r\n# Install dependencies\r\npip install -r requirements.txt\r\n\r\n# Install package\r\npip install -e .\r\n```\r\n\r\n### 2. Run Demo\r\n\r\n```powershell\r\npython DEMO.py\r\n```\r\n\r\n### 3. Start Server\r\n\r\n```powershell\r\npython -m pyhybriddb.cli serve\r\n# Server runs at http://localhost:8000\r\n# API docs at http://localhost:8000/docs\r\n```\r\n\r\n### 4. Open Admin Panel\r\n\r\nOpen `admin/index.html` in your web browser\r\n\r\n**Default Login:**\r\n- Username: `admin`\r\n- Password: `admin123`\r\n\r\n---\r\n\r\n## \ud83d\udcbb Usage\r\n\r\n### Python API\r\n\r\n```python\r\nfrom pyhybriddb import Database\r\n\r\n# Create database\r\nwith Database(name=\"my_app\", path=\"./data\") as db:\r\n \r\n # SQL-like tables\r\n users = db.create_table(\"users\", {\r\n \"name\": \"string\",\r\n \"age\": \"integer\",\r\n \"email\": \"string\"\r\n })\r\n \r\n # Insert records\r\n users.insert({\"name\": \"Alice\", \"age\": 30, \"email\": \"alice@example.com\"})\r\n \r\n # Query records\r\n all_users = users.select()\r\n young_users = users.select(where={\"age\": 25})\r\n \r\n # Update records\r\n users.update(where={\"name\": \"Alice\"}, updates={\"age\": 31})\r\n \r\n # NoSQL-like collections\r\n posts = db.create_collection(\"posts\")\r\n \r\n # Insert documents\r\n posts.insert_one({\r\n \"title\": \"Hello World\",\r\n \"tags\": [\"intro\", \"hello\"],\r\n \"author\": {\"name\": \"Alice\"}\r\n })\r\n \r\n # Query documents\r\n all_posts = posts.find()\r\n alice_posts = posts.find({\"author.name\": \"Alice\"})\r\n```\r\n\r\n### SQL Queries\r\n\r\n```python\r\nfrom pyhybriddb.core.connection import Connection\r\n\r\nwith Database(\"my_db\") as db:\r\n conn = Connection(db)\r\n \r\n # CREATE TABLE\r\n conn.execute(\"CREATE TABLE products (name string, price float)\")\r\n \r\n # INSERT\r\n conn.execute(\"INSERT INTO products (name, price) VALUES ('Laptop', 999.99)\")\r\n \r\n # SELECT\r\n result = conn.execute(\"SELECT * FROM products WHERE price > 500\")\r\n \r\n # UPDATE\r\n conn.execute(\"UPDATE products SET price = 899.99 WHERE name = 'Laptop'\")\r\n \r\n conn.commit()\r\n```\r\n\r\n### NoSQL Queries\r\n\r\n```python\r\n# MongoDB-style queries\r\nconn.execute('db.posts.insertOne({\"title\": \"Hello\", \"tags\": [\"intro\"]})')\r\nconn.execute('db.posts.find({\"tags\": \"intro\"})')\r\nconn.execute('db.posts.updateOne({\"title\": \"Hello\"}, {\"$set\": {\"views\": 100}})')\r\nconn.execute('db.posts.aggregate([{\"$sort\": {\"views\": -1}}, {\"$limit\": 10}])')\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd10 Authentication\r\n\r\n### Overview\r\n\r\nPyHybridDB uses **JWT (JSON Web Token)** authentication to secure the API and admin panel.\r\n\r\n### Default Credentials\r\n\r\n- **Username**: `admin`\r\n- **Password**: `admin123`\r\n\r\n\u26a0\ufe0f **IMPORTANT**: Change these in production!\r\n\r\n### API Authentication\r\n\r\n```python\r\nimport requests\r\n\r\n# Login\r\nresponse = requests.post('http://localhost:8000/api/auth/login', json={\r\n 'username': 'admin',\r\n 'password': 'admin123'\r\n})\r\n\r\ndata = response.json()\r\ntoken = data['access_token']\r\n\r\n# Use token for authenticated requests\r\nheaders = {'Authorization': f'Bearer {token}'}\r\n\r\nresponse = requests.post(\r\n 'http://localhost:8000/api/databases',\r\n json={'name': 'my_db'},\r\n headers=headers\r\n)\r\n```\r\n\r\n---\r\n\r\n## \u2699\ufe0f Configuration\r\n\r\n### Environment Variables\r\n\r\nPyHybridDB uses environment variables for configuration. After installing via pip, you can configure it in multiple ways:\r\n\r\n### Method 1: Create .env File (Recommended)\r\n\r\nCreate a `.env` file in your project directory:\r\n\r\n```bash\r\n# Create .env file\r\ntouch .env # Linux/Mac\r\n# or\r\nNew-Item .env # Windows PowerShell\r\n```\r\n\r\nAdd your configuration:\r\n\r\n```env\r\nSECRET_KEY=your-super-secret-key-change-this\r\nADMIN_PASSWORD=your-secure-password\r\nAPI_PORT=8000\r\nDEFAULT_DB_PATH=./data\r\n```\r\n\r\n### Method 2: Set Environment Variables\r\n\r\n```powershell\r\n# Windows PowerShell\r\n$env:SECRET_KEY = \"my-secret-key\"\r\n$env:ADMIN_PASSWORD = \"secure-password\"\r\n$env:API_PORT = \"8080\"\r\n```\r\n\r\n```bash\r\n# Linux/Mac\r\nexport SECRET_KEY=\"my-secret-key\"\r\nexport ADMIN_PASSWORD=\"secure-password\"\r\nexport API_PORT=\"8080\"\r\n```\r\n\r\n### Method 3: Programmatic Configuration\r\n\r\n```python\r\nimport os\r\nos.environ['SECRET_KEY'] = 'my-secret-key'\r\nos.environ['DEFAULT_DB_PATH'] = './my_data'\r\n\r\nfrom pyhybriddb import Database\r\ndb = Database(\"my_app\")\r\n```\r\n\r\n### Available Settings\r\n\r\n```env\r\n# Security\r\nSECRET_KEY=your-super-secret-key-change-this\r\nJWT_ALGORITHM=HS256\r\nACCESS_TOKEN_EXPIRE_MINUTES=30\r\n\r\n# Admin Credentials\r\nADMIN_USERNAME=admin\r\nADMIN_PASSWORD=admin123\r\nADMIN_EMAIL=admin@pyhybriddb.com\r\n\r\n# API Configuration\r\nAPI_HOST=0.0.0.0\r\nAPI_PORT=8000\r\n\r\n# Database\r\nDEFAULT_DB_PATH=./data\r\nLOG_LEVEL=INFO\r\nCORS_ORIGINS=*\r\n```\r\n\r\n### View Configuration\r\n\r\n```powershell\r\npython -m pyhybriddb.cli config\r\n```\r\n\r\n### Generate Secure SECRET_KEY\r\n\r\n```python\r\nimport secrets\r\nprint(secrets.token_urlsafe(32))\r\n```\r\n\r\n---\r\n\r\n## \ud83c\udd95 Advanced Features Usage\r\n\r\n### Backup & Restore\r\n\r\n```python\r\nfrom pyhybriddb.utils.backup import BackupManager\r\n\r\nbackup_mgr = BackupManager()\r\n\r\n# Create backup\r\nbackup_file = backup_mgr.create_backup(\"./data/my_db.phdb\", compress=True)\r\n\r\n# List backups\r\nbackups = backup_mgr.list_backups(\"my_db\")\r\n\r\n# Restore backup\r\nrestored = backup_mgr.restore_backup(backup_file)\r\n\r\n# Auto-backup with rotation\r\nbackup_mgr.auto_backup(\"./data/my_db.phdb\", max_backups=5)\r\n```\r\n\r\n### Audit Logging\r\n\r\n```python\r\nfrom pyhybriddb.utils.audit import get_audit_logger, AuditAction\r\n\r\naudit = get_audit_logger()\r\n\r\n# Log action\r\naudit.log(\r\n action=AuditAction.CREATE_DATABASE,\r\n user=\"admin\",\r\n database_name=\"my_db\",\r\n success=True\r\n)\r\n\r\n# Get logs\r\nlogs = audit.get_logs(action=AuditAction.INSERT, limit=100)\r\n\r\n# Get statistics\r\nstats = audit.get_statistics()\r\n```\r\n\r\n### JOIN Operations\r\n\r\n```python\r\nfrom pyhybriddb.query.joins import JoinExecutor, JoinType\r\n\r\n# Execute JOIN\r\nresult = JoinExecutor.execute_join(\r\n left_table=users.select(),\r\n right_table=orders.select(),\r\n left_key=\"id\",\r\n right_key=\"user_id\",\r\n join_type=JoinType.INNER\r\n)\r\n```\r\n\r\n### PostgreSQL Migration\r\n\r\n```python\r\nfrom pyhybriddb.migration import PostgreSQLMigration\r\nfrom pyhybriddb import Database\r\n\r\n# Connect to PostgreSQL\r\npg_migration = PostgreSQLMigration({\r\n 'host': 'localhost',\r\n 'port': 5432,\r\n 'database': 'mydb',\r\n 'user': 'postgres',\r\n 'password': 'password'\r\n})\r\n\r\n# Migrate to PyHybridDB\r\nwith Database(\"migrated_db\") as db:\r\n results = pg_migration.migrate_database(db)\r\n print(f\"Migrated {sum(results.values())} records\")\r\n```\r\n\r\n### MongoDB Migration\r\n\r\n```python\r\nfrom pyhybriddb.migration import MongoDBMigration\r\nfrom pyhybriddb import Database\r\n\r\n# Connect to MongoDB\r\nmongo_migration = MongoDBMigration({\r\n 'host': 'localhost',\r\n 'port': 27017,\r\n 'database': 'mydb'\r\n})\r\n\r\n# Migrate to PyHybridDB\r\nwith Database(\"migrated_db\") as db:\r\n results = mongo_migration.migrate_database(db)\r\n print(f\"Migrated {sum(results.values())} documents\")\r\n```\r\n\r\n### Encrypted Storage\r\n\r\n```python\r\nfrom pyhybriddb.utils.encryption import EncryptionManager\r\n\r\n# Setup encryption\r\nencryption = EncryptionManager()\r\n\r\n# Encrypt data\r\nencrypted = encryption.encrypt_string(\"sensitive data\")\r\n\r\n# Decrypt data\r\ndecrypted = encryption.decrypt_string(encrypted)\r\n\r\n# Encrypt files\r\nencryption.encrypt_file(\"data.phdb\", \"data.phdb.encrypted\")\r\nencryption.decrypt_file(\"data.phdb.encrypted\", \"data.phdb\")\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcda API Documentation\r\n\r\n### Base URL\r\n\r\n```\r\nhttp://localhost:8000/api\r\n```\r\n\r\n### Interactive Docs\r\n\r\n- **Swagger UI**: http://localhost:8000/docs\r\n- **ReDoc**: http://localhost:8000/redoc\r\n\r\n### Key Endpoints\r\n\r\n#### Authentication\r\n- `POST /api/auth/login` - Login and get JWT token\r\n- `GET /api/auth/me` - Get current user info\r\n\r\n#### Databases\r\n- `POST /api/databases` - Create database\r\n- `GET /api/databases` - List databases\r\n- `GET /api/databases/{name}` - Get database details\r\n- `DELETE /api/databases/{name}` - Delete database\r\n\r\n#### Backup & Restore \u2728 NEW!\r\n- `POST /api/databases/{name}/backup` - Create backup\r\n- `GET /api/databases/{name}/backups` - List backups\r\n- `POST /api/databases/{name}/restore` - Restore backup\r\n\r\n#### Audit Logs \u2728 NEW!\r\n- `GET /api/audit/logs` - Get audit logs (admin only)\r\n- `GET /api/audit/statistics` - Get audit statistics (admin only)\r\n\r\n#### User Management \u2728 NEW!\r\n- `POST /api/users` - Create user (admin only)\r\n- `GET /api/users` - List users (admin only)\r\n- `GET /api/users/{username}` - Get user details\r\n- `PUT /api/users/{username}` - Update user (admin only)\r\n- `DELETE /api/users/{username}` - Delete user (admin only)\r\n\r\n#### Data Visualization \u2728 NEW!\r\n- `GET /api/databases/{db}/tables/{table}/visualize` - Generate charts\r\n\r\n#### Tables\r\n- `POST /api/databases/{db}/tables` - Create table\r\n- `GET /api/databases/{db}/tables` - List tables\r\n- `POST /api/databases/{db}/tables/{table}/records` - Insert record\r\n- `GET /api/databases/{db}/tables/{table}/records` - Get records\r\n\r\n#### Collections\r\n- `POST /api/databases/{db}/collections` - Create collection\r\n- `POST /api/databases/{db}/collections/{coll}/documents` - Insert document\r\n- `GET /api/databases/{db}/collections/{coll}/documents` - Get documents\r\n\r\n#### Query\r\n- `POST /api/databases/{db}/query` - Execute query (SQL or NoSQL)\r\n\r\n---\r\n\r\n## \ud83d\udda5\ufe0f CLI Commands\r\n\r\n### Database Management\r\n\r\n```powershell\r\n# Create database\r\npython -m pyhybriddb.cli create my_database\r\n\r\n# Database info\r\npython -m pyhybriddb.cli info my_database\r\n```\r\n\r\n### Server Management\r\n\r\n```powershell\r\n# Start server\r\npython -m pyhybriddb.cli serve\r\n\r\n# Custom host and port\r\npython -m pyhybriddb.cli serve --host 127.0.0.1 --port 8080\r\n\r\n# Enable auto-reload\r\npython -m pyhybriddb.cli serve --reload\r\n```\r\n\r\n### Interactive Shell\r\n\r\n```powershell\r\n# Start shell\r\npython -m pyhybriddb.cli shell my_database\r\n\r\n# In shell:\r\nphdb> CREATE TABLE users (name string, age integer)\r\nphdb> INSERT INTO users (name, age) VALUES ('Alice', 30)\r\nphdb> SELECT * FROM users\r\nphdb> db.posts.insertOne({\"title\": \"Hello\"})\r\nphdb> exit\r\n```\r\n\r\n### Configuration\r\n\r\n```powershell\r\n# View configuration\r\npython -m pyhybriddb.cli config\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcdd Examples\r\n\r\n### Example 1: Basic CRUD\r\n\r\n```python\r\nfrom pyhybriddb import Database\r\n\r\ndb = Database(\"example_db\", path=\"./data\")\r\ndb.create()\r\n\r\n# Create table\r\nusers = db.create_table(\"users\", {\"name\": \"string\", \"age\": \"integer\"})\r\n\r\n# Insert\r\nuser_id = users.insert({\"name\": \"Alice\", \"age\": 30})\r\n\r\n# Select\r\nall_users = users.select()\r\n\r\n# Update\r\nusers.update(where={\"name\": \"Alice\"}, updates={\"age\": 31})\r\n\r\n# Delete\r\nusers.delete(where={\"name\": \"Alice\"})\r\n\r\ndb.close()\r\n```\r\n\r\n### Example 2: NoSQL Collections\r\n\r\n```python\r\nfrom pyhybriddb import Database\r\n\r\nwith Database(\"blog_db\") as db:\r\n posts = db.create_collection(\"posts\")\r\n \r\n # Insert\r\n posts.insert_one({\r\n \"title\": \"My First Post\",\r\n \"tags\": [\"intro\"],\r\n \"views\": 0\r\n })\r\n \r\n # Find\r\n all_posts = posts.find()\r\n intro_posts = posts.find({\"tags\": \"intro\"})\r\n \r\n # Update\r\n posts.update_one(\r\n {\"title\": \"My First Post\"},\r\n {\"$inc\": {\"views\": 1}}\r\n )\r\n \r\n # Aggregate\r\n popular = posts.aggregate([\r\n {\"$sort\": {\"views\": -1}},\r\n {\"$limit\": 5}\r\n ])\r\n```\r\n\r\nSee `examples/basic_usage.py` for more examples.\r\n\r\n---\r\n\r\n## \ud83d\udcc1 Project Structure\r\n\r\n```\r\nD:\\python_db\\\r\n\u251c\u2500\u2500 pyhybriddb/ # Main package\r\n\u2502 \u251c\u2500\u2500 config.py # Configuration\r\n\u2502 \u251c\u2500\u2500 core/ # Database core\r\n\u2502 \u2502 \u251c\u2500\u2500 database.py\r\n\u2502 \u2502 \u251c\u2500\u2500 table.py\r\n\u2502 \u2502 \u2514\u2500\u2500 collection.py\r\n\u2502 \u251c\u2500\u2500 storage/ # Storage engine\r\n\u2502 \u2502 \u251c\u2500\u2500 engine.py\r\n\u2502 \u2502 \u251c\u2500\u2500 file_manager.py\r\n\u2502 \u2502 \u2514\u2500\u2500 index.py\r\n\u2502 \u251c\u2500\u2500 query/ # Query layer\r\n\u2502 \u2502 \u251c\u2500\u2500 parser.py\r\n\u2502 \u2502 \u251c\u2500\u2500 sql_parser.py\r\n\u2502 \u2502 \u251c\u2500\u2500 nosql_parser.py\r\n\u2502 \u2502 \u2514\u2500\u2500 joins.py # \u2728 JOIN operations\r\n\u2502 \u251c\u2500\u2500 api/ # REST API\r\n\u2502 \u2502 \u251c\u2500\u2500 server.py\r\n\u2502 \u2502 \u251c\u2500\u2500 models.py\r\n\u2502 \u2502 \u251c\u2500\u2500 auth.py\r\n\u2502 \u2502 \u2514\u2500\u2500 users.py # \u2728 User management\r\n\u2502 \u251c\u2500\u2500 utils/ # Utilities\r\n\u2502 \u2502 \u251c\u2500\u2500 backup.py # \u2728 Backup & restore\r\n\u2502 \u2502 \u251c\u2500\u2500 audit.py # \u2728 Audit logging\r\n\u2502 \u2502 \u251c\u2500\u2500 encryption.py # \u2728 Encryption\r\n\u2502 \u2502 \u251c\u2500\u2500 visualization.py # \u2728 Data visualization\r\n\u2502 \u2502 \u251c\u2500\u2500 serializer.py\r\n\u2502 \u2502 \u2514\u2500\u2500 logger.py\r\n\u2502 \u251c\u2500\u2500 migration/ # \u2728 Migration tools\r\n\u2502 \u2502 \u251c\u2500\u2500 postgresql.py # PostgreSQL migration\r\n\u2502 \u2502 \u2514\u2500\u2500 mongodb.py # MongoDB migration\r\n\u2502 \u2514\u2500\u2500 cli.py # CLI\r\n\u251c\u2500\u2500 admin/ # Web admin panel\r\n\u2502 \u251c\u2500\u2500 index.html\r\n\u2502 \u251c\u2500\u2500 app.js\r\n\u2502 \u2514\u2500\u2500 auth.js\r\n\u251c\u2500\u2500 examples/ # Examples\r\n\u251c\u2500\u2500 tests/ # Tests\r\n\u251c\u2500\u2500 DEMO.py # Demo script\r\n\u251c\u2500\u2500 config.env # Config template\r\n\u251c\u2500\u2500 requirements.txt\r\n\u251c\u2500\u2500 setup.py\r\n\u2514\u2500\u2500 README.md # This file\r\n```\r\n\r\n---\r\n\r\n## \ud83e\uddea Testing\r\n\r\n### Run Tests\r\n\r\n```powershell\r\n# Run all tests\r\npython -m unittest discover tests\r\n\r\n# Run specific test\r\npython -m unittest tests.test_database.TestDatabase\r\n```\r\n\r\n### Example Test\r\n\r\n```python\r\nimport unittest\r\nfrom pyhybriddb import Database\r\n\r\nclass TestDatabase(unittest.TestCase):\r\n def test_create_database(self):\r\n db = Database(\"test_db\", path=\"./test_data\")\r\n db.create()\r\n self.assertTrue(db.db_file.exists())\r\n db.close()\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd12 Security\r\n\r\n### Best Practices\r\n\r\n1. **Change Default Credentials**\r\n ```env\r\n ADMIN_PASSWORD=YourSecurePassword123!\r\n ```\r\n\r\n2. **Use Strong SECRET_KEY**\r\n ```python\r\n import secrets\r\n print(secrets.token_urlsafe(32))\r\n ```\r\n\r\n3. **Enable HTTPS in Production**\r\n\r\n4. **Restrict CORS Origins**\r\n ```env\r\n CORS_ORIGINS=https://yourdomain.com\r\n ```\r\n\r\n5. **Set Appropriate Log Level**\r\n ```env\r\n LOG_LEVEL=WARNING\r\n ```\r\n\r\n### Security Features\r\n\r\n- \u2705 JWT token authentication\r\n- \u2705 Password hashing with bcrypt\r\n- \u2705 Token expiration (30 minutes)\r\n- \u2705 CORS protection\r\n- \u2705 Input validation\r\n- \u2705 Environment-based secrets\r\n- \u2705 Audit logging for compliance\r\n- \u2705 Encrypted storage option\r\n\r\n---\r\n\r\n## \ud83d\udcca Implementation Status\r\n\r\n### \u2705 **100% Feature Complete**\r\n\r\nAll features from the original PRD have been successfully implemented!\r\n\r\n| Feature | Status | File Location |\r\n|---------|--------|---------------|\r\n| **Core Features** | | |\r\n| Hybrid Data Model | \u2705 Complete | `core/database.py`, `core/table.py`, `core/collection.py` |\r\n| Custom Storage Engine | \u2705 Complete | `storage/engine.py`, `storage/file_manager.py` |\r\n| B-Tree Indexing | \u2705 Complete | `storage/index.py` |\r\n| SQL Query Support | \u2705 Complete | `query/sql_parser.py` |\r\n| NoSQL Query Support | \u2705 Complete | `query/nosql_parser.py` |\r\n| ACID Transactions | \u2705 Complete | `core/database.py` |\r\n| REST API | \u2705 Complete | `api/server.py` |\r\n| Web Admin Panel | \u2705 Complete | `admin/index.html` |\r\n| JWT Authentication | \u2705 Complete | `api/auth.py` |\r\n| CLI Tools | \u2705 Complete | `cli.py` |\r\n| Environment Config | \u2705 Complete | `config.py` |\r\n| **Advanced Features** | | |\r\n| Backup & Restore | \u2705 Complete | `utils/backup.py` |\r\n| Audit Logging | \u2705 Complete | `utils/audit.py` |\r\n| User Management | \u2705 Complete | `api/users.py` |\r\n| JOIN Operations | \u2705 Complete | `query/joins.py` |\r\n| Data Visualization | \u2705 Complete | `utils/visualization.py` |\r\n| PostgreSQL Migration | \u2705 Complete | `migration/postgresql.py` |\r\n| MongoDB Migration | \u2705 Complete | `migration/mongodb.py` |\r\n| Encrypted Storage | \u2705 Complete | `utils/encryption.py` |\r\n| Import/Export | \u2705 Complete | `admin/app.js` |\r\n\r\n**Total: 20/20 Features (100%)**\r\n\r\n### \ud83d\udcc8 Project Metrics\r\n\r\n- **Python Modules**: 40+\r\n- **Lines of Code**: ~10,000+\r\n- **API Endpoints**: 25+\r\n- **Test Coverage**: Core functionality\r\n- **Documentation**: Comprehensive\r\n\r\n### \ud83c\udfaf Production Ready\r\n\r\n\u2705 All core features implemented \r\n\u2705 All advanced features implemented \r\n\u2705 Security features complete \r\n\u2705 Operational tools ready \r\n\u2705 Migration tools available \r\n\u2705 Comprehensive documentation \r\n\u2705 Working examples provided \r\n\u2705 Server tested and running \r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick Start Guide\r\n\r\n### Installation\r\n\r\n```powershell\r\n# Clone repository\r\ngit clone https://github.com/Adrient-tech/PyHybridDB.git\r\ncd PyHybridDB\r\n\r\n# Create virtual environment\r\npython -m venv venv\r\n.\\venv\\Scripts\\activate\r\n\r\n# Install dependencies\r\npip install -r requirements.txt\r\n\r\n# Install package\r\npip install -e .\r\n```\r\n\r\n### Start Server\r\n\r\n```powershell\r\npython -m pyhybriddb.cli serve\r\n```\r\n\r\nServer will start at: http://localhost:8000\r\n\r\n### Access Points\r\n\r\n- **API Docs**: http://localhost:8000/docs\r\n- **Admin Panel**: Open `admin/index.html` in browser\r\n- **Default Login**: admin / admin123\r\n\r\n### Run Demo\r\n\r\n```powershell\r\npython DEMO.py\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcde Support & Contributing\r\n\r\n### Support\r\n- **GitHub Issues**: Report bugs and request features\r\n- **Documentation**: See this README and inline docs\r\n- **Examples**: Check `examples/` directory\r\n\r\n### Contributing\r\nContributions are welcome! Please:\r\n1. Fork the repository\r\n2. Create a feature branch\r\n3. Make your changes\r\n4. Submit a pull request\r\n\r\n### Development Setup\r\n\r\n```powershell\r\n# Install dev dependencies\r\npip install -r requirements.txt\r\n\r\n# Run tests\r\npython -m unittest discover tests\r\n\r\n# Start with auto-reload\r\npython -m pyhybriddb.cli serve --reload\r\n```\r\n\r\n---\r\n\r\n## \ud83c\udf93 Learning Resources\r\n\r\n1. **Quick Start**: This README\r\n2. **API Reference**: http://localhost:8000/docs (when server running)\r\n3. **Examples**: `examples/basic_usage.py`\r\n4. **Demo Script**: `python DEMO.py`\r\n5. **Original PRD**: `project.md`\r\n\r\n---\r\n\r\n## \ud83d\udcc4 License\r\n\r\nMIT License\r\n\r\nCopyright (c) 2025 Adrient.com - Developed by Infant Nirmal\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.\r\n\r\n---\r\n\r\n## \ud83d\udcde Support\r\n\r\n- **Issues**: Report bugs on GitHub Issues\r\n- **Documentation**: See this README and `project.md`\r\n- **Examples**: Check `examples/` directory\r\n- **Demo**: Run `python DEMO.py`\r\n\r\n---\r\n\r\n## \ud83c\udfaf Roadmap\r\n\r\n### Phase 1: Core Features \u2705 COMPLETE\r\n- \u2705 Core storage engine\r\n- \u2705 Hybrid data model\r\n- \u2705 SQL & NoSQL query support\r\n- \u2705 REST API\r\n- \u2705 Admin panel\r\n- \u2705 JWT Authentication\r\n- \u2705 CLI Tools\r\n\r\n### Phase 2: Advanced Features \u2705 COMPLETE\r\n- \u2705 Backup & Restore\r\n- \u2705 Audit Logging\r\n- \u2705 User Management\r\n- \u2705 JOIN Operations\r\n- \u2705 Data Visualization\r\n- \u2705 PostgreSQL Migration\r\n- \u2705 MongoDB Migration\r\n- \u2705 Encrypted Storage\r\n- \u2705 Import/Export\r\n\r\n### Phase 3: Future Enhancements (Optional)\r\n- Multi-Factor Authentication (2FA)\r\n- Full-Text Search\r\n- Compound Indexes\r\n- Advanced Query Optimization\r\n- Replication & High Availability\r\n- Sharding & Horizontal Scaling\r\n- GraphQL API\r\n- Real-time Subscriptions\r\n- Cloud Storage Backends (S3, Azure, GCP)\r\n- Plugin System & Extensions\r\n\r\n---\r\n\r\n## \ud83d\ude4f Acknowledgments\r\n\r\nInspired by:\r\n- **PostgreSQL** - Relational model\r\n- **MongoDB** - Document model\r\n- **SQLite** - Embedded database\r\n- **phpMyAdmin** - Admin interface\r\n\r\n---\r\n\r\n## \ud83d\udcca Project Stats\r\n\r\n- **Lines of Code**: ~10,000+\r\n- **Python Modules**: 40+\r\n- **Total Files**: 45+\r\n- **API Endpoints**: 25+\r\n- **Features**: 20/20 (100% Complete)\r\n- **Version**: 1.0.0 (Production Ready)\r\n- **Python**: 3.10+\r\n- **Platform**: Cross-platform\r\n- **License**: MIT\r\n\r\n---\r\n\r\n**Built with \u2764\ufe0f by Infant Nirmal at Adrient.com**\r\n\r\n**GitHub**: [https://github.com/Adrient-tech/PyHybridDB.git](https://github.com/Adrient-tech/PyHybridDB.git)\r\n\r\n*Last Updated: October 25, 2025*\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A production-ready hybrid database system combining SQL and NoSQL with enterprise features",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/Adrient-tech/PyHybridDB/issues",
"Documentation": "https://github.com/Adrient-tech/PyHybridDB#readme",
"Homepage": "https://github.com/Adrient-tech/PyHybridDB",
"Repository": "https://github.com/Adrient-tech/PyHybridDB"
},
"split_keywords": [
"database",
" hybrid",
" sql",
" nosql",
" mongodb",
" postgresql",
" fastapi",
" rest-api",
" backup",
" audit",
" encryption"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fe0a1e17a60967671320445410a35c395fd431bd1bac3df4ed42d83f7fa281ed",
"md5": "a2b7565c3cb7a3a0ef374cd8aa9454f5",
"sha256": "afb40d7260db3048ff5dc4f58968076143d08d619af72cb167633ddc4ba1a02c"
},
"downloads": -1,
"filename": "pyhybriddb-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2b7565c3cb7a3a0ef374cd8aa9454f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 7755582,
"upload_time": "2025-10-25T04:57:31",
"upload_time_iso_8601": "2025-10-25T04:57:31.538353Z",
"url": "https://files.pythonhosted.org/packages/fe/0a/1e17a60967671320445410a35c395fd431bd1bac3df4ed42d83f7fa281ed/pyhybriddb-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3ce2144dafc505371175469a0c389c3899fc54a3d8a03b9b2f8299230d0ccda3",
"md5": "b9a65af2d957a1d5e54ce1b42e636eae",
"sha256": "ef80010edd20eff580847b2f08dbe25f3a604bdeb4a219c55669b56ec73a8348"
},
"downloads": -1,
"filename": "pyhybriddb-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "b9a65af2d957a1d5e54ce1b42e636eae",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6463967,
"upload_time": "2025-10-25T04:57:36",
"upload_time_iso_8601": "2025-10-25T04:57:36.426368Z",
"url": "https://files.pythonhosted.org/packages/3c/e2/144dafc505371175469a0c389c3899fc54a3d8a03b9b2f8299230d0ccda3/pyhybriddb-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-25 04:57:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Adrient-tech",
"github_project": "PyHybridDB",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "fastapi",
"specs": [
[
"==",
"0.104.1"
]
]
},
{
"name": "uvicorn",
"specs": [
[
"==",
"0.24.0"
]
]
},
{
"name": "pydantic",
"specs": [
[
"==",
"2.5.0"
]
]
},
{
"name": "python-multipart",
"specs": [
[
"==",
"0.0.6"
]
]
},
{
"name": "python-jose",
"specs": [
[
"==",
"3.3.0"
]
]
},
{
"name": "passlib",
"specs": [
[
"==",
"1.7.4"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.4.4"
]
]
},
{
"name": "aiofiles",
"specs": [
[
"==",
"23.2.1"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "bcrypt",
"specs": [
[
"==",
"4.1.1"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"41.0.7"
]
]
},
{
"name": "psycopg2-binary",
"specs": [
[
"==",
"2.9.9"
]
]
},
{
"name": "pymongo",
"specs": [
[
"==",
"4.6.0"
]
]
},
{
"name": "email-validator",
"specs": [
[
"==",
"2.1.0"
]
]
}
],
"lcname": "pyhybriddb"
}