Easy Json Database
Easier Json Database For Python
Installation
Easy Way
pip install pyezjson
Less Easy Way
pip install git+https://github.com/M4hbod/pyezjson.git
Usage
Connect:
from pyezjson import connect
mydb = connect('my_database.json', indent=4)
Add:
mydb.add(False, 'users', 'user_1', first_name='Lee', last_name='Everet')
# `False` is for `update_if_exist` argument
"""
Result in my_database.json:
{
"users": {
"user_1": {
"first_name": "Lee",
"last_name": "Everet"
}
}
}
"""
Update:
mydb.update(False, 'users', 'user_1', 'last_name', SELF='Everett')
# If you use `SELF`, it will update it for the last argument
# You can also use `SELF` in `add` function
# `False` is for `add_if_not_exist` argument
"""
Result in my_database.json:
{
"users": {
"user_1": {
"first_name": "Lee",
"last_name": "Everett"
}
}
}
"""
Delete:
mydb.delete('users', 'user_1', 'last_name')
"""
Result in my_database.json:
{
"users": {
"user_1": {
"first_name": "Lee"
}
}
}
Check:
result_first_name = mydb.check('users', 'user_1', 'first_name')
result_last_name = mydb.check('users', 'user_1', 'last_name')
print(result_first_name)
print(result_last_name)
"""
Result:
>>> True
>>> False
"""
Get:
data = mydb.get('users', 'user_1')
print(data)
"""
Result:
>>> {'first_name': 'Lee'}
"""
Get The Whole Database:
data = mydb.get_all()
print(data)
"""
Result:
>>> {'users': {'user_1': {'first_name': 'Lee'}}}
"""
Reset:
mydb.reset()
"""
Result in my_database.json:
{}
Metadata
Release files for pyezjson 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyezjson-1.0.0.tar.gz | 15.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyezjson-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.7 kB
Release files / pyezjson-1.0.0.tar.gz
| Download URL | pyezjson-1.0.0.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b0a8277fa821fc72b404b04184919ae7bf997cece072c9ca18510b584f9f718
|
|
BLAKE2b-256 checksum How to use checksums |
d524ec024974bb1d04b41606a56627bd287b491b076cf4bfaa9136c20842f3dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / pyezjson-1.0.0-py3-none-any.whl
| Download URL | pyezjson-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8744250fbf8866c42beb9909fcab7ff9a1dd91a833a94efba41cf0bd6720b3c6
|
|
BLAKE2b-256 checksum How to use checksums |
532e1f57ac7e7db7f8bda407e9ca058c9e81c9b6aa3801d8f3680573d331910d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|