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.1.tar.gz (13.1 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.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yuna-db-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8fd8ec428a85f4a8e46b8b79507d41d3b66e1fce6dbde81217915a052e28f3c1
MD5 3bfb2e648c54f62fa5470e6348bde469
BLAKE2b-256 913a956fb941ad561c7e50503e2fe6facdd897f594ad24773fd2f0ac8314fc9a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yuna_db-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 429a3feeea4b717a1e0f10b419bf637555dedc78f0c6707a3a6bb6779848ba2a
MD5 3e5eff19b64464be499492a46884d3a1
BLAKE2b-256 3f4d9bbd775971436d7aad84c91134f06017079f6abb3c0971e32ef51bfa7f75

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