Skip to main content

KelDB is a simple node-based database for asyncio applications.

Project description

KelDB

Latest PyPI package version Latest Read The Docs

KelDB is a simple node-based database for asyncio applications.

Dynamics

KelDB is organised into nodes. A node is a container that can hold a value and/or other subnodes. The database itself is the root node, and every piece of data is a subnode of it.

Usage

KelDB is quite flexible. There's only a few commands to learn.

import asyncio
import keldb

# Create a default KelDB database (or load an existing database)
database = keldb.KelDB(keldb.FileStoreHook("./testdb/"))

async def main():
    # Create subnodes (lazy creation - no actual subnodes are created yet)
    foo = await database.get_subnode("foo")
    bar = await database.get_subnode("bar")
    baz = await database.get_subnode("baz")

    await bar.set_value("This can be any json-serializable object.") # Set a value (now "bar" is actually created)
    
    await baz.set_value({"type": "user", "name": "Gabe Newell"}) # Now "baz" is actually created

    text_subnode = await foo.get_subnode("text")

    await text_subnode.set_value("If you are reading this, this data saved correctly!") # Write text in a subnode's subnode. (now both "foo" and "foo/text" are created)

    print(await text_subnode.get_value()) # Read a value from the database

    await foo.delete() # Delete a subnode (do note that this also recursively deletes any subnodes under it)

    async for subnode in database.list_subnodes(): # Iterate over subnodes
        print(subnode.path)

    await database.set_value("Even the database itself is technically a node!")

asyncio.run(main())

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

keldb-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

keldb-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file keldb-0.1.0.tar.gz.

File metadata

  • Download URL: keldb-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keldb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a5b18e99b24c81cd9d51c7a7376514481318341d62fbbc9642e3099348249ea
MD5 00b892e36be8f4912171cff0b3dba41f
BLAKE2b-256 4eb97f81a17b6479a35905c45384a9bef6fd58a6348b1b7dfa611a367b38c192

See more details on using hashes here.

Provenance

The following attestation bundles were made for keldb-0.1.0.tar.gz:

Publisher: python-publish.yml on TriangularDev/keldb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keldb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: keldb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keldb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d25ae8362756731d9abfac1ba831f22f83d2870248c1d5aeac8061c7846fe9f1
MD5 2dd3573d659696a2ba3ae3c5c2a5e794
BLAKE2b-256 d94d651f2edeb3bc3fef46f1ec30fa9ed8232ad7091649fa5c7622df32e62ea3

See more details on using hashes here.

Provenance

The following attestation bundles were made for keldb-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on TriangularDev/keldb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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