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

Uploaded Python 3

File details

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

File metadata

  • Download URL: keldb-0.2.0.tar.gz
  • Upload date:
  • Size: 5.9 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.0.tar.gz
Algorithm Hash digest
SHA256 c1d27a4df14f6a382b91ee98a6ecfb7d3e0a91d43350e8d4b53d0a503563f327
MD5 f8c33d7751e71cd2745effb09e0459fe
BLAKE2b-256 2a46cb1355dfaea8a68ec70dae5669622aa3fad1f3aa127b172fbfca392d7abc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: keldb-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65923f8e6ee3530844579ffa6bca32e91082672b8691a0be7b7087b78e75f000
MD5 886fae2e756adaba0b9a9601d4d8585c
BLAKE2b-256 b2b50ba78432bcf6326a799f8f6fab5e2b53cdf017d532cb95f7f83e509c6cc8

See more details on using hashes here.

Provenance

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