Skip to main content

Assorted utility functions to support working with SQLAlchemy.

Function auto_session(func)

Decorator to run a function in a session is not presupplied.

Class ORM

A convenience base class for an ORM class.

This defines a .Base attribute which is a new DeclarativeBase and provides various Session related convenience methods.

Subclasses must define their private ._Session factory in their own __init__, for example:

self._Session = sessionmaker(bind=engine)

Function orm_auto_session(method)

Decorator to run a method in a session derived from self.orm if a session is not presupplied. Intended to assist classes with a .orm attribute.

Function with_session(func, *a, orm=None, session=None, **kw)

Call func(*a,session=session,**kw), creating a session if required.

This is the inner mechanism of @auto_session and ORM.auto_session_method.

Parameters:

  • func: the function to call
  • a: the positional parameters
  • orm: optional ORM class with a .session() context manager method
  • session: optional existing ORM session

One of orm or session must be not None; if session is None then one is made from orm.session() and used as a context manager. The session is also passed to func as the keyword parameter session to support nested calls.

Metadata

Release files for cs-sqlalchemy-utils 20190403

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

Source distribution (sdist)

Source distribution for cs-sqlalchemy-utils 20190403
File Size Uploaded Provenance Actions
cs.sqlalchemy_utils-20190403.tar.gz 3.0 kB Without provenance Details for cs.sqlalchemy_utils-20190403.tar.gz

Release files / cs.sqlalchemy_utils-20190403.tar.gz

Download URL cs.sqlalchemy_utils-20190403.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8ccd3b7e1652254d76005af747f520cf7ba2a94427206950b73bd54b01f146bc
BLAKE2b-256 checksum
How to use checksums
2e63bfd3e774dfb7bed4075104d2650f9a545898a14fec45f1fbe4d56a8a5a18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.8

Security for cs-sqlalchemy-utils 20190403

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