Skip to main content

sqlalchemy-sessionload

PyPI - Downloads GitHub license Codecov Routine Checks

SQLAlchemy load option that loads from persisted session instances.

Basic usage

SessionLoad is available for basic queries and relationship loading

Filters and Order By constructs are also supported. If you miss something you are invited to contribute.

For installation the plugin has to be registered:

from sqlalchemy_sessionload import SQLAlchemySessionLoad

Session = sessionmaker(...)
SQLAlchemySessionLoad(Session)

Simple Query

import sqlalchemy as sa
from sqlalchemy_sessionload import SessionLoad
from project.model import Message

# assignment is needed
# otherwise instances are not saved in session
all_messages = session.scalars(sa.select(Message)).all()

session_messages = session.scalars(
    sa.select(Message).options(SessionLoad(Message))
).all()

Load relationship

Joined loading is currently only available with subqueryload.

from sqlalchemy import select
from sqlalchemy_sessionload import SessionRelationshipLoad
from project.model import Message, User
import sqlalchemy.orm as sa_orm

# assignment is needed
# otherwise instances are not saved in session
all_users = session.scalars(sa.select(User)).all()


# users connected to messages are now loaded from session
session_messages = session.scalars(
    sa.select(Message).options(
        sa_orm.subqueryload(Message.user), SessionRelationshipLoad(Message.user)
    )
).all()

Benchmark

A benchmark is available here

Metadata

Release files for sqlalchemy-sessionload 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlalchemy-sessionload 1.1.1
File Size Uploaded Provenance Actions
sqlalchemy_sessionload-1.1.1.tar.gz 11.9 kB Without provenance Details for sqlalchemy_sessionload-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqlalchemy-sessionload 1.1.1
File Interpreter ABI Platform Actions
sqlalchemy_sessionload-1.1.1-py3-none-any.whl Python 3 none any Details for sqlalchemy_sessionload-1.1.1-py3-none-any.whl

Total release size: 21.6 kB

Release files / sqlalchemy_sessionload-1.1.1.tar.gz

Download URL sqlalchemy_sessionload-1.1.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f1da4c49d9b2188be983867721b7a4fbbc1c6174f3652ea9c25c6481844f2963
BLAKE2b-256 checksum
How to use checksums
cb142a2acfbeb235ca47dc34ddc0ef55a65274645e3102fb4b29d5fc832b1fe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.29.2 CPython/3.10.21 Linux/6.17.0-1022-azure

Release files / sqlalchemy_sessionload-1.1.1-py3-none-any.whl

Download URL sqlalchemy_sessionload-1.1.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d031a678b8b912c51f2fc973542255f71b6b35d65b971ac700336ea1e376418
BLAKE2b-256 checksum
How to use checksums
d67e4cdbe858b5ffee50b6c7cdc31fa29e27db4ad4323491f6c691ba3499f583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.29.2 CPython/3.10.21 Linux/6.17.0-1022-azure

Security for sqlalchemy-sessionload 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page