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

db = Yuna("/tmp/test.ydb", create=True)
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

db.close()

Planned new features to come:

  • Implement a context manager on the Yuna class
  • Support integer keys with a .insert() method providing autoincrement
  • Finish the Zstandard compression support
  • Add iterators to quickly find keys within a specified range
  • Add a REPL (Python with the yuna module already loaded and the DB open)

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yuna-db-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d7556bfb2c49fb12edaded2d3f6fda489a08a6e59e7838bf7b3d57c1dd1bed62
MD5 c7588f1996ce360cc9682b51179c797c
BLAKE2b-256 4118ad748ac7b5a8503aa883b4d5644ce2d14758c40b0a99db4825101a92a409

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yuna_db-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a7cb2dc753c1dd2692ccd24c1f24b4258bcd1f3bdb577b591af4aa8c1ad76a0
MD5 df886cc5167d4d81368e2164231003e3
BLAKE2b-256 bcb0b16484389f434e920309def6176709c9d4ac4bbcf53f1555135a7ef3dcdb

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