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
# GIT+PIP
pip install git+https://github.com/ZSendokame/SonaDB.git
# PIP
pip install SonaDB
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.1.tar.gz
(3.3 kB
view details)
File details
Details for the file SonaDB-1.2.1.tar.gz
.
File metadata
- Download URL: SonaDB-1.2.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04e718b75d6d0025d8c9235d41f3ce834a46cba5956b5ddc27a15e9d7701634f |
|
MD5 | 5c9e7135d990943881c6925468ea31b7 |
|
BLAKE2b-256 | 0005d06f4bc4185f6e10af1e8f7f42155b5cf2b231bc8c64ba1f022a768897b2 |