It is a file based key value data store
Project description
hidb
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.1.tar.gz
.
File metadata
- Download URL: hidb-0.0.1.tar.gz
- Upload date:
- Size: 3.4 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 | 7aa3b644d3243ec43dad5a1108e8eb9f030c9e5cadf018087a2a537fd0afa280 |
|
MD5 | 5431847c93833510388ac410484f3562 |
|
BLAKE2b-256 | 5f5d01edf30c998790336bb629d4f7b66472d8923c4ae161c308e90a1cf9fb17 |
File details
Details for the file hidb-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: hidb-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 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 | 1520fa4c9964ab29422b013878b362ee68dff65a8be101fe482a09c4bd6ce76a |
|
MD5 | e02e0ef17f3d03c88847ce1bc0475c41 |
|
BLAKE2b-256 | 12ebc1d2bf5379945009f49d31ddaa2e76c053b6780ed25166259c00aeda6340 |