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.
Metadata
Release files for pydirdbjson 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 | |
|---|---|---|---|
| pydirdbjson-1.0.0.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydirdbjson-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / pydirdbjson-1.0.0.tar.gz
| Download URL | pydirdbjson-1.0.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ceeeed34a8b58aff2ce5ea8f61a9548228bf6299c149ca771a7463e577011f2
|
|
BLAKE2b-256 checksum How to use checksums |
d40b6a4230e1f5dbded000de528607be13ce565c6ea42c3795a63a9905136e30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 12, 2025.
Transparency logRelease files / pydirdbjson-1.0.0-py3-none-any.whl
| Download URL | pydirdbjson-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e89285db8728b35576482dce93bf847dfded1ce852686f5d09d6240396ed96ad
|
|
BLAKE2b-256 checksum How to use checksums |
2d9df6ba1e05865d400200e41956426636849a8345b1466149020d97b644aa7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 12, 2025.
Transparency log