Custom Connection Factory class (RDS, Redshift) with build-in IAM authentication and SSL bundle downloader support.
Project description
psycopg2-iam
Custom Connection Factory class (RDS, Redshift) with build-in IAM authentication and SSL bundle downloader support.
Installation
Install package
poetry add psycopg2-iam
Usage
Create connection directly from secret
from psycopg2_iam import connect
conn = connect(secret="secretId")
Using connect function
from psycopg2_iam import connect
connect(dsn="...")
Pass connection factory class to psycopg2.connect()
import psycopg2
from psycopg2_iam import IAMConnection
psycopg2.connect(dsn="...", connection_factory=IAMConnection)
Create DSN from AWS generated RDS secret
import boto3
import json
import psycopg2
from psycopg2_iam import IAMConnection, dsn_from_rds_secret
secrets = boto3.client("secretsmanager")
db_secret = json.loads(secrets.get_secret_value(SecretId="/dynks/rds/readonly").get("SecretString"))
psycopg2.connect(dsn=dsn_from_rds_secret(db_secret), connection_factory=IAMConnection)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
psycopg2-iam-1.1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for psycopg2_iam-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba756e57864e7ccee3e9aadf7c7625d2f7bd6b04509f788ec422f8b9147f7099 |
|
MD5 | 9416acf418774c43677f93aff2e49844 |
|
BLAKE2b-256 | 753a7a497a26a1a1599f620433f6fc7c01bc1f818bd4de69d16e5da9e0c952ae |