wrap-connection
Easily wrap connections and cursors by using decorators.
Usage example:
A simple usage is this:
def make_connection():
import sqlite3
return sqlite3.connect("test.db")
@transact(make_connection, "cur", "con")
def some_operation(person):
insert_sql = "INSERT INTO persons (id, name) VALUES (?, ?)"
cur.execute(insert_sql, (person.id, person.name))
con.commit()
@transact(make_connection)
def some_other_operation():
select_sql = "SELECT id, name FROM persons"
result = []
cursor.execute(select_sql)
for r in cursor.fetchall():
result.append(Person(r[0], r[1]))
return result
Those will delimite a transaction in the some_operation and some_other_operation functions. The make_connection function is used to get the connection for each transaction.
Metadata
Release files for wrap-connection 2.0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wrap-connection-2.0.0.0.tar.gz | 2.8 kB | Without provenance | Details for wrap-connection-2.0.0.0.tar.gz |
Release files / wrap-connection-2.0.0.0.tar.gz
| Download URL | wrap-connection-2.0.0.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50b4ad939dc7ff1caecce0c735ca93d15784e86326762fc0242066abe16d54b5
|
|
BLAKE2b-256 checksum How to use checksums |
65dcfe4358d481e154086ec4fadaaffae6fbe3cb175697d901ac23c5c23f9c13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Security for wrap-connection 2.0.0.0
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.