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

Uploaded Source

Built Distribution

sa_repository-1.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sa_repository-1.1.0.tar.gz
  • Upload date:
  • Size: 4.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

Hashes for sa_repository-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cbe76493000c98dba09d1a7034809413f0980e4f5bf11d23c6ddd084026de578
MD5 e8cbc314fd35b81949a4784da7582a24
BLAKE2b-256 8c642dd56db6afbcd98edb84d4ceb7b2b33043f5ffb6defd64307b5ab5e320c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sa_repository-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb9f56218929ad74a89e6055e36dc737b66e347d7ced8097685dcc5798fafffd
MD5 4835070c20b81cb308ecd943dfba091a
BLAKE2b-256 2e435e110997a141e5c4fbfbc45b3909c04883a19268c1f17484ed3af2251a52

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