Skip to main content

Class to provide some general methods to simplify work with SQLAlchemy models

Project description

SQLAlchemy Repository for models

tests workflow

This project contains simple base repository class for your 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.3.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

sa_repository-0.3.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sa_repository-0.3.0.tar.gz
  • Upload date:
  • Size: 3.4 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.3.0.tar.gz
Algorithm Hash digest
SHA256 9789b9e6ab8ecd59d9e01adaee4362e264201d162877be499ab268a853168e87
MD5 bbfab0e1df12056c361a92f236413dcb
BLAKE2b-256 9af7ee683077109f147125e1ee668e917c30c660300a0ce03069ff5fce7a8dda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sa_repository-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c69e33c837c4bc0fe1a9a6eaa65799bca6e7ebd3ee1553b0c4fe81b9dcd5451
MD5 cf9cf957e7c3189300da19f6e105faf7
BLAKE2b-256 23122220bb041fe5a0fda3aec3796d55748ceed798c9fa381f8b846efb4c9457

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