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.

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.

Installation

Install from PyPi:

pip install -U keldb

Or install from source

git clone https://github.com/TriangularDev/keldb.git
cd keldb
pip install -r requirements.txt
python3 -m pip install -U . --force-reinstall

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for keldb-0.2.5.tar.gz
Algorithm Hash digest
SHA256 e8f28a4e44d62b1a311c1aadd9238a6dd64d035dba32b10793b344ae0512f027
MD5 30ebc1ef2529120cfa1aadf486fa6b07
BLAKE2b-256 f4fd65765978e1c152d4b3b8929d91b2981ba6cee6b7af83af439c00b62071d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for keldb-0.2.5.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.2.5-py3-none-any.whl.

File metadata

  • Download URL: keldb-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 6.3 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.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a0a775967e0be4a7303cc461871a5e1b0dd3ac4d600d9d8ecf5cf18f95df6b35
MD5 f737899b35fcb4317db8d0c9efa9fca7
BLAKE2b-256 44726662a815cb6da7aaf822f071fb09d11b346224a20c323805d9ff465447b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for keldb-0.2.5-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