Skip to main content

Key-Value database library, small and easy to use.

Project description

SonaDB

SonaDB ("Information" in Toki Pona) is a small library for Key-Value databases.
It can load binary files as Dictionaries, consumes little space on disk.

Install

pip install git+https://github.com/ZSendokame/SonaDB.git

Use

import sona

db = sona.Database(open('database.db', 'rb'))

# Keys:
db.set('key', 'value', algo='md5')  # Create a new key and hash if algorithm defined, None.
db.get('key')  # Get a key, Any.
db.remove('key')  # Remove a key, None.
db.exists('key')  # Check if a key exists, Bool.
db.rename('key', 'new_name')  # Rename a key, None.
db.population()  # Get the length of Database or Key, Int.

# Database
db.clear()  # Delete all the Database on memory.
db.dump()  # Saves all the memory to a file.
db.query(lambda key, value: expression)
# Iterate over the Database, giving key-value to the lambda and checking for True.

Cli

You can also access a CLI: python -m sona --database file.db

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

SonaDB-1.2.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file SonaDB-1.2.0.tar.gz.

File metadata

  • Download URL: SonaDB-1.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for SonaDB-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1c8f6da80b8251ee13b9676b985013a704d00ad4bb9155bf9c53d5641235f184
MD5 095547f46cf90a9064e553f1a76cb8a5
BLAKE2b-256 b814daa2dfc6960a1681fe8093e46d8df18d1b137b8e8ef861a9f26751980604

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page