Skip to main content

Conntext

Context managers for secure and atomic database connectivity

Rationale

  • Each context being a single atomic process (“either all occur, or nothing occurs”)

  • No manual commit (success), rollback (fail) or close (either)

  • No ORM

Usage

Without Conntext,

conn = sqlite3.connect(":memory:")
try:
    cursor = conn.cursor()
    try:
        cursor.execute("CREATE TABLE person (name)")
        cursor.execute("INSERT INTO person (name) VALUES (?)",
                        ["microamp"])
    except Exception:
        raise
    finally:
        cursor.close()
except Exception:
    conn.rollback()
    raise
else:
    conn.commit()
finally:
    conn.close()

With Conntext,

from conntext import conntext

with conntext.conn(sqlite3.connect(":memory:")) as conn:
   with conntext.cursor(conn.cursor()) as cursor:
        cursor.execute("CREATE TABLE person (name)")
        cursor.execute("INSERT INTO person (name) VALUES (?)",
                       ["microamp"])

License

All the code is licensed under the GNU Lesser General Public License (v3+).

Metadata

Release files for Conntext 0.1.5

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

Source distribution (sdist)

Source distribution for Conntext 0.1.5
File Size Uploaded Provenance
Conntext-0.1.5.tar.gz 2.4 kB Without provenance Details

Release files / Conntext-0.1.5.tar.gz

Download URL Conntext-0.1.5.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f0c7b659bf1c10e4295dce766e2f1a45dfbcb593c87730ed5a861fd01932c653
BLAKE2b-256 checksum
How to use checksums
5e33e74939f6e453e032cb9b8c3089b3124fd91de771efaa8379bebb336e6b68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Conntext 0.1.5

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