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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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