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.1.1.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file sa_repository-1.1.1.tar.gz
.
File metadata
- Download URL: sa_repository-1.1.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d04921c5ca2078f5f17aa09bec85298c8f09e8450777f9f24584da3d8ccd8b1e |
|
MD5 | ece7b789be9b401dac2ae99d4847ef99 |
|
BLAKE2b-256 | 16159972f63e34d0162fc43af27a2b067e7a463bebac888c240e50057b05b45b |
File details
Details for the file sa_repository-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: sa_repository-1.1.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a48e5cd340e5fe07d3ca13e9baa6d981ea35875000c93ca132f8dd8bb5591f95 |
|
MD5 | 98e8ed39a862f29b129ff74d0aa9e94e |
|
BLAKE2b-256 | eaa76ce3000ccb7073a631667c982178ac78b96f9d4218437224fe89e8a263a7 |