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
Metadata
Release files for localdb.json 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| localdb.json-1.0.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| localdb.json-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.1 kB
Release files / localdb.json-1.0.tar.gz
| Download URL | localdb.json-1.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33efa256fdc836efe6aee3721618d714dc856f2bedc4ee3092d28fb98f594c73
|
|
BLAKE2b-256 checksum How to use checksums |
1b1b7a9cc3879aa624b6687fd17cd6c1b4bfd1e98d1c0f59323751d88acc0cdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / localdb.json-1.0-py3-none-any.whl
| Download URL | localdb.json-1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad4509652d7b4467493ca69a86f8b6a166d099f478f4cf9147ab7b735b5c6421
|
|
BLAKE2b-256 checksum How to use checksums |
09c092ef44020841a29d42dd878393241680692f7360bec104396d8a6b3808d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|