wrapper for PostgreSQL queries with transaction and connection pooling support
Project description
elephant_parsel
wrapper for PostgreSQL queries with transaction and connection pooling support
This project is about making psycopg2 easier to use.
supported versions
Debian >=10, psycopg2 >=2.7, python >=3.7
installation
install using pipenv:
pipenv install elephant_parsel
basic usage
from elephant_parsel.postgres_db import PostgresDB, PostgresDBException
import logging
db = PostgresDB(connection_config=dict(
host='db.example.com',
port=5432,
dbname='the_database_name',
user='the_username',
password='****',
minconn=1,
maxconn=4
), logger=logging.getLogger(), connect=True, register_hstore=False)
server_version_string = db.query_one('select version()', None, column='version')
The connection_config
is used as kwargs for the psycopg2.ThreadedConnectionPool
, so it should support all libpq connection variables: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
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
elephant_parsel-1.2.0.tar.gz
(8.8 kB
view hashes)
Built Distribution
Close
Hashes for elephant_parsel-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49cd0ba3d9b830081f44687a6777b33eb42b7ad8f85ee82e9099f7f6b7b9c225 |
|
MD5 | 47cb81a7bb52331553742a280e2b1cb2 |
|
BLAKE2b-256 | 9d1bf7ad388cce5819eb5f06fd6af2b5939b6745b5a47118d98a53d6dbf3f394 |