awswrangler.data_api.redshift.connect

awswrangler.data_api.redshift.connect(cluster_id: str = '', database: str = '', workgroup_name: str = '', secret_arn: str = '', db_user: str = '', boto3_session: Session | None = None, **kwargs: Any) RedshiftDataApi

Create a Redshift Data API connection.

Note

When connecting to a standard Redshift cluster, cluster_id is used. When connecting to Redshift Serverless, workgroup_name is used. These two arguments are mutually exclusive.

Parameters:
  • cluster_id (str) – Id for the target Redshift cluster - only required if workgroup_name not provided.

  • database (str) – Target database name.

  • workgroup_name (str) – Name for the target serverless Redshift workgroup - only required if cluster_id not provided.

  • secret_arn (str) – The ARN for the secret to be used for authentication - only required if db_user not provided.

  • db_user (str) – The database user to generate temporary credentials for - only required if secret_arn not provided.

  • boto3_session (boto3.Session(), optional) – The boto3 session. If None, the default boto3 session is used.

  • **kwargs – Any additional kwargs are passed to the underlying RedshiftDataApi class.

Return type:

A RedshiftDataApi connection instance that can be used with wr.redshift.data_api.read_sql_query.