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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sa_repository-2.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sa_repository-2.0.0.tar.gz
  • Upload date:
  • Size: 49.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sa_repository-2.0.0.tar.gz
Algorithm Hash digest
SHA256 10adc57bc3130ef8c8a0bf1439c8275fb4403e7590afeedcaefb88370a9c8134
MD5 4d51e413c849ccf4dad168f3b71a4620
BLAKE2b-256 7dda11a3a0e89ddd36ec1b3c18deb016078cfda807fe9195b5d6db11eda54f7e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sa_repository-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sa_repository-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc56b5e8cbabebea08d530ad40effa5eed4699a9c4210f6893552d93216a40f2
MD5 55549c9cbf1e7bce7fc2aca4c4006220
BLAKE2b-256 b59bdc82ac676261930d72b9b47a97de65b5c152a1a8e499bbd06e43cc6b8fee

See more details on using hashes here.

Supported by

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