Skip to main content

Simple PostgreSQL connections

Project description

SimplePG

Simple PostgreSQL connections: a wrapper around psycopg2.

Features:

  • Thread-safe connection pooling
  • Auto-reconnect on connection loss
  • Unified interface for execute, executemany, and execute_values

Installation

pip install simplepg

Example

from simplepg import DbConnection

db = DbConnection(
    user="postgres",
    password="postgres",
    host="localhost",
    port=5432,
    database="postgres",
    connect_kwargs={},
    pool_min_connections=1,
    pool_max_connections=1,
)

db.execute("CREATE TABLE test_table (id SERIAL PRIMARY KEY, name VARCHAR)")
db.execute_values("INSERT INTO test_table (name) VALUES %s", [("test1",), ("test2",)])
records, columns = db.execute("SELECT * FROM test_table")
db.execute("DROP TABLE test_table")

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

simplepg-0.1.5.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

simplepg-0.1.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file simplepg-0.1.5.tar.gz.

File metadata

  • Download URL: simplepg-0.1.5.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.4 Linux/6.2.6-76060206-generic

File hashes

Hashes for simplepg-0.1.5.tar.gz
Algorithm Hash digest
SHA256 4a8314e155131b58fe7cb0e93596717e065b828d21e78eba4a4d6a3cab4b5466
MD5 2d82d44c309346bc8ba7109781083d86
BLAKE2b-256 5199150df6367ce542317c8eef0f8e9234460514c37735f01c1828776a5e9b8e

See more details on using hashes here.

File details

Details for the file simplepg-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: simplepg-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.4 Linux/6.2.6-76060206-generic

File hashes

Hashes for simplepg-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 71e165c31333509270a5d73bae48147ca8b2ed7e2b96ff9e632e9552793197d3
MD5 2b9e5ba90658375edbc58bc629ec7128
BLAKE2b-256 fea49eb56fd880a7bff6f8f7370ae7c16686e6d1e92c28d621240ff563f28fa1

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