Skip to main content

Minimal psycopg2 wrapper for easier interfacing with databases

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psycopg2-contextmanager-1.0.3.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file psycopg2-contextmanager-1.0.3.tar.gz.

File metadata

File hashes

Hashes for psycopg2-contextmanager-1.0.3.tar.gz
Algorithm Hash digest
SHA256 5ee365b6eb829394933ad076c6b5ddd50d3c9ac475eac09b7adacd7358e57a20
MD5 c04142dd7fe2b6b802588573b98f612d
BLAKE2b-256 9e88e47a84bb3e316fefa6cf4aa22a134ba1acfd9738e869a204e5066f83587e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page