A package to upload Pandas DataFrame to Redshift
Project description
df_to_rs
df_to_rs
is a Python package that provides convenient methods to upload and upsert Pandas DataFrames to Amazon Redshift.
Installation
Install the package using pip:
pip install df_to_rs
Usage
Initialization
from df_to_rs import df_to_rs
import psycopg2
uploader = df_to_rs(
region_name='ap-south-1',
s3_bucket='your-s3-bucket',
aws_access_key_id='your-access-key-id',
aws_secret_access_key='your-secret-access-key',
redshift_c=psycopg2.connect(dbname='more', host="hostname.ap-south-1.redshift.amazonaws.com", port=1433, user='username', password='password')
)
Upload DataFrame to Redshift
uploader.upload_to_redshift(df, dest='analytics.ship_pen')
Upsert DataFrame to Redshift
Upsert (insert or update) the DataFrame into a specified destination table in Redshift. Matching rows are identified by the specified columns, and existing rows are deleted before new rows are inserted.
uploader.upsert_to_redshift(df, dest_table='analytics.ship_pen', upsert_columns=['id', 'name'])
License
This project is licensed under the MIT License - see the LICENSE.txt file for details.
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
df_to_rs-0.1.20.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file df_to_rs-0.1.20.tar.gz
.
File metadata
- Download URL: df_to_rs-0.1.20.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2683854024725d7858900583e1912b35f4f828f55c51b027deee86d46ab2d035 |
|
MD5 | a20944bf8de22af2ea62b34d4c6a77b3 |
|
BLAKE2b-256 | 0edd7ae040f2689d721392a2771efbe4e75566a8da0bec6515bd87e6bf7a3dc5 |
File details
Details for the file df_to_rs-0.1.20-py3-none-any.whl
.
File metadata
- Download URL: df_to_rs-0.1.20-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bf3e06c8956da0d08a3cc4deac8579e5a802158a717885373e212a9956c54ee |
|
MD5 | 91a3df7edb1b58ebe9a951c2b8e135a5 |
|
BLAKE2b-256 | 9f71b2d980ee815399b5d62fa1caadf5b6448c09d01f44a9e63895ad183ce93d |