RedshiftDataAPIService / Client / get_statement_result_v2

get_statement_result_v2#

RedshiftDataAPIService.Client.get_statement_result_v2(**kwargs)#

Fetches the temporarily cached result of an SQL statement in CSV format. The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as CSV. A token is returned to page through the statement results.

For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

See also: AWS API Documentation

Request Syntax

response = client.get_statement_result_v2(
    Id='string',
    NextToken='string'
)
Parameters:
  • Id (string) –

    [REQUIRED]

    The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. A suffix indicates then number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.

  • NextToken (string) – A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

Return type:

dict

Returns:

Response Syntax

{
    'ColumnMetadata': [
        {
            'columnDefault': 'string',
            'isCaseSensitive': True|False,
            'isCurrency': True|False,
            'isSigned': True|False,
            'label': 'string',
            'length': 123,
            'name': 'string',
            'nullable': 123,
            'precision': 123,
            'scale': 123,
            'schemaName': 'string',
            'tableName': 'string',
            'typeName': 'string'
        },
    ],
    'NextToken': 'string',
    'Records': [
        {
            'CSVRecords': 'string'
        },
    ],
    'ResultFormat': 'JSON'|'CSV',
    'TotalNumRows': 123
}

Response Structure

  • (dict) –

    • ColumnMetadata (list) –

      The properties (metadata) of a column.

      • (dict) –

        The properties (metadata) of a column.

        • columnDefault (string) –

          The default value of the column.

        • isCaseSensitive (boolean) –

          A value that indicates whether the column is case-sensitive.

        • isCurrency (boolean) –

          A value that indicates whether the column contains currency values.

        • isSigned (boolean) –

          A value that indicates whether an integer column is signed.

        • label (string) –

          The label for the column.

        • length (integer) –

          The length of the column.

        • name (string) –

          The name of the column.

        • nullable (integer) –

          A value that indicates whether the column is nullable.

        • precision (integer) –

          The precision value of a decimal number column.

        • scale (integer) –

          The scale value of a decimal number column.

        • schemaName (string) –

          The name of the schema that contains the table that includes the column.

        • tableName (string) –

          The name of the table that includes the column.

        • typeName (string) –

          The database-specific data type of the column.

    • NextToken (string) –

      A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

    • Records (list) –

      The results of the SQL statement in CSV format.

      • (dict) –

        The results of the SQL statement.

        Note

        This is a Tagged Union structure. Only one of the following top level keys will be set: CSVRecords. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

        'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
        
        • CSVRecords (string) –

          The results of the SQL statement in CSV format.

    • ResultFormat (string) –

      The data format of the result of the SQL statement.

    • TotalNumRows (integer) –

      The total number of rows in the result set returned from a query. You can use this number to estimate the number of calls to the GetStatementResultV2 operation needed to page through the results.

Exceptions

  • RedshiftDataAPIService.Client.exceptions.ValidationException

  • RedshiftDataAPIService.Client.exceptions.ResourceNotFoundException

  • RedshiftDataAPIService.Client.exceptions.InternalServerException