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.
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/redshift_data.py
| def get_statement_result_v2(
self,
id: "capo_redshift_data.types.uuid.UUID",
*,
config_overrides: Optional[RedshiftDataClientConfig] = 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_v2_response.GetStatementResultV2Response":
"""<p>Fetches the temporarily cached result of an SQL statement in CSV format. The <code>ExecuteStatement</code> or <code>BatchExecuteStatement</code> operation that ran the SQL statement must have specified <code>ResultFormat</code> as <code>CSV</code>. 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.
"""
def _handler(
req: "OperationRequest[capo_redshift_data.types.get_statement_result_v2_request.GetStatementResultV2Request]",
) -> OperationResponse[
"capo_redshift_data.types.get_statement_result_v2_response.GetStatementResultV2Response"
]:
import capo_redshift_data._operations.redshift_data.get_statement_result_v2
output, http_response = (
capo_redshift_data._operations.redshift_data.get_statement_result_v2.get_statement_result_v2(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetStatementResultV2")
)
input_: capo_redshift_data.types.get_statement_result_v2_request.GetStatementResultV2Request = {
"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 = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|