Registry / aws / pandas-redshift

pandas-redshift

JSON →
library2.0.5pypypiunverified

A library to load data from Amazon Redshift into a pandas DataFrame and write DataFrames back to Redshift. Version 2.0.5 is the latest; release cadence is sporadic. It uses SQLAlchemy under the hood for connection management.

pip install pandas-redshift
INSTALL
IMPORT
SIG · PANDAS-REDSHIFT
P
pandas-redshift
awspythonv2.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

read_redshift
from pandas_redshift import read_redshift
from pandas_redshift import read_redshift as old_func
The correct import path is from pandas_redshift, not pandas_redshift.read_redshift directly.
df_to_redshift
from pandas_redshift import df_to_redshift
No common mistake for this symbol.

Basic example: read query results into DataFrame, then write DataFrame to a new table.

import pandas as pd import pandas_redshift as pr # Set Redshift connection parameters conn_params = { 'host': 'mycluster.redshift.amazonaws.com', 'port': 5439, 'database': 'mydb', 'user': 'myuser', 'password': 'mypassword' } # Read from Redshift query = "SELECT * FROM my_table LIMIT 100" df = pr.read_redshift(query, conn_params=conn_params) print(df.head()) # Write DataFrame to Redshift (uses csv upload to S3) pr.df_to_redshift(df, 'my_table', conn_params=conn_params, s3_bucket='my-bucket', iam_role='arn:aws:iam::...')
Debug
Known issues
breakingIn version 2.0.0, the package was renamed from 'redshift-pandas' to 'pandas-redshift'. Existing imports of 'redshift_pandas' will break.
fix
Change import from 'import redshift_pandas' to 'import pandas_redshift'.
affects: 2.0.0 and later
gotchaThe default behavior for df_to_redshift uses S3 staging; if you don't provide s3_bucket and iam_role, the function will fail silently or raise a confusing error.
fix
Always specify s3_bucket and iam_role (or access_key/secret_key) when writing to Redshift.
affects: all
deprecatedThe old 'redshift' module (import redshift) was renamed and deprecated. Support for the old API may be removed in a future release.
fix
Use 'import pandas_redshift' instead of 'import redshift'.
affects: 2.x
Upgrade
Version history
2.0.5latest on PyPI · released Apr 20, 2021
Audit
Dependencies
pandasrequiredRequired for DataFrame handling.
sqlalchemyrequiredUsed for database connections.
boto3optionalOptional: used for S3 staging (Redshift COPY/UNLOAD).
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
pandas-redshift — pip install pandas-redshift · libregistry