AWS Redshift
The sqlalchemy-redshift library is the recommended way to connect to Redshift through SQLAlchemy.
This dialect requires either redshift_connector or psycopg2 to work properly.
You’ll need to set the following values to form the connection string:
- User Name: userName
- Password: DBPassword
- Database Host: AWS Endpoint
- Database Name: Database Name
- Port: default 5439
psycopg2
Here’s what the SQLALCHEMY URI looks like:
redshift+psycopg2://<userName>:<DBPassword>@<AWS End Point>:5439/<Database Name>
redshift_connector
Here’s what the SQLALCHEMY URI looks like:
redshift+redshift_connector://<userName>:<DBPassword>@<AWS End Point>:5439/<Database Name>
Using IAM-based credentials with Redshift cluster:
Amazon redshift cluster also supports generating temporary IAM-based database user credentials.
Your superset app’s IAM role should have permissions to call the redshift:GetClusterCredentials
operation.
You have to define the following arguments in Superset’s redshift database connection UI under ADVANCED —> Others —> ENGINE PARAMETERS.
{"connect_args":{"iam":true,"database":"<database>","cluster_identifier":"<cluster_identifier>","db_user":"<db_user>"}}
and SQLALCHEMY URI should be set to redshift+redshift_connector://
Using IAM-based credentials with Redshift serverless:
Redshift serverless supports connection using IAM roles.
Your superset app’s IAM role should have redshift-serverless:GetCredentials
and redshift-serverless:GetWorkgroup
permissions on Redshift serverless workgroup.
You have to define the following arguments in Superset’s redshift database connection UI under ADVANCED —> Others —> ENGINE PARAMETERS.
{"connect_args":{"iam":true,"is_serverless":true,"serverless_acct_id":"<aws account number>","serverless_work_group":"<redshift work group>","database":"<database>","user":"IAMR:<superset iam role name>"}}