Skip to main content

BinaryDB

A lightweight, embeddable key-value database for Python with atomic disk persistence and transaction support

Quick start

Get up and running with BinaryDB in three simple steps

1

Install BinaryDB

Copy the binarydb package to your project or install from source:
git clone https://github.com/Raul-Novo/BinaryDB.git
cd BinaryDB
2

Create a database

Import and initialize a new database instance:
from binarydb.database import Database

db = Database("./data/mydb")
db.load()  # Load existing data if available
3

Store and retrieve data

Use the simple API to manage your data:
# Store data
db.set("user:1", {"name": "Ana", "age": 30})

# Retrieve data
user = db.get("user:1")
print(user)  # {'name': 'Ana', 'age': 30}

# Persist to disk
db.commit()
db.close()

Key features

Everything you need for simple, reliable data persistence

In-memory storage

Fast key-value operations with all data stored in memory for instant access

Atomic persistence

Safe disk writes using atomic file replacement to prevent corruption

Transaction support

Begin, rollback, and commit transactions to maintain data consistency

Simple API

Intuitive methods for common operations: set, get, delete, update

Ready to get started?

BinaryDB is perfect for small to medium datasets where simplicity and reliability matter more than maximum performance

Start building with BinaryDB

Build docs developers (and LLMs) love