Skip to main content

PyPI Python License

evoid-sqlite

SQLite storage engine for EVOID — Intent Handler system

Quick StartIntent HandlerConfigAPI


Quick Start

uv add evoid-sqlite

Method 1: Intent Handler (Recommended)

from evoid_sqlite import register_handlers
from evoid.core.storage import storage_read, storage_write, storage_delete

# Register SQLite as storage handler
register_handlers(db_path="my_app.db")

# Use high-level API — goes through Intent pipeline
await storage_write("user:1", {"name": "Alice", "role": "admin"})
user = await storage_read("user:1")
await storage_delete("user:1")

Method 2: Direct API

from evoid_sqlite import create_storage

storage = create_storage("my_app.db")
await storage.write("user:1", {"name": "Alice"})
user = await storage.read("user:1")

Intent Handler

evoid-sqlite registers these Intent handlers:

Intent Handler Description
storage.read handle_read Read from SQLite
storage.write handle_write Write to SQLite
storage.delete handle_delete Delete from SQLite
storage.health handle_health Check connection

How it works

  1. register_handlers() registers Intent handlers for storage operations
  2. storage_read() / storage_write() create Intents and execute through pipeline
  3. Pipeline routes to SQLite handler
  4. Handler connects to SQLite and performs operation

Configuration

TOML

[engines]
storage = "sqlite"

[engines.options.sqlite]
db_path = "data/my_app.db"

Python

from evoid.config import config

app = config(
    engines={
        "storage": "sqlite",
        "options": {
            "sqlite": {"db_path": "data/production.db"},
        },
    },
)

API

register_handlers(db_path: str)

Register SQLite as Intent handlers.

Parameter Type Default Description
db_path str evoid.db Path to SQLite database file

create_storage(db_path: str) -> SQLiteStorage

Factory function for direct API access.

Methods

Method Signature Returns Description
read async read(key: str) Any | None Read value by key
write async write(key: str, data: dict) bool Write value (JSON serialized)
delete async delete(key: str) bool Delete by key
health async health() bool Check connection
list_keys async list_keys(namespace: str) list[str] List all keys

Dependencies

  • evoid>=0.4.3
  • aiosqlite>=0.20.0

Optional

  • evoid-di>=0.1.0 — for DI integration (auto-registered when register_handlers() is called)

DI Integration

When you call register_handlers(), SQLite is auto-registered as storage.sqlite in evoid-di:

from evoid_di import di

# After register_handlers(), this works:
storage = di.resolve("storage.sqlite")

# Or as a fallback for PostgreSQL:
di.set_fallback("storage.postgresql", ["storage.sqlite"])

Links

License

MIT

Release files for evoid-sqlite 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for evoid-sqlite 0.2.0
File Interpreter ABI Platform
evoid_sqlite-0.2.0-py3-none-any.whl Python 3 none any Details

Release files / evoid_sqlite-0.2.0-py3-none-any.whl

Download URL evoid_sqlite-0.2.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
187beabd47c17668d5fe01594c4e5bc05289766cfdc76e11633d58ee2df5d701
BLAKE2b-256 checksum
How to use checksums
be56c9793944c3731cf1967d0f3b61f6a32c33acc18f1181b8ddcd2bdaf4a416
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page