Skip to main content

Repository pattern for SQLAlchemy models

Project description

SQLAlchemy Repository for models

tests workflow

This project contains simple Repository pattern for SQLAlchemy models.
All you need to do is:

  1. Install this package python -m pip install sa-repository
  2. 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


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.5.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

sa_repository-0.5.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file sa_repository-0.5.1.tar.gz.

File metadata

  • Download URL: sa_repository-0.5.1.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

Hashes for sa_repository-0.5.1.tar.gz
Algorithm Hash digest
SHA256 8c9fd5b3d73a76b4437afa4a387eeff6589107beef81eba9441b688584548dc1
MD5 19102622f33e348585a29f294792d629
BLAKE2b-256 5e1cf9f4fb7e93df2e1d61a1314ff329369417531e274aa080e7380c654221fd

See more details on using hashes here.

File details

Details for the file sa_repository-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: sa_repository-0.5.1-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

Hashes for sa_repository-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d025f1ec0ec9f123414ad18e7c68bfdd3f549ac09dee58fa8a403e8aa4da488f
MD5 3fdd3d6a017d152e6c02dbc7e32aad53
BLAKE2b-256 bd14563129cf38765b189e46fa4d78d5a0304ff481cf18e06dbf968c64dbc2c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page