Metadata-Version: 2.4
Name: soketdb
Version: 1.5.3
Summary: SoketDB — a zero-setup, AI-smart JSON database built for developers who value speed, simplicity, and offline capability.
Home-page: https://github.com/pythos-team/soketdb
Author: Alex Austin
Author-email: Alex Austin <benmap40@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/pythos-team/soketdb
Project-URL: Bug Tracker, https://github.com/pythos-team/soketdb/issues
Project-URL: Documentation, https://github.com/pythos-team/soketdb#readme
Keywords: database,json,sql,ai,offline,lightweight,huggingface,google-drive,cloud-sync,aws,dropbox,encryption
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sqlparse~=0.4
Requires-Dist: requests~=2.28
Requires-Dist: redis~=4.5
Provides-Extra: huggingface
Requires-Dist: huggingface_hub~=0.16; extra == "huggingface"
Provides-Extra: aws
Requires-Dist: boto3~=1.26; extra == "aws"
Provides-Extra: gdrive
Requires-Dist: google-api-python-client~=2.70; extra == "gdrive"
Requires-Dist: google-auth-oauthlib~=1.0; extra == "gdrive"
Requires-Dist: google-auth-httplib2~=0.1; extra == "gdrive"
Provides-Extra: dropbox
Requires-Dist: dropbox~=11.36; extra == "dropbox"
Provides-Extra: encryption
Requires-Dist: cryptography~=39.0; extra == "encryption"
Provides-Extra: full
Requires-Dist: huggingface_hub~=0.16; extra == "full"
Requires-Dist: boto3~=1.26; extra == "full"
Requires-Dist: google-api-python-client~=2.70; extra == "full"
Requires-Dist: google-auth-oauthlib~=1.0; extra == "full"
Requires-Dist: google-auth-httplib2~=0.1; extra == "full"
Requires-Dist: dropbox~=11.36; extra == "full"
Requires-Dist: cryptography~=39.0; extra == "full"
Provides-Extra: dev
Requires-Dist: pytest~=7.0; extra == "dev"
Requires-Dist: pytest-cov~=4.0; extra == "dev"
Requires-Dist: black~=22.0; extra == "dev"
Requires-Dist: mypy~=0.990; extra == "dev"
Requires-Dist: flake8~=5.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# ⚡ SoketDB v2.0 — The Production-Ready Database That Runs Anywhere

> **No setup. No servers. No compromises.**
> SoketDB v2.0 transforms from a simple JSON database into a full-featured, ACID-compliant database engine with PostgreSQL-like capabilities — while maintaining zero setup and offline-first philosophy.

---

## 🎊 **MAJOR UPGRADE: SoketDB v2.0**

**This is NOT just an update — it's a complete reimagining of what SoketDB can be.**

The original SoketDB was a smart JSON database. **SoketDB v2.0 is now a production-ready database engine** with all the features you'd expect from PostgreSQL, but with zero setup and AI-powered queries.

### ✨ **What's New in v2.0:**

#### 🏛️ **PostgreSQL-Like Architecture**
- **Write-Ahead Logging (WAL)** — Guaranteed durability and crash recovery
- **Multi-Version Concurrency Control (MVCC)** — Full transaction isolation levels
- **Connection Pooling** — Proper database connections with `Connection` and `Cursor` objects
- **ACID Compliance** — Atomicity, Consistency, Isolation, Durability

#### 📊 **Advanced Query Features**
- **Full JOIN Support** — Inner, Left, Right, and Cross joins
- **Subqueries & CTEs** — Common Table Expressions for complex queries
- **Window Functions** — ROW_NUMBER(), RANK(), LEAD(), LAG()
- **Aggregate Functions** — COUNT, SUM, AVG, MIN, MAX with GROUP BY
- **Full-Text Search** — Built-in search capabilities

#### 🔧 **Database Objects**
- **Indexes** — B-tree, Hash, and GIN (Generalized Inverted Index) for JSON
- **Constraints** — PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, DEFAULT
- **Sequences** — Auto-incrementing columns
- **Views** — Virtual tables based on queries
- **Stored Procedures** — Custom functions (coming soon)

#### 🔐 **Enterprise Security**
- **Production Encryption** — AES-256 encryption for data at rest
- **Automatic Key Management** — Secure key generation and storage
- **Encrypted Backups** — All cloud backups are encrypted
- **Environment Variable Support** — Secure credential management

#### ☁️ **Intelligent Cloud Integration**
- **Automatic Backup Restoration** — Always queries from backup for latest data
- **Hard Read/Write** — Guaranteed persistence with multiple backup layers
- **Smart Caching** — Always fetches latest data without explicit restore()
- **Multi-Provider Support** — HuggingFace, Google Drive, AWS S3, Dropbox

#### 🧠 **Enhanced AI Engine**
- **Natural Language to SQL** — Even smarter query translation
- **Query Optimization** — Automatic execution plan generation
- **Query Caching** — 5-minute cache for frequently run queries
- **Performance Stats** — Detailed database performance metrics

#### 📋 **New Database Objects & Methods**

```python
# Connections & Cursors (like PostgreSQL)
conn = db.get_connection()
cursor = conn.cursor()
cursor.execute("SELECT * FROM users")
row = cursor.fetchone()  # ✅ YES, fetchone() works!
rows = cursor.fetchall()
batch = cursor.fetchmany(10)

# Transactions with isolation levels
conn.begin(isolation_level=IsolationLevel.SERIALIZABLE)
try:
    conn.execute("UPDATE accounts SET balance = balance - 100 WHERE id = 1")
    conn.execute("UPDATE accounts SET balance = balance + 100 WHERE id = 2")
    conn.commit()
except:
    conn.rollback()

# Indexes
db.create_index("users", "email", IndexType.BTREE)
db.create_index("users", "metadata", IndexType.GIN)  # For JSON fields

# Constraints
db.add_constraint("users", "pk_users", ConstraintType.PRIMARY_KEY, ["id"])
db.add_constraint("users", "unique_email", ConstraintType.UNIQUE, ["email"])
db.add_constraint("users", "age_check", ConstraintType.CHECK, ["age"], check_expr="age >= 0 AND age <= 150")

# Advanced queries
result = db.execute("""
    WITH user_orders AS (
        SELECT u.name, COUNT(o.id) as order_count
        FROM users u
        LEFT JOIN orders o ON u.id = o.user_id
        GROUP BY u.id, u.name
    )
    SELECT name, order_count,
           RANK() OVER (ORDER BY order_count DESC) as rank
    FROM user_orders
""")
