RedshiftDataAPIService / Paginator / ListSessions

ListSessions

class RedshiftDataAPIService.Paginator.ListSessions
paginator = client.get_paginator('list_sessions')
paginate(**kwargs)

Creates an iterator that will paginate through responses from RedshiftDataAPIService.Client.list_sessions().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    SessionId='string',
    Status='AVAILABLE'|'BUSY'|'CLOSED',
    RoleLevel=True|False,
    ClusterIdentifier='string',
    WorkgroupName='string',
    Database='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters:
  • SessionId (string) – The identifier of a specific session to return metadata for. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. When you provide SessionId, you can’t specify Status, ClusterIdentifier, WorkgroupName, or Database.

  • Status (string) –

    The status of the sessions to list. If no status is specified, sessions with a status of AVAILABLE or BUSY are returned. Status values are defined as follows:

    • AVAILABLE – The session is open and ready to run a SQL statement.

    • BUSY – The session is currently running a SQL statement.

    • CLOSED – The session is closed and can no longer run SQL statements.

  • RoleLevel (boolean) – Specifies whether to return all sessions created by the caller’s IAM role, including sessions from previous IAM sessions. If false, only sessions created in the current IAM session are returned. The default is true.

  • ClusterIdentifier (string) – The cluster identifier. Only sessions on this cluster are returned. When providing ClusterIdentifier, then WorkgroupName can’t be specified.

  • WorkgroupName (string) – The serverless workgroup name or Amazon Resource Name (ARN). Only sessions on this workgroup are returned. When providing WorkgroupName, then ClusterIdentifier can’t be specified.

  • Database (string) – The name of the database. Only sessions connected to this database are returned.

  • PaginationConfig (dict) –

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) –

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) –

      The size of each page.

    • StartingToken (string) –

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type:

dict

Returns:

Response Syntax

{
    'Sessions': [
        {
            'SessionId': 'string',
            'Status': 'AVAILABLE'|'BUSY'|'CLOSED',
            'CreatedAt': datetime(2015, 1, 1),
            'UpdatedAt': datetime(2015, 1, 1),
            'Database': 'string',
            'DbUser': 'string',
            'ClusterIdentifier': 'string',
            'WorkgroupName': 'string',
            'SessionAliveSeconds': 123,
            'SessionTtl': datetime(2015, 1, 1),
            'CurrentStatementId': 'string'
        },
    ],

}

Response Structure

  • (dict) –

    • Sessions (list) –

      The sessions that match the request.

      • (dict) –

        Contains the metadata for a session returned by ListSessions, including its status, compute target, database connection, and lifecycle timestamps.

        • SessionId (string) –

          The session identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.

        • Status (string) –

          The status of the session. Status values are defined as follows:

          • AVAILABLE – The session is open and ready to run a SQL statement.

          • BUSY – The session is currently running a SQL statement.

          • CLOSED – The session is closed and can no longer run SQL statements.

        • CreatedAt (datetime) –

          The date and time (UTC) when the session was created.

        • UpdatedAt (datetime) –

          The date and time (UTC) that the session metadata was last updated. An example is the time the status last changed.

        • Database (string) –

          The name of the database that the session is connected to.

        • DbUser (string) –

          The database user name.

        • ClusterIdentifier (string) –

          The cluster identifier. This element is not returned when connecting to a serverless workgroup.

        • WorkgroupName (string) –

          The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.

        • SessionAliveSeconds (integer) –

          The number of seconds that the session is kept alive after a query finishes.

        • SessionTtl (datetime) –

          The date and time (UTC) when the session is set to expire and be closed.

        • CurrentStatementId (string) –

          The identifier of the SQL statement currently running in the session. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This element is returned only when the session status is BUSY.