Skip to main content

Flexible immutable entity database

Project description

Savior Database

Embedded schema-less database library backed by LMDB.

Currently in development and not stable yet. The interface and disk format may change in future versions without notice. You probably shouldn't use it to store important data.

Permissively licensed with the ISC License.


  • provide a language-neutral disk format
  • utilize LMDB's properties like transactions, append-only writes, and zero-copy reads
  • provide intuitive schema-less entity modeling and querying interface
  • store an immutable history of all values in the database

Developer Interface

There are a few actions you can perform on entities in a transaction:

  • store
  • fetch
  • update
  • query
  • delete

An entity is conceptually like a dictionary with attributes and values.

A table is an isolated section of the database for storing entities, usually with a similar set of attributes.

Disk Format

All entities of the same type are stored in one inner LMDB database There is no guarantee that entities have a consistent schema.

Entities are stored on disk as a series of timestamped attribute changes.

  • key-value entries have the form (uuid, timestamp, attribute) -> value
  • uuid is an auto-generated entity ID
  • timestamp is an auto-generated timestamp of when the entry was appended
  • attribute and value are the updated entity key value entries

Data is not modified for updates, only appended to indicate the entity changed.

The storage format version is stored as an integer in a special inner database named _metadata, at a key named version. The _metadata table's keys and values are also encoded with MessagePack.

You can access the storage format version via Database.VERSION.


This document follows the Keep a Changelog format.

Releases are available on PyPI as savior.

0.2.3 - 2019-09-06


  • added Transaction.delete method to permanently remove an entity

0.2.2 - 2019-08-06


  • fixed bug where created_at dates were all from the first entity

0.2.1 - 2019-08-06


  • opening a database adds a schema version identifier integer to databases that don't have one


  • added Database.VERSION for getting storage format version
  • added created_at option to query to add an attribute to entities indicating when they were created

0.2.0 - 2019-07-15


  • removed Database.open_tables since tables are now required when opening a database


  • renamed Transaction.create to for consistency with Transaction.fetch
  • changed behavior to require table names on initialization
  • changed Transaction methods to raise error if a table name is used that was not used to open the database with

0.1.2 - 2019-07-15


  • Database.create_tables to create tables in database
  • Database.open_tables to open existing tables in database
  • Database.close to close database manually

0.1.1 - 2019-07-15


  • options for manually closing transactions for when it's not possible to use context managers

0.1.0 - 2019-07-15


  • initial schema-less immutable interface over LMDB

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

savior-0.2.3.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

savior-0.2.3-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page