Pre-release
This release is a pre-release and may not be stable for production use.
pgsql-connection-handler
A package that connects to one or more PostgreSQL databases and allows you to retrieve a database connection when required. Depends on psycopg2-binary.
Quickstart
-
Install the package:
pip install pgsql-connection-handler -
Use the package:
from pg_connection_handler import databases, connect_databases DATABASES = { 'default': { 'dbname': 'mydatabase', 'user': 'guido', 'password': 'SuperS3cr!t', 'host': 'localhost', 'port': '5432', 'sslmode': 'disable', 'application_name': 'myapp', }, 'another_db': { 'dbname': 'mydatabase', 'user': 'guido', 'password': 'SuperS3cr!t', 'host': 'localhost', 'port': '5432', 'sslmode': 'disable', 'application_name': 'myapp', }, } connect_databases(DATABASES) db_connection = databases.get_connection() # Or get the connection based on the alias used in DATABASES db_connection = databases.get_connection('db_alias') # Or get the database object db = databases.get() db_connection = db.conn
Compatiblity
- Compatible with Python 3.8 and above.
Versioning
This project follows semantic versioning (SemVer).
License, code of conduct and requirements
Check the root of the repo for these files.
Metadata
Release files for pgsql-connection-handler 1.0.0b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pgsql-connection-handler-1.0.0b0.tar.gz | 16.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pgsql_connection_handler-1.0.0b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / pgsql-connection-handler-1.0.0b0.tar.gz
| Download URL | pgsql-connection-handler-1.0.0b0.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3829e2862436bd16a6896150d45ecb42a5dc44ae32ac41d5fd31bea9b290500d
|
|
BLAKE2b-256 checksum How to use checksums |
fd4ad785cf94c6751c3d269a7adc180e8947f427d5cd0385b083d3c450989a0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / pgsql_connection_handler-1.0.0b0-py3-none-any.whl
| Download URL | pgsql_connection_handler-1.0.0b0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2dd9d5fe220b5b27f996f5acf1272c0555a4cef4f81d478cc3292538da0c261
|
|
BLAKE2b-256 checksum How to use checksums |
ce21ed0eda17dad050b372e090c27de368647b55abf6eb26f1c332ae45f9432d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|