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 (Session | None) – The default boto3 session will be used if boto3_session is None.

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

Return type:

RedshiftDataApi

Returns:

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