awswrangler.redshift.connect_temp(cluster_identifier: str, user: str, database: Optional[str] = None, duration: int = 900, auto_create: bool = True, db_groups: Optional[List[str]] = None, boto3_session: Optional[boto3.session.Session] = None, ssl: bool = True, timeout: Optional[int] = None, max_prepared_statements: int = 1000, tcp_keepalive: bool = True) → redshift_connector.core.Connection

Return a redshift_connector temporary connection (No password required).

  • cluster_identifier (str) – The unique identifier of a cluster. This parameter is case sensitive.

  • user (str, optional) – The name of a database user.

  • database (str, optional) – Database name. If None, the default Database is used.

  • duration (int, optional) – The number of seconds until the returned temporary password expires. Constraint: minimum 900, maximum 3600. Default: 900

  • auto_create (bool) – Create a database user with the name specified for the user named in user if one does not exist.

  • boto3_session (boto3.Session(), optional) – Boto3 Session. The default boto3 session will be used if boto3_session receive None.

  • ssl (bool) – This governs SSL encryption for TCP/IP sockets. This parameter is forward to redshift_connector.

  • timeout (Optional[int]) – This is the time in seconds before the connection to the server will time out. The default is None which means no timeout. This parameter is forward to redshift_connector.

  • max_prepared_statements (int) – This parameter is forward to redshift_connector.

  • tcp_keepalive (bool) – If True then use TCP keepalive. The default is True. This parameter is forward to redshift_connector.


redshift_connector connection.

Return type



>>> import awswrangler as wr
>>> con = wr.redshift.connect("MY_GLUE_CONNECTION")
>>> with con.cursor() as cursor:
>>>     cursor.execute("SELECT 1")
>>>     print(cursor.fetchall())
>>> con.close()