{"id":27222,"library":"pandas-redshift","title":"pandas-redshift","description":"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.","status":"active","version":"2.0.5","language":"python","source_language":"en","source_url":"https://github.com/agawronski/pandas-redshift","tags":["redshift","pandas","aws","data loading"],"install":[{"cmd":"pip install pandas-redshift","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Required for DataFrame handling.","package":"pandas","optional":false},{"reason":"Used for database connections.","package":"sqlalchemy","optional":false},{"reason":"Optional: used for S3 staging (Redshift COPY/UNLOAD).","package":"boto3","optional":true}],"imports":[{"note":"The correct import path is from pandas_redshift, not pandas_redshift.read_redshift directly.","wrong":"from pandas_redshift import read_redshift as old_func","symbol":"read_redshift","correct":"from pandas_redshift import read_redshift"},{"note":"No common mistake for this symbol.","symbol":"df_to_redshift","correct":"from pandas_redshift import df_to_redshift"}],"quickstart":{"code":"import pandas as pd\nimport pandas_redshift as pr\n\n# Set Redshift connection parameters\nconn_params = {\n    'host': 'mycluster.redshift.amazonaws.com',\n    'port': 5439,\n    'database': 'mydb',\n    'user': 'myuser',\n    'password': 'mypassword'\n}\n\n# Read from Redshift\nquery = \"SELECT * FROM my_table LIMIT 100\"\ndf = pr.read_redshift(query, conn_params=conn_params)\nprint(df.head())\n\n# Write DataFrame to Redshift (uses csv upload to S3)\npr.df_to_redshift(df, 'my_table', conn_params=conn_params, s3_bucket='my-bucket', iam_role='arn:aws:iam::...')\n","lang":"python","description":"Basic example: read query results into DataFrame, then write DataFrame to a new table."},"warnings":[{"fix":"Change import from 'import redshift_pandas' to 'import pandas_redshift'.","message":"In version 2.0.0, the package was renamed from 'redshift-pandas' to 'pandas-redshift'. Existing imports of 'redshift_pandas' will break.","severity":"breaking","affected_versions":"2.0.0 and later"},{"fix":"Always specify s3_bucket and iam_role (or access_key/secret_key) when writing to Redshift.","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'import pandas_redshift' instead of 'import redshift'.","message":"The old 'redshift' module (import redshift) was renamed and deprecated. Support for the old API may be removed in a future release.","severity":"deprecated","affected_versions":"2.x"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install pandas-redshift'.","cause":"Installed the deprecated package 'redshift-pandas' (or 'redshift') instead of 'pandas-redshift'.","error":"ModuleNotFoundError: No module named 'pandas_redshift'"},{"fix":"Upgrade to latest version: 'pip install --upgrade pandas-redshift'","cause":"Possibly installed a very old version (pre-2.0) or used a different package name.","error":"AttributeError: module 'pandas_redshift' has no attribute 'read_redshift'"},{"fix":"Ensure the Redshift cluster is accessible and the connection dictionary includes all required keys.","cause":"Missing or incorrect Redshift connection parameters (host, port, dbname, user, password).","error":"psycopg2.OperationalError: could not connect to server"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}