Skip to main content

Classic SQL Storage

This package provides contextual transactions processing for SQLAlchemy and base for pattern "Repository".

Part of project "Classic".

Usage:

from classic.sql_storage import TransactionContext
from sqlalchemy import create_engine, text


engine = create_engine('sqlite:///')

transaction = TransactionContext(bind=engine)


# As context manager:
with transaction:
    transaction.current_session.execute(
        text('SELECT 1')
    )


# As decorator:
@transaction
def some_work():
    transaction.current_session.execute(
        text('SELECT 1')
    )


# Propagation:
@transaction
def complex_function():
    """Doing complex work with db.
    Session will be commited only after finish of complex_function call.
    TransactionContext will count all calls, and will commit or rollback session
    only in last call.
    """
    some_work()
    some_work()
    some_work()
    
    with transaction:
        transaction.current_session.execute(
            text('SELECT 1')
        )


# Automatic rollback
@transaction
def function_with_error():
    """Changes, made by some_work, will be cancelled after raising error"""
    some_work()
    raise ValueError()

Metadata

Release files for classic-sql-storage 0.0.2

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

Source distribution (sdist)

Source distribution for classic-sql-storage 0.0.2
File Size Uploaded Provenance
classic_sql_storage-0.0.2.tar.gz 3.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for classic-sql-storage 0.0.2
File Interpreter ABI Platform
classic_sql_storage-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / classic_sql_storage-0.0.2.tar.gz

Download URL classic_sql_storage-0.0.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f7eee7a252537bd026bed4a7ea3792370eaae99139dfedebdd6e47ea3690f78e
BLAKE2b-256 checksum
How to use checksums
e296fd3f691cae1b1e021fbf79428e3a5172173ac64a0351e35087c3142ebb47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / classic_sql_storage-0.0.2-py3-none-any.whl

Download URL classic_sql_storage-0.0.2-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d4de788121a685753f112a5434d98da3b1f6646161badd02d9d6f587c64d0a6
BLAKE2b-256 checksum
How to use checksums
c798e10e9b0027afd52b30b01d04a56eaf1c67aed95b1ad446a1e36f38b1f56b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Security for classic-sql-storage 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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