Repository pattern for SQLAlchemy models
Project description
SQLAlchemy Repository for models
This project contains simple Repository pattern for SQLAlchemy models.
All you need to do is:
- Install this package
python -m pip install sa-repository
- Use it in your project
from sa_repository import BaseRepository from models import YourSAModel class SomeModelRepository(BaseRepository[YourSAModel]): pass
Base class contains some general methods to simplify your work with sqlalchemy models e.x
var = SomeModelRepository(session).get(YourSAModel.attr == 'some_value')
If you don't want to create new repository classes, you can use get_repository_from_model
method
repository = BaseRepository.get_repository_from_model(db_session, SomeModel)
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
sa_repository-1.0.0.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file sa_repository-1.0.0.tar.gz
.
File metadata
- Download URL: sa_repository-1.0.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.2 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 523b9189145bd56e032bb97f5a0e6d40b53a1ad7546f9fdf5ff80b4dc01de4f1 |
|
MD5 | 0913672c6cbbc1efc4f2ea6ddc8295d4 |
|
BLAKE2b-256 | 2be70cc64d5ef98be170bc7a7dca96b1fcaa60139bfa9de9e7db32b53414ff49 |
File details
Details for the file sa_repository-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: sa_repository-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.2 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a4948346b6fc2e66067e79ce30ee893f5348453508e7e991c42d0db35f4c51c |
|
MD5 | b9cf7be1ae2ff3d9e116caff36a62392 |
|
BLAKE2b-256 | 6a3acaf4b5a71a3a8f1ec06ce63f09d4c676402dfead5bfd39312457ce3bcb87 |