A helper script for easily handling of JSON file as database in local storage.
Project description
localdb.json
A helper script for easily handling of JSON file as database in local storage.
Installation
pip install localdb.json
Usage
Creating instance
from localdb import Database
db = Database("example.json")
Saving some data
This creates a key with the given value. It will overwrite existing key's value. Always returns True
.
db.set("TEST", "VALUE")
>>> True
Getting saved data
Returns value of requested key if it exists or will return None
.
db.get("TEST")
>>> VALUE
Renaming a key
Renames an existing key to another. Returns True
if it exists or will return None
.
db.rename("TEST", "Test")
>>> True
Deleting a key
Deletes key and value from database. Returns True
if it exists or will return None
.
db.delete("Test")
>>> True
Database size
Size of database file is returned in bytes.
db.size
>>> 42
Issues ?
Open issues or ask here
Contributing
Pull requests are welcome.
License
Licensed under GNU Affero General Public License v3.
Credits
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for localdb.json-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad4509652d7b4467493ca69a86f8b6a166d099f478f4cf9147ab7b735b5c6421 |
|
MD5 | 8a983cf044b21053131f40db6a76ca89 |
|
BLAKE2b-256 | 09c092ef44020841a29d42dd878393241680692f7360bec104396d8a6b3808d1 |