Skip to main content

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


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 details)

Uploaded Source

Built Distribution

psycopg2_iam-1.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file psycopg2-iam-1.1.0.tar.gz.

File metadata

  • Download URL: psycopg2-iam-1.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.5 Darwin/20.6.0

File hashes

Hashes for psycopg2-iam-1.1.0.tar.gz
Algorithm Hash digest
SHA256 dea67c8f11b0fea21d124b72f19e0166a4ebf6960285bac5fdf358b0f671f08a
MD5 68d9afa5d289e1ab614ada922e73df92
BLAKE2b-256 f78dd6ad2ada58f71d568ebc2a604d395a1050370c63083f988462fefb17890b

See more details on using hashes here.

File details

Details for the file psycopg2_iam-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: psycopg2_iam-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.5 Darwin/20.6.0

File hashes

Hashes for psycopg2_iam-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba756e57864e7ccee3e9aadf7c7625d2f7bd6b04509f788ec422f8b9147f7099
MD5 9416acf418774c43677f93aff2e49844
BLAKE2b-256 753a7a497a26a1a1599f620433f6fc7c01bc1f818bd4de69d16e5da9e0c952ae

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