It is a file based key value data store
Project description
hidb :wave:
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
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
File details
Details for the file hidb-0.0.2.tar.gz
.
File metadata
- Download URL: hidb-0.0.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae64f1fa97a594e50b5cf4fdfb38378fe27ab2fe33a6848e6bf53eca7e0a7e5 |
|
MD5 | d5ced62715d48b390cd227764b0c2f46 |
|
BLAKE2b-256 | 9f53be1a129273dcef185c7909d55e81822c55ddccf6427305379f4151f960b7 |
File details
Details for the file hidb-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: hidb-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ba3bdda1e36bb66f2cb3902a32dc4e811ac09a09d676bf191c1cf8d228040a0 |
|
MD5 | b2bfbba76c286ee30f76b7f530f795d6 |
|
BLAKE2b-256 | e308b933a66ad4cbe834abc16d01b7d5af0bdd6f2ee6e50e40e582f1de5bceb1 |