Installation
Run pip install psycopg2-contextmanager
Usage
from psycopg2_contextmanager import database_connection
with database_connection(<database_connection_string>) as cursor:
cursor.execute(<query>)
Commits are handled automatically. If the query fails, the package will log the exception along with the line Unable to run query and re-raise it.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file psycopg2-contextmanager-1.0.3.tar.gz.
File metadata
- Download URL: psycopg2-contextmanager-1.0.3.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ee365b6eb829394933ad076c6b5ddd50d3c9ac475eac09b7adacd7358e57a20
|
|
| MD5 |
c04142dd7fe2b6b802588573b98f612d
|
|
| BLAKE2b-256 |
9e88e47a84bb3e316fefa6cf4aa22a134ba1acfd9738e869a204e5066f83587e
|