Class to provide some general methods to simplify work with SQLAlchemy models
Project description
SQLAlchemy Repository for models
This project contains simple base repository class for your 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-0.2.1.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file sa_repository-0.2.1.tar.gz
.
File metadata
- Download URL: sa_repository-0.2.1.tar.gz
- Upload date:
- Size: 3.1 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 | fbda0efd5fa0a65edfddca5b598e42ab86938fa038b3f5f048ad2180d148722a |
|
MD5 | b95fa3575d4fe4360910358debfd8beb |
|
BLAKE2b-256 | a3318023ad9577fdcd363c2fe7f56821ae4cb89959d04c8b9c0909b00a5401f1 |
File details
Details for the file sa_repository-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: sa_repository-0.2.1-py3-none-any.whl
- Upload date:
- Size: 3.3 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 | 5300dc1bc8ac9a773e5f166bff87379370b3a9b08573ac12b6e1cf36ecabdc6b |
|
MD5 | df3524959931d7b4d989a4be910146bc |
|
BLAKE2b-256 | 746b96afc9ccc7724fc7604932d205b38e325cce02e4727e6bac09943b7cd816 |