Python SOLID Repository pattern implementations
This repository contains a simple implementation of the Repository pattern in Python. The implementation is based on the SOLID principles.
It supports:
- PostgreSQL
- JSON
Usage
Check the ./scripts/main.py for a full example.
# main.py
# ...
# Define the fields for the table and entities
datasource = DataSource()
table = JsonTable('users', os.path.join(path_root, 'scripts', 'data'), fields)
datasource.add_table(table)
datasource.clear('users')
dummy_users = [
User('John Doe', 'test@asd.com', 'johndoe'),
User('Jane Doe', 'test3@asd.com', 'janedoe'),
User('Mary Poppins', 'poppinst@industry.com', 'marypoppins'),
]
for user in dummy_users:
datasource.insert('users', user)
filters = [
Filter([
FilterCondition('name', 'Doe', FilterTypes.CONTAINS),
FilterCondition('email', 'test@asd.com', FilterTypes.EQUAL)
]),
Filter([
FilterCondition('name', 'Mary', FilterTypes.CONTAINS),
])
]
for user in datasource.get_by_filters('users', filters):
print(user)
print("Unique")
mary = datasource.get_unique('users', 'username', 'marypoppins')
print(mary)
Metadata
Release files for pyrepositories 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyrepositories-2.1.1.tar.gz | 6.8 kB | Without provenance | Details for pyrepositories-2.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyrepositories-2.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyrepositories-2.1.1-py3-none-any.whl |
Total release size: 14.4 kB
Release files / pyrepositories-2.1.1.tar.gz
| Download URL | pyrepositories-2.1.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02b25e229b196bbb8ec3f42aa389fee8bdb7e2ef20ea5eec9e4d52298bee26ac
|
|
BLAKE2b-256 checksum How to use checksums |
5f3e9813deaa2db385571db91b36c9cb3227ea674716e5dcee3e7b5d89bb8a24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / pyrepositories-2.1.1-py3-none-any.whl
| Download URL | pyrepositories-2.1.1-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bad203fa7fbb260a2032c17550db0165382489c1cee44aefd818ac8bb1ef411
|
|
BLAKE2b-256 checksum How to use checksums |
e836c753623a42abc4be020625e9dceb8799adc714e1d9cf372fbe375002f205
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Security for pyrepositories 2.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.