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.0.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for sa_repository-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb9f56218929ad74a89e6055e36dc737b66e347d7ced8097685dcc5798fafffd |
|
MD5 | 4835070c20b81cb308ecd943dfba091a |
|
BLAKE2b-256 | 2e435e110997a141e5c4fbfbc45b3909c04883a19268c1f17484ed3af2251a52 |