Metadata-Version: 2.4
Name: vanilladatabase
Version: 1.2.0
Summary: Official Python SDK for VanillaDatabase - Multi-tenant SQLite Engine with Realtime & Media Storage
Author-email: Elaina2026 <ariaasamane@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/Elaina2026/VanillaDB
Project-URL: Bug Tracker, https://github.com/Elaina2026/VanillaDB/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0

# VanillaDatabase Python SDK

Official Python client for VanillaDatabase (VanillaDB) - Multi-Tenant SQLite Cloud Engine with Realtime Event Subscriptions, Database-Scoped Media Storage, AI Vector Search, and Batch Transactions.

## Installation

```bash
pip install vanilladatabase
```

## Quickstart

```python
import os
from vanilladb import VanillaDatabase

# 1. Initialize Client
db = VanillaDatabase(
    url=os.getenv("VANILLA_DB_URL", "http://localhost:3000/v1/databases/db_your_database_id"),
    token=os.getenv("VANILLA_DB_TOKEN", "vdb_live_your_api_token_here")
)

# 2. Table CRUD Builder (No SQL needed)
# Insert row
db.table("users").insert({"username": "elaina", "score": 250})

# Select rows
users = db.table("users").select(limit=10, order_by="score", order="DESC")
print("Top Users:", users["rows"])

# Delete row
db.table("users").delete({"id": 1})

# 3. AI Vector Cosine Similarity Search
matches = db.vector_search(
    table="documents",
    vector_column="embedding",
    vector=[0.12, 0.45, -0.23, 0.89],
    limit=5,
    threshold=0.75
)
print("Vector Matches:", matches)

# 4. Parameterized Raw SQL Query
result = db.query("SELECT * FROM users WHERE score >= ?", [100])
print("Users:", result["rows"])

# 5. Atomic Batch Transaction
db.batch([
    {"sql": "UPDATE users SET score = score - ? WHERE id = ?", "params": [50, 1]},
    {"sql": "INSERT INTO logs (event) VALUES (?)", "params": ["score_deducted"]}
], transaction=True)

# 6. Media Storage (Upload, Stream & Delete)
file_info = db.upload_file("avatar.png", filename="avatar.png", content_type="image/png")
print("Stream URL (Range 206):", db.get_file_url(file_info["id"]))
db.delete_file(file_info["id"])

# 7. Realtime SSE Event Stream
def on_event(event):
    print("Live Event:", event)

# Blocking subscription:
# db.subscribe(on_event, table="users")
```
```
