Skip to main content

OverDrive-DB — Embedded document database with ACID transactions, AES-256 encryption, WAL durability and 6 storage engines. SQLite alternative for Python.

Project description

⚡ overdrive-db

Embeddable hybrid SQL+NoSQL document database for Python
Like SQLite, but for JSON. Zero config. No server. ACID transactions.

PyPI license


Install

pip install overdrive-db

Requires the native overdrive.dll (Windows) / liboverdrive.so (Linux) / liboverdrive.dylib (macOS) in the lib/{os}-{arch}/ directory. Download from GitHub Releases.


Quick Start

from overdrive import OverdriveDb

odb = OverdriveDb.open("myapp.odb")

# Create table
odb.create_table("users")

# Insert — returns the generated _id
id = odb.insert("users", {"name": "Alice", "age": 30})

# Get by ID
doc = odb.get("users", id)
print(doc)  # {'_id': '...', 'name': 'Alice', 'age': 30}

# SQL Query
rows = odb.query("SELECT * FROM users WHERE age > 25")

# Update
odb.update("users", id, {"age": 31})

# Delete
odb.delete("users", id)

odb.close()

Context manager:

with OverdriveDb.open("myapp.odb") as odb:
    odb.create_table("users")
    id = odb.insert("users", {"name": "Bob"})
    print(odb.get("users", id))

API Reference

Open / Close

odb = OverdriveDb.open(path)                         # plain open
odb = OverdriveDb.open(path, password="secret")      # encrypted
odb = OverdriveDb.open(path, engine="RAM")           # in-memory

odb.sync()   # flush to disk
odb.close()  # release handle

OverdriveDb.version()  # native library version string

Tables

odb.create_table("users")
odb.drop_table("users")
odb.list_tables()          # → ['users', 'products', ...]
odb.table_exists("users")  # → True / False

CRUD

Method Returns Description
odb.insert(table, doc) str (_id) Insert a document
odb.insert_many(table, docs) list[str] Insert multiple documents
odb.get(table, id) dict | None Get document by _id
odb.update(table, id, patch) bool Update document by _id
odb.delete(table, id) bool Delete document by _id
odb.count(table) int Count documents in table

Query

# SQL query — returns list of dicts
rows = odb.query("SELECT * FROM users ORDER BY age DESC LIMIT 10")

# Full-text search
results = odb.search("users", "Alice")

Transactions

from overdrive import IsolationLevel

# Callback style (auto-commit / auto-abort)
def transfer(odb):
    odb.insert("logs", {"event": "login"})

odb.transaction(transfer, IsolationLevel.SERIALIZABLE)

# Manual style
txn = odb.begin_transaction(IsolationLevel.READ_COMMITTED)
try:
    odb.insert("logs", {"event": "login"})
    odb.commit_transaction(txn)
except Exception:
    odb.abort_transaction(txn)
    raise

Isolation Levels:

Name Value
IsolationLevel.READ_UNCOMMITTED 0
IsolationLevel.READ_COMMITTED 1 (default)
IsolationLevel.REPEATABLE_READ 2
IsolationLevel.SERIALIZABLE 3

Integrity Check

report = odb.verify_integrity()
print(report)  # {'status': 'ok', ...}

6 Storage Engines

odb = OverdriveDb.open("app.odb")                            # Disk (default)
odb = OverdriveDb.open("cache.odb", engine="RAM")            # in-memory
odb = OverdriveDb.open("vecs.odb", engine="Vector")          # embeddings
odb = OverdriveDb.open("ts.odb", engine="Time-Series")       # metrics/IoT
odb = OverdriveDb.open("g.odb", engine="Graph")              # social graphs
odb = OverdriveDb.open("q.odb", engine="Streaming")          # event queue

More SDKs

pip install overdrive-db          # Python  ← you are here
npm install overdrive-db          # Node.js
cargo add overdrive-db            # Rust
go get github.com/ALL-FOR-ONE-TECH/overdrive-db-go@v1.0.0

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

overdrive_db-2.3.1.tar.gz (15.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

overdrive_db-2.3.1-py3-none-any.whl (16.0 MB view details)

Uploaded Python 3

File details

Details for the file overdrive_db-2.3.1.tar.gz.

File metadata

  • Download URL: overdrive_db-2.3.1.tar.gz
  • Upload date:
  • Size: 15.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for overdrive_db-2.3.1.tar.gz
Algorithm Hash digest
SHA256 9db63cd6c8458d61a4eb04750eefd2d42ee2c1850b772e4caf4bfe7fbb6546f9
MD5 008d5f2fe84e902dde1bd2264455410e
BLAKE2b-256 1b8c45190f08ecd2aa1a31b673d78bbeb87a043f963a5aad01f8d0a7c4f5ea4b

See more details on using hashes here.

File details

Details for the file overdrive_db-2.3.1-py3-none-any.whl.

File metadata

  • Download URL: overdrive_db-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for overdrive_db-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b57ff4dfc057fe09b858c80166baaedae65a1be005a4defe767a6b4d1e6fc183
MD5 3eb8d3d456df38d03e40293378835d48
BLAKE2b-256 5a6fb809095f62843b7f357c3dd8fbac483136b10d478261bd85dff18d3b54dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page