Skip to content

get_statement_result async

get_statement_result(
    id: UUID,
    *,
    config_overrides: Optional[AsyncRedshiftDataClientConfig] = None,
    next_token: Optional[String] = None,
    wait_time_seconds: Optional[WaitTimeSeconds] = None,
) -> GetStatementResultResponse

Fetches the temporarily cached result of an SQL statement in JSON format. The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as JSON , or let the format default to JSON. 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.

Parameters:

  • id (UUID) –

    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.

  • next_token (Optional[String], default: None ) –

    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.

  • wait_time_seconds (Optional[WaitTimeSeconds], default: None ) –

    The number of seconds to wait for the SQL statement to complete execution before returning the result. The maximum value is 30 seconds.

Raises:

Source code in docs_src/capo_redshift_data/_services/async_redshift_data.py
async def get_statement_result(
    self,
    id: "capo_redshift_data.types.uuid.UUID",
    *,
    config_overrides: Optional[AsyncRedshiftDataClientConfig] = None,
    next_token: Optional["capo_redshift_data.types.string.String"] = None,
    wait_time_seconds: Optional[
        "capo_redshift_data.types.wait_time_seconds.WaitTimeSeconds"
    ] = None,
) -> "capo_redshift_data.types.get_statement_result_response.GetStatementResultResponse":
    """<p>Fetches the temporarily cached result of an SQL statement in JSON format. The <code>ExecuteStatement</code> or <code>BatchExecuteStatement</code> operation that ran the SQL statement must have specified <code>ResultFormat</code> as <code>JSON</code> , or let the format default to JSON. A token is returned to page through the statement results.</p> <p>For more information about the Amazon Redshift Data API and CLI usage examples, see <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/data-api.html">Using the Amazon Redshift Data API</a> in the <i>Amazon Redshift Management Guide</i>. </p>

    Args:
        id: <p>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, <code>d9b6c0c9-0747-4bf4-b142-e8883122f766:2</code> has a suffix of <code>:2</code> that indicates the second SQL statement of a batch query. This identifier is returned by <code>BatchExecuteStatment</code>, <code>ExecuteStatment</code>, and <code>ListStatements</code>. </p>
        next_token: <p>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. </p>
        wait_time_seconds: <p>The number of seconds to wait for the SQL statement to complete execution before returning the result. The maximum value is 30 seconds.</p>

    Raises:
        capo_redshift_data.errors.active_waiting_requests_exceeded_exception.ActiveWaitingRequestsExceededException: <p>The number of active requests with <code>WaitTimeSeconds</code> for the same SQL statement exceeds the limit.</p>
        capo_redshift_data.errors.internal_server_exception.InternalServerException: <p>The Amazon Redshift Data API operation failed due to invalid input. </p>
        capo_redshift_data.errors.resource_not_found_exception.ResourceNotFoundException: <p>The Amazon Redshift Data API operation failed due to a missing resource. </p>
        capo_redshift_data.errors.validation_exception.ValidationException: <p>The Amazon Redshift Data API operation failed due to invalid input. </p>
        capo_redshift_data.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_redshift_data.types.get_statement_result_request.GetStatementResultRequest]",
    ) -> AsyncOperationResponse[
        "capo_redshift_data.types.get_statement_result_response.GetStatementResultResponse"
    ]:
        import capo_redshift_data._operations.redshift_data.get_statement_result

        (
            output,
            http_response,
        ) = await capo_redshift_data._operations.redshift_data.get_statement_result.async_get_statement_result(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetStatementResult")
    )
    input_: capo_redshift_data.types.get_statement_result_request.GetStatementResultRequest = {
        "id": id
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if wait_time_seconds is not None:
        input_["wait_time_seconds"] = wait_time_seconds

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output