functualize-state-sqlite
Status: Published — Independently installable from PyPI.
SQLite-backed state persistence and execution tracking plugin for functualize. Implements the StateBackend and ExecutionStore protocols from functualize-state, providing durable key-value storage and full execution history using a local SQLite database in WAL mode. Zero external dependencies beyond the Python standard library's sqlite3 module.
Installation
pip install functualize-state-sqlite
Quick Start
from functualize_state_sqlite import SQLiteStateBackend
# Use as a context manager for automatic cleanup
with SQLiteStateBackend(db_path="my_app.db") as backend:
backend.set("deploy_count", 42)
backend.set("last_env", "staging")
count = backend.get("deploy_count")
print(f"Deployments: {count}")
keys = backend.keys(prefix="deploy")
print(f"Keys: {keys}")
Features
- Persistent key-value state — JSON-encoded values stored in SQLite with automatic schema initialization
- WAL mode for concurrency — concurrent read access without blocking writes, suitable for multi-process environments
- Execution tracking — full session and execution history with nested invocation support and phase recording
- Namespace-scoped state —
SQLiteStateStoreprovides per-job namespace isolation within workflow scopes - Context manager support — all backends support
withstatements for automatic connection cleanup - Zero external dependencies — uses only Python's built-in
sqlite3module - Automatic schema migrations — database schema is created and migrated transparently on first access
API Reference
Public classes exported by this plugin:
SQLiteStateBackend— Implements theStateBackendprotocol withget(),set(),delete(), andkeys()methods for persistent key-value storage using a dedicatedkv_statetable.SQLiteExecutionStore— Implements theExecutionStoreprotocol for recording and querying execution records and phase tracking. Methods includeinsert_execution(),update_execution(),get_session_executions(),insert_phase(), andget_execution_phases().SQLiteStatePlugin— Plugin that registersSQLiteStateBackendandSQLiteExecutionStorewith the DI registry at boot time. Hooks intoAPP_READYandON_SCOPE_CREATEDlifecycle events.ExecutionStatePlugin— Full lifecycle plugin that tracks job executions automatically. Hooks intoBEFORE_JOB,AFTER_SUCCESS,AFTER_FAILURE,INVOKE_START,INVOKE_END, andON_SCOPE_CREATEDfor comprehensive execution history.
Internal classes (available via direct import but not part of the public protocol surface):
SQLiteBackend— Low-level connection manager with WAL mode, schema initialization, and query helpers for sessions, executions, steps, and namespaced state.SQLiteStateStore—StateStoreProtocolimplementation scoped to a(scope_id, job_namespace)pair, withget(),set(),delete(),keys(),to_dict(),clear(), and cross-job access viaget_job_state().ExecutionTracker— High-level session management and execution recording with automatic session resume based on TTL, and AI context summary generation viato_ai_context().
Development
Run plugin tests:
uv run pytest plugins/functualize-state-sqlite/tests/ -v
Build the package:
uv build --package functualize-state-sqlite
Release files for functualize-state-sqlite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| functualize_state_sqlite-0.1.0.tar.gz | 29.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| functualize_state_sqlite-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.0 kB
Release files / functualize_state_sqlite-0.1.0.tar.gz
| Download URL | functualize_state_sqlite-0.1.0.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6674afeb4eb1eca3bc84a7ee885acfb504c4da4324fc7cfd2bcebf7b493dbec7
|
|
BLAKE2b-256 checksum How to use checksums |
3fe2beda73fe58f9f7a2d5b89a5dfea419af21798f5bc016072a4966d366d148
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / functualize_state_sqlite-0.1.0-py3-none-any.whl
| Download URL | functualize_state_sqlite-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
535b69b81d3d460e7538c50b75a8bec4b4fa8f977ed653d7368ea5ddc69d1f7a
|
|
BLAKE2b-256 checksum How to use checksums |
3d162584d678e752dee109fb7ddd3c4644499539d179b32dbc1d3254a721ae7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|