startCalculationExecution method
Submits calculations for execution within a session. You can supply the code to run as an inline code block within the request.
May throw InternalServerException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
Parameter sessionId :
The session ID.
Parameter calculationConfiguration :
Contains configuration information for the calculation.
Parameter clientRequestToken :
A unique case-sensitive string used to ensure the request to create the
calculation is idempotent (executes only once). If another
StartCalculationExecutionRequest is received, the same
response is returned and another calculation is not created. If a
parameter has changed, an error is returned.
Parameter codeBlock :
A string that contains the code of the calculation. Use this parameter
instead of CalculationConfiguration$CodeBlock, which is deprecated.
Parameter description :
A description of the calculation.
Implementation
Future<StartCalculationExecutionResponse> startCalculationExecution({
required String sessionId,
CalculationConfiguration? calculationConfiguration,
String? clientRequestToken,
String? codeBlock,
String? description,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonAthena.StartCalculationExecution'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'SessionId': sessionId,
if (calculationConfiguration != null)
'CalculationConfiguration': calculationConfiguration,
if (clientRequestToken != null)
'ClientRequestToken': clientRequestToken,
if (codeBlock != null) 'CodeBlock': codeBlock,
if (description != null) 'Description': description,
},
);
return StartCalculationExecutionResponse.fromJson(jsonResponse.body);
}