Embedded JSONL DB with strict schema, in-file header (schema+taxonomies), in-memory indexes, and fast regex queries.
Project description
Embedded JSONL DB Engine
Human-readable and human-editable storage for serializable objects. A single JSONL file acts as a database with a typed schema and taxonomies stored in the header. Appends-only write model means you don't rewrite the whole file on every change. The schema exists but can evolve freely: add new fields at any time, and the database will self-adapt by materializing defaults and preserving existing data without manual migrations. For simple predicates we use a fast regex plan; otherwise we fall back to full JSON parsing. Single-writer model with explicit compaction, rolling & daily backups, and external BLOB storage.
Status: alpha (0.1.0a2). Core features implemented: file I/O, in-memory indexes, CRUD, compaction, backups, taxonomy header + migrations, external BLOBs. Fast-regex plan is integrated for simple queries; complex queries fall back to full parse.
Test status
- Full test suite passes locally (CRUD, queries, performance, backups retention, corruption handling, schema migration, taxonomy ops, blobs GC).
- Note on parallelism: current engine favors simplicity and deterministic ordering; regex fast-path and index build operate single-threaded to avoid GIL/IPC overhead. Parallel scan/parse across CPU cores can be added later via multiprocessing if workloads demand it.
- Run: ./run-tests.sh
- Reference run (on Dev machine):
- 21 passed in ~9s
- reopen and build indexes for 10000 records: ~0.47s
- fast-plan query (>= 5000) matched=5000: ~0.63s
- full-parse query (same predicate via $or) matched=5000: ~0.72s
Install
- pip install embedded_jsonl_db_engine
Quick start
Install
- pip install embedded_jsonl_db_engine
Minimal example (quick_start.py)
from embedded_jsonl_db_engine import Database
SCHEMA = {
"id": {"type": "str", "mandatory": False, "index": True},
"name": {"type": "str", "mandatory": True, "index": True},
"age": {"type": "int", "mandatory": False, "default": 0, "index": True},
"flags": {
"type": "object",
"fields": {
"active": {"type": "bool", "mandatory": False, "default": True, "index": True},
},
},
"createdAt": {"type": "datetime", "mandatory": False, "index": True},
}
db = Database(path="demo.jsonl", schema=SCHEMA, mode="+")
rec = db.new()
rec["name"] = "Alice"
rec["age"] = 33
rec.save()
loaded = db.get(rec.id)
print("Loaded:", loaded)
for r in db.find({"flags": {"active": True}, "age": {"$gte": 18}}):
print("Adult active:", r["name"], r["age"])
Run the example
- python examples/quick_start.py
Contributing
- Development setup: run ./setup.sh to install dev extras, then ruff and pytest locally.
- Roadmap: implement storage I/O, open/index build, CRUD, compaction/backups, taxonomy migrations, blobs.
What has been implemented so far
-
Low-level file I/O (FileStorage): cross-platform exclusive lock, header read/write/rewrite, append meta+data with fsync, meta scan with offsets, atomic replace.
-
Database open with progress: lock, header init if missing, base meta index rebuild, secondary/reverse index build.
-
In-memory indexes: secondary (scalar) and reverse (taxonomy) indexes; built on open and maintained on save()/delete(); prefilter in find().
-
CRUD: new() with defaults, get() (with optional meta), save() with schema validation and canonical JSON, find() with predicate evaluation + index prefilter, update(), delete() (logical).
-
Queries: field projection (fields=[...]), ordering (supports nested paths "a/b"), skip/limit; is_simple_query() helper; fast regex plan for simple scalar predicates with fallback to full json.loads.
-
Maintenance: compact_now() (garbage ratio ≥ 0.30), backup_now() (rolling and daily .gz) with progress events.
-
Taxonomies: header-only updates (rewrite_header), full migrations (rename/merge/delete detach) with progress; strict schema validation for taxonomy-backed fields.
-
BLOBs: external CAS by sha256 with put/open/gc and Database wrappers.
-
Utilities: ISO timestamps, epoch converters, canonical JSON, sha256, ULID-like ids.
License MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file embedded_jsonl_db_engine-0.1.0a7.tar.gz.
File metadata
- Download URL: embedded_jsonl_db_engine-0.1.0a7.tar.gz
- Upload date:
- Size: 39.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0468e359d13221c0bc81ff500ee50676c6a0407a6fbc2510512c78a94b8fc31
|
|
| MD5 |
e339e599235557ad2d823b487b66b966
|
|
| BLAKE2b-256 |
f4a9914732848d5522996d283ddd17892ab34d68c3da6fbae61de25ee1c56ee4
|
Provenance
The following attestation bundles were made for embedded_jsonl_db_engine-0.1.0a7.tar.gz:
Publisher:
publish.yml on mykolarudenko/embedded_jsonl_db_engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
embedded_jsonl_db_engine-0.1.0a7.tar.gz -
Subject digest:
a0468e359d13221c0bc81ff500ee50676c6a0407a6fbc2510512c78a94b8fc31 - Sigstore transparency entry: 544305104
- Sigstore integration time:
-
Permalink:
mykolarudenko/embedded_jsonl_db_engine@6796447729c7ffd5b246656ace746b18d79f4f75 -
Branch / Tag:
refs/tags/v0.1.0a7 - Owner: https://github.com/mykolarudenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6796447729c7ffd5b246656ace746b18d79f4f75 -
Trigger Event:
push
-
Statement type:
File details
Details for the file embedded_jsonl_db_engine-0.1.0a7-py3-none-any.whl.
File metadata
- Download URL: embedded_jsonl_db_engine-0.1.0a7-py3-none-any.whl
- Upload date:
- Size: 33.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36da3870a214c880b550ab8121bad98dc99580c3295f5efaf8b4f345d480aaa0
|
|
| MD5 |
ab3e29f6c1bf067498268868febb6761
|
|
| BLAKE2b-256 |
fc96ff3623b454e0a53dfd579786bbc99807849ec1b4512d99466f26b0b21eac
|
Provenance
The following attestation bundles were made for embedded_jsonl_db_engine-0.1.0a7-py3-none-any.whl:
Publisher:
publish.yml on mykolarudenko/embedded_jsonl_db_engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
embedded_jsonl_db_engine-0.1.0a7-py3-none-any.whl -
Subject digest:
36da3870a214c880b550ab8121bad98dc99580c3295f5efaf8b4f345d480aaa0 - Sigstore transparency entry: 544305118
- Sigstore integration time:
-
Permalink:
mykolarudenko/embedded_jsonl_db_engine@6796447729c7ffd5b246656ace746b18d79f4f75 -
Branch / Tag:
refs/tags/v0.1.0a7 - Owner: https://github.com/mykolarudenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6796447729c7ffd5b246656ace746b18d79f4f75 -
Trigger Event:
push
-
Statement type: