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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yuna-db-0.2.3.tar.gz
Algorithm Hash digest
SHA256 52d4b5f4f6cd75f6be8af2d87594569e67991ae7e2a3a805a158bcbeaf98f7c0
MD5 5e97d97096baf36890bc226ecf5c1360
BLAKE2b-256 47ffa1db81756a90d5a041a16eaeca636fd5f02bb2e14da5508d0656b25b2231

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yuna_db-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dd3d663ab1d7aadef7b34954d473bfcd69135354c87a61e1ad80bb4e13c4e7a1
MD5 637bd2a0b7a367219616b2e67c4a8f85
BLAKE2b-256 5891ca5aa6baa23fe10c78ffb466b0c1f01699293bdda8b3ef1e1e120a423884

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