Skip to content

start_calculation_execution async

start_calculation_execution(
    session_id: SessionId,
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    description: Optional[DescriptionString] = None,
    calculation_configuration: Optional[CalculationConfiguration] = None,
    code_block: Optional[CodeBlock] = None,
    client_request_token: Optional[IdempotencyToken] = None,
) -> StartCalculationExecutionResponse

Submits calculations for execution within a session. You can supply the code to run as an inline code block within the request.

The request syntax requires the StartCalculationExecutionRequest$CodeBlock parameter or the CalculationConfiguration$CodeBlock parameter, but not both. Because CalculationConfiguration$CodeBlock is deprecated, use the StartCalculationExecutionRequest$CodeBlock parameter instead.

Parameters:

  • session_id (SessionId) –

    The session ID.

  • description (Optional[DescriptionString], default: None ) –

    A description of the calculation.

  • calculation_configuration (Optional[CalculationConfiguration], default: None ) –

    Contains configuration information for the calculation.

  • code_block (Optional[CodeBlock], default: None ) –

    A string that contains the code of the calculation. Use this parameter instead of CalculationConfiguration$CodeBlock, which is deprecated.

  • client_request_token (Optional[IdempotencyToken], default: None ) –

    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.

    This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.

Raises:

Source code in docs_src/capo_athena/_services/async_athena.py
async def start_calculation_execution(
    self,
    session_id: "capo_athena.types.session_id.SessionId",
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    description: Optional[
        "capo_athena.types.description_string.DescriptionString"
    ] = None,
    calculation_configuration: Optional[
        "capo_athena.types.calculation_configuration.CalculationConfiguration"
    ] = None,
    code_block: Optional["capo_athena.types.code_block.CodeBlock"] = None,
    client_request_token: Optional[
        "capo_athena.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_athena.types.start_calculation_execution_response.StartCalculationExecutionResponse":
    """<p>Submits calculations for execution within a session. You can supply the code to run as an inline code block within the request.</p> <note> <p>The request syntax requires the <a>StartCalculationExecutionRequest$CodeBlock</a> parameter or the <a>CalculationConfiguration$CodeBlock</a> parameter, but not both. Because <a>CalculationConfiguration$CodeBlock</a> is deprecated, use the <a>StartCalculationExecutionRequest$CodeBlock</a> parameter instead.</p> </note>

    Args:
        session_id: <p>The session ID.</p>
        description: <p>A description of the calculation.</p>
        calculation_configuration: <p>Contains configuration information for the calculation.</p>
        code_block: <p>A string that contains the code of the calculation. Use this parameter instead of <a>CalculationConfiguration$CodeBlock</a>, which is deprecated.</p>
        client_request_token: <p>A unique case-sensitive string used to ensure the request to create the calculation is idempotent (executes only once). If another <code>StartCalculationExecutionRequest</code> is received, the same response is returned and another calculation is not created. If a parameter has changed, an error is returned.</p> <important> <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p> </important>

    Raises:
        capo_athena.errors.internal_server_exception.InternalServerException: <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
        capo_athena.errors.invalid_request_exception.InvalidRequestException: <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
        capo_athena.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource, such as a workgroup, was not found.</p>
        capo_athena.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_athena.types.start_calculation_execution_request.StartCalculationExecutionRequest]",
    ) -> AsyncOperationResponse[
        "capo_athena.types.start_calculation_execution_response.StartCalculationExecutionResponse"
    ]:
        import capo_athena._operations.amazon_athena.start_calculation_execution

        (
            output,
            http_response,
        ) = await capo_athena._operations.amazon_athena.start_calculation_execution.async_start_calculation_execution(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartCalculationExecution")
    )
    input_: capo_athena.types.start_calculation_execution_request.StartCalculationExecutionRequest = {
        "session_id": session_id
    }
    if description is not None:
        input_["description"] = description
    if calculation_configuration is not None:
        input_["calculation_configuration"] = calculation_configuration
    if code_block is not None:
        input_["code_block"] = code_block
    if client_request_token is not None:
        input_["client_request_token"] = client_request_token

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