Lean Aurora PostgreSQL to Redshift loader via copy_expert + S3 COPY
Project description
aurora_to_rs
Lean Aurora PostgreSQL to Redshift loader using psycopg2.copy_expert + S3 + Redshift COPY.
~10x faster than DataFrame-based approaches for large tables (bypasses pandas entirely).
Install
pip install aurora_to_rs
Usage
from aurora_to_rs import aurora_to_rs
loader = aurora_to_rs(
region_name='ap-south-1',
s3_bucket='my-bucket',
redshift_c=redshift_conn, # psycopg2 connection
postgres_engine=pg_engine, # SQLAlchemy engine
iam_role_arn='arn:aws:iam::123:role/MY_ROLE'
)
# Full table refresh (TRUNCATE + COPY)
loader.upsert("SELECT * FROM master.items", "master.items", ['item_id'], clear_dest_table=True)
# Incremental upsert (staging-based)
loader.upsert("SELECT * FROM tran.orders WHERE dt>=current_date-1", "tran.orders", ['order_id'])
# Delete and insert
loader.delete_and_insert(
"SELECT * FROM tran.shipment WHERE dt>=current_date-3",
"tran.shipment", "dt>=current_date-3",
min_timestamp='2026-02-19', timestamp_col='dt'
)
# Direct copy (no delete)
loader.copy_expert_upload("SELECT * FROM staging.temp", "staging.temp")
Methods
| Method | Use Case |
|---|---|
copy_expert_upload |
Direct Aurora -> S3 -> Redshift COPY |
delete_and_insert |
DELETE by filter, then COPY new data |
upsert |
TRUNCATE+COPY (clear_dest_table=True) or staging-based upsert |
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
aurora_to_rs-0.1.0.tar.gz
(5.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aurora_to_rs-0.1.0.tar.gz.
File metadata
- Download URL: aurora_to_rs-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09efa7f591ee404c0684ad8989e5cfb8dd40ed2e467238c4b87f5fbb4d632bb0
|
|
| MD5 |
3ada0d12bf8af3f1076eacfbdcac3ba5
|
|
| BLAKE2b-256 |
485b6c438619e01d182bfd9831512fcebad0ccc8bb09af80e034e73423d95b0d
|
File details
Details for the file aurora_to_rs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aurora_to_rs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31250e68a0b99f416f7ec84a2606be3e08ee1dc6f2dd8984d2ad23490fd5e200
|
|
| MD5 |
201e2176aa7d7dda63c6ecd80d002cb4
|
|
| BLAKE2b-256 |
9c0775906a92f506e8f5f8689e46df0e3e393a094ac758294902b2280e86abe9
|