Skip to main content

Yuna DB: dict-like semantics for LMDB

Project description

Yuna DB: dict-like semantics for LMDB

Yuna is a key/value store that's built upon LMDB (the Symas Lightning Memory-mapped Database). LMDB really is lightning-fast, but as a C library only allows you to lookup a byte string value, using either an integer key or a byte string key.

Yuna provides semantics similar to a dict. You can specify a serialization format, and optionally a compression format to use, and Yuna will serialize values and write them to the database as byte strings. It will automatically recover the value from the bytes string.

For example, if x is any Python value that can be serialized by the chosen serialization format in table foo, this would work:

db.tables.foo.put(key, x)

After that .put() you can call .get():

x = db.tables.foo.get(key)

Example

from yuna import Yuna, SERIALIZE_JSON, SERIALIZE_STR

with Yuna("/tmp/test.ydb", create=True) as db:
	db.new_table("names", serialize=SERIALIZE_JSON)

	key = "feynman"
	value = dict(first_name="Richard", last_name="Feynman")
	db.tables.names.put(key, value)

	temp = db.tables.names.get(key)
	assert temp == value

	db.new_table("abbrevs", serialize=SERIALIZE_STR)
	key = "l8r"
	value = "see you later"

	db.tables.abbrevs.put(key, value)
	temp = db.tables.abbrevs.get(key)
	assert temp == value

Planned new features to come:

  • Support integer keys with a .insert() method providing autoincrement
  • Finish the Zstandard compression support
  • Add docstrings to the iterators
  • Add a REPL (Python with the yuna module already loaded and the DB open)
  • Add lots of unit tests

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

yuna-db-0.2.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yuna_db-0.2.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file yuna-db-0.2.2.tar.gz.

File metadata

  • Download URL: yuna-db-0.2.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for yuna-db-0.2.2.tar.gz
Algorithm Hash digest
SHA256 fbb2deec7ed960b24baeae0791678947edfa273abedc323d524e3676a9ce5f6e
MD5 9853219b8a88b1e57791345b03460f42
BLAKE2b-256 faebc4723fbc7d55c8dcc26d949f79c1701a94e030bb3f3d00f25ffe2b9ecd29

See more details on using hashes here.

File details

Details for the file yuna_db-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: yuna_db-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for yuna_db-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 728023c51de6d6ea8a01a81590b3ddce99e5e700207c7d063f4b47ce954620ee
MD5 f53e58ce5d2cdd0b91fe09cd4d5e0582
BLAKE2b-256 12685f4180256e122b5f1af71e779473a9654775a02262b7b4bcf5ceb1a65b88

See more details on using hashes here.

Supported by

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