DBAPI 2.0 adapter & SqlAlchemy Dialect for the RDS Data API
Project description
DB-API 2.0 driver & SqlAlchemy dialect for the AWS RDS Data API
NOTE: This is currently ALPHA quality software and has not been thoroughly tested yet
The RDS Data API allows use of MySQL and PostgreSQL RDS databases via an HTTP API, making it ideal for use in AWS Lambda because it allow syou to use RDS without running your lambda in a VPC. This library wraps that API in both a DB-API 2.0 driver and SqlAlchemy dialect allowing you to tap into the vast python ecosystem for working with relational databases.
Installation
pip install rdsdataapi
Usage
To use the DB-API 2.0 interface:
from rdsdataapi import connect
con = connect(
resource_arn="arn:aws:rds:us-east-1:490103061721:cluster:database-2",
secret_arn="arn:aws:secretsmanager:us-east-1:490103061721:secret:pgdb-gIucWr",
database="postgres",
)
cur = con.cursor()
cur.execute("select :foo as bar", {"foo": "foobar"})
result = cur.fetchall()
Or via SqlAlchemy:
engine = create_engine(
'rdsdataapi://',
connect_args=dict(
resource_arn="arn:aws:rds:us-east-1:490103061721:cluster:database-2",
secret_arn="arn:aws:secretsmanager:us-east-1:490103061721:secret:pgdb-gIucWr",
database="postgres",
)
)
with engine.connect() as con:
result = con.execute("select :foo as bar", foo="foobar")
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
Built Distribution
File details
Details for the file rdsdataapi-0.1.1.tar.gz
.
File metadata
- Download URL: rdsdataapi-0.1.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc2571ca8f35fce6fa5eae33707339a782d4f32e0a7b6f0adddb9e8ccf3918b8 |
|
MD5 | 7b3b4f531b1f0b56c164e6ba90684061 |
|
BLAKE2b-256 | 65d1cfa11cf98337afb3e296f8e75d8af13c1351fc94044f573a42b790a4fc3f |
File details
Details for the file rdsdataapi-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: rdsdataapi-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a467d3c00007861f9f2fa3467650801e52c1cc974ee5ed01f0d8c23ec7235927 |
|
MD5 | c351801fa6932c19d1ea059b77dd6a7a |
|
BLAKE2b-256 | 5b29ac3ffcb9a3bc7a3c1778d10ee2e1ca9df86a8dfbcbf958449437e749bae2 |