Skip to main content

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

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localdb.json-1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

localdb.json-1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file localdb.json-1.0.tar.gz.

File metadata

  • Download URL: localdb.json-1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for localdb.json-1.0.tar.gz
Algorithm Hash digest
SHA256 33efa256fdc836efe6aee3721618d714dc856f2bedc4ee3092d28fb98f594c73
MD5 cf2c039968c92424a988acadcee4916f
BLAKE2b-256 1b1b7a9cc3879aa624b6687fd17cd6c1b4bfd1e98d1c0f59323751d88acc0cdb

See more details on using hashes here.

File details

Details for the file localdb.json-1.0-py3-none-any.whl.

File metadata

  • Download URL: localdb.json-1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for localdb.json-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad4509652d7b4467493ca69a86f8b6a166d099f478f4cf9147ab7b735b5c6421
MD5 8a983cf044b21053131f40db6a76ca89
BLAKE2b-256 09c092ef44020841a29d42dd878393241680692f7360bec104396d8a6b3808d1

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