connect

Redshift connection parameters and utility functions.

class simple_aws_redshift.connect.BaseRedshiftConnectionParams(host: str = REQ, port: int = REQ, username: str = REQ, password: str = REQ, database: str = REQ)[source]

Base class for Redshift connection parameters.

get_connection(timeout: int = 3) Connection[source]

Create a Redshift connection using the parameters.

Returns:

A redshift_connector.Connection object.

class simple_aws_redshift.connect.RedshiftClusterConnectionParams(host: str = REQ, port: int = REQ, username: str = REQ, password: str = REQ, database: str = REQ, expiration: datetime = REQ, next_refresh_time: datetime = REQ, cluster: RedshiftCluster = REQ)[source]

Parameters for connecting to a Redshift cluster. Inherits from RedshiftConnectionParams.

classmethod new(redshift_client: RedshiftClient, db_name: str = OPT, cluster_identifier: str = OPT, duration_seconds: int = OPT, custom_domain_name: str = OPT)[source]

Create a new instance of RedshiftClusterConnectionParams based on the Redshift cluster identifier.

Parameters:
  • redshift_client – boto3.client(“redshift”) object

  • db_name – The name of the database to connect to.

  • cluster_identifier – The identifier of the Redshift cluster.

  • duration_seconds – Optional duration in seconds for the credentials.

  • custom_domain_name – Optional custom domain name for the connection.

class simple_aws_redshift.connect.RedshiftServerlessConnectionParams(host: str = REQ, port: int = REQ, username: str = REQ, password: str = REQ, database: str = REQ, expiration: datetime.datetime = REQ, next_refresh_time: datetime.datetime = REQ, namespace: simple_aws_redshift.redshift_serverless.model.RedshiftServerlessNamespace = REQ, workgroup: simple_aws_redshift.redshift_serverless.model.RedshiftServerlessWorkgroup = REQ)[source]
classmethod new(redshift_serverless_client: RedshiftServerlessClient, namespace_name: str, workgroup_name: str, custom_domain_name: str = OPT, duration_seconds: int = OPT)[source]

Create a new instance of RedshiftServerlessConnectionParams based on the redshift serverless namespace and workgroup.

Parameters:
  • redshift_serverless_client – boto3.client(“redshift-serverless”) object

  • namespace_name – The name of the Redshift serverless namespace.

  • workgroup_name – The name of the Redshift serverless workgroup.

  • custom_domain_name – Optional custom domain name for the connection.

  • duration_seconds – Optional duration in seconds for the credentials.