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.2.tar.gz (1.7 kB view hashes)

Uploaded Source

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