Skip to main content

JSONLDB

A NoSQL database built on JSONL format with LMDB indexing and Write-Ahead Log (WAL) for durability.

Features

  • JSONL Storage - Records stored as JSON Lines
  • LMDB Indexing - Fast key-value index for lookups
  • WAL Architecture - Write-Ahead Log ensures durability
  • Compaction - Periodic compaction to merge WAL into data file
  • Secondary Indexes - Index specific fields for fast queries

Installation

pip install jsonldb

Or install from source:

pip install -e .

Quick Start

from jsonldb import Database

# Create database with indexed fields
db = Database("/path/to/db", index_fields=["email", "age"])

# Insert a record
id = db.insert({"name": "Alice", "email": "alice@example.com", "age": 30})

# Get by ID
record = db.get(id)
print(record.data)  # {'name': 'Alice', 'email': 'alice@example.com', 'age': 30}

# Query by indexed field
for r in db.query("age", 30):
    print(r.data)

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

# Delete
db.delete(id)

# Compact - rebuild data file and clear WAL
db.compact()

Architecture

data/
├── wal.jsonl    # Write-Ahead Log (all operations)
├── data.jsonl   # Compacted data records
└── index.lmdb  # LMDB index → data.jsonl offsets

Write Path

  1. Append operation to WAL
  2. Apply to data.jsonl
  3. Update index

Read Path

  1. Check index → if found, read from data.jsonl
  2. If not found, scan WAL for uncompacted records

Compaction

  • Merges data.jsonl + WAL into clean state
  • Rebuilds index
  • Clears WAL

API

Database

db = Database(path, index_fields=None)
  • path: Directory for database files
  • index_fields: List of fields to index

Methods

Method Description
insert(data) Insert a record, returns ID
get(id) Get record by ID
query(field, value) Query by indexed field
update(id, data) Update a record
delete(id) Delete a record
all() Iterate all records
count() Count all records
compact() Compact WAL into data file

Record

record.id      # Record ID
record.data    # Record data as dict
record.to_dict()  # Convert to dict

License

MIT

Metadata

Release files for jsonldb 0.1.1

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

Source distribution (sdist)

Source distribution for jsonldb 0.1.1
File Size Uploaded
jsonldb-0.1.1.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jsonldb 0.1.1
File Interpreter ABI Platform
jsonldb-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / jsonldb-0.1.1.tar.gz

Download URL jsonldb-0.1.1.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
161a1897f2c702c14109c1d9d8349d9d20875bbedb34e77d8e71847f2844888d
BLAKE2b-256 checksum
How to use checksums
1178321e07b925fbd7bf5eb9c84b9d6e5b2b31cc5dbaf26e0e7118cb6fbcb794
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

Release files / jsonldb-0.1.1-py3-none-any.whl

Download URL jsonldb-0.1.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93816e8bf7989bebce636cab726b1f6d4beb22b8300365a10c1558a0c9a23362
BLAKE2b-256 checksum
How to use checksums
ec59bd1ae596cf5212f155b2af17a5f7b9037eb984f1a8e71da924fbc807bea5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

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