Skip to main content

It is a file based key value data store

Project description

hidb :wave:

Python package Upload Python Package PyPI version

hidb is a file based key-value data store

Installation

$ pip install hidb

Usage

hidb can be used as a python package for saving JSON object data in the local storage.

Initialize

Initialize the database with the location you want to store the data, here we are using the current directory

from hidb import fileStoreDB

db = fileStoreDB("./")

Add the data

create method takes three values

  • key It is the unique key to recognise the data
  • data It is the JSON object to store
  • ttl It is an integer, the number of seconds the data should be available in the database, if left blank the data would persist indefinitely.
data = '{"name": "John Doe", "age": 20, "hobby": ["Reading", "Coding","Travelling"]}'
db.create("mydata", data, 20)

Read from the database

To read from the database, simply provide the key

print(db.read("mydata"))

Delete the record from the database

To delete from the database, simply provide the key

db.delete("mydata")

To save the database on the local storage

Provide the name with which to save the file

db.saveData("mydata.pk")

To load from an existing database

To load from an existing file, first we need to create the database instance and then load the data into it.

db = fileStoreDB("./")
db.loadData("mydata.pk")

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

hidb-0.0.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

hidb-0.0.2-py3-none-any.whl (5.5 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