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.2.0.tar.gz (48.3 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-1.2.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sa_repository-1.2.0.tar.gz
  • Upload date:
  • Size: 48.3 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-1.2.0.tar.gz
Algorithm Hash digest
SHA256 99fade40c503e7187338de21cf1a568590891bbba5dc81e9d2cd6f921abf37c2
MD5 d4c77c0badb3e5e4ff77f5be6a8e6116
BLAKE2b-256 61eb33aa32524247aad1e6615d857cdf6cc6b8a7f1e923e3b918c8404dc6c1fd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sa_repository-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 386121b603872dcf5c125e6d2c37147332ae52e3c64310250abe508201c5862e
MD5 a2648546a82f3260f04b680322cb066c
BLAKE2b-256 69e02666576881a0f8b2653ec53f54141bd8860f97353e8f70606fbcaa4d0488

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