A Database in JSON on directory
Project description
Projeto-PyDirDbJson
Project name is a Database in JSON on directory.
Prerequisites
No prerequisites
Installing PyDirDbJson
To install PyDirDbJson, follow these steps:
Windows, Linux and macOS:
pip install pydirdbjson
Using PyDirDbJson
To use pydirdbjson, follow these steps:
from pydirdbjson import Pydirdbjson
db = Pydirdbjson(db_path='my_database')
db.create_table(table_name='users')
db.insert(table_name='users',
record_id='1',
record={'name': 'John', 'age': 30, 'city': 'São Paulo'})
db.insert(table_name='users',
record_id='2',
record={'name': 'Mary', 'age': 25, 'city': 'Rio de Janeiro'})
db.create_table(table_name='customers')
db.insert(table_name='customers',
record_id='1',
record={'name': 'ABC'})
db.insert(table_name='customers',
record_id='2',
record={'name': 'XWZ'})
db.create_table(table_name='permissions')
db.insert(table_name='permissions',
record_id='1',
record={'user': '1', 'customer': '1'})
db.insert(table_name='permissions',
record_id='2',
record={'user': '1', 'customer': '2'})
db.insert(table_name='permissions',
record_id='3',
record={'user': '2', 'customer': '2'})
print(db.query(table_name='users', record_id='1'))
>>> {'name': 'John', 'age': 30, 'city': 'São Paulo'}
print(db.query_by_key_value(table_name='permissions',
key='customer',
value='1',
keys_to_return=['user']))
>>> [{'user': '1'}]
db.delete(table_name='users', record_id='1')
Database structure
|-- my_database
| |-- users
| | |-- 1.json
| | |-- 2.json
| |-- customers
| | |-- 1.json
| | |-- 2.json
| |-- permissions
| | |-- 1.json
| | |-- 2.json
| | |-- 3.json
File structure
File: my_database/users/2.json
{"name": "Mary", "age": 25, "city": "Rio de Janeiro"}
Contributing to PyDirDbJson
To contribute to PyDirDbJson, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>. - Make your changes and commit them:
git commit -m '<commit_message>' - Push to the original branch:
git push origin <project_name>/<location> - Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
Contributors
Thanks to the following people who have contributed to this project:
You might want to consider using something like the All Contributors specification and its emoji key.
Contact
If you want to contact me you can reach me at ricardo(dot)ferreras(at)gmail(dot)com.
License
This project uses the following license: MIT.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydirdbjson-1.0.0.tar.gz.
File metadata
- Download URL: pydirdbjson-1.0.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ceeeed34a8b58aff2ce5ea8f61a9548228bf6299c149ca771a7463e577011f2
|
|
| MD5 |
7578cba799c526b8303d24c3bcd2a396
|
|
| BLAKE2b-256 |
d40b6a4230e1f5dbded000de528607be13ce565c6ea42c3795a63a9905136e30
|
Provenance
The following attestation bundles were made for pydirdbjson-1.0.0.tar.gz:
Publisher:
publish_to_pypi.yml on FerrerasRP/Projeto-PyDirDbJson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydirdbjson-1.0.0.tar.gz -
Subject digest:
7ceeeed34a8b58aff2ce5ea8f61a9548228bf6299c149ca771a7463e577011f2 - Sigstore transparency entry: 211319581
- Sigstore integration time:
-
Permalink:
FerrerasRP/Projeto-PyDirDbJson@403e0f3d9ca7e96ea462827bb06e460702b5ac75 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/FerrerasRP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yml@403e0f3d9ca7e96ea462827bb06e460702b5ac75 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pydirdbjson-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pydirdbjson-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e89285db8728b35576482dce93bf847dfded1ce852686f5d09d6240396ed96ad
|
|
| MD5 |
0a80fd589dbcf878bdaf7a38f8f0ebdb
|
|
| BLAKE2b-256 |
2d9df6ba1e05865d400200e41956426636849a8345b1466149020d97b644aa7c
|
Provenance
The following attestation bundles were made for pydirdbjson-1.0.0-py3-none-any.whl:
Publisher:
publish_to_pypi.yml on FerrerasRP/Projeto-PyDirDbJson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydirdbjson-1.0.0-py3-none-any.whl -
Subject digest:
e89285db8728b35576482dce93bf847dfded1ce852686f5d09d6240396ed96ad - Sigstore transparency entry: 211319587
- Sigstore integration time:
-
Permalink:
FerrerasRP/Projeto-PyDirDbJson@403e0f3d9ca7e96ea462827bb06e460702b5ac75 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/FerrerasRP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yml@403e0f3d9ca7e96ea462827bb06e460702b5ac75 -
Trigger Event:
push
-
Statement type: