:doc:`Athena <../../athena>` / Client / start_calculation_execution

***************************
start_calculation_execution
***************************



.. py:method:: Athena.Client.start_calculation_execution(**kwargs)

  

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

   

  .. note::

    

    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.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartCalculationExecution>`_  


  **Request Syntax**
  ::

    response = client.start_calculation_execution(
        SessionId='string',
        Description='string',
        CalculationConfiguration={
            'CodeBlock': 'string'
        },
        CodeBlock='string',
        ClientRequestToken='string'
    )
    
  :type SessionId: string
  :param SessionId: **[REQUIRED]** 

    The session ID.

    

  
  :type Description: string
  :param Description: 

    A description of the calculation.

    

  
  :type CalculationConfiguration: dict
  :param CalculationConfiguration: 

    Contains configuration information for the calculation.

    

  
    - **CodeBlock** *(string) --* 

      A string that contains the code for the calculation.

      

    
  
  :type CodeBlock: string
  :param CodeBlock: 

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

    

  
  :type ClientRequestToken: string
  :param 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.

     

    .. warning::

       

      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.

      

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'CalculationExecutionId': 'string',
          'State': 'CREATING'|'CREATED'|'QUEUED'|'RUNNING'|'CANCELING'|'CANCELED'|'COMPLETED'|'FAILED'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **CalculationExecutionId** *(string) --* 

        The calculation execution UUID.

        
      

      - **State** *(string) --* 

        ``CREATING`` - The calculation is in the process of being created.

         

        ``CREATED`` - The calculation has been created and is ready to run.

         

        ``QUEUED`` - The calculation has been queued for processing.

         

        ``RUNNING`` - The calculation is running.

         

        ``CANCELING`` - A request to cancel the calculation has been received and the system is working to stop it.

         

        ``CANCELED`` - The calculation is no longer running as the result of a cancel request.

         

        ``COMPLETED`` - The calculation has completed without error.

         

        ``FAILED`` - The calculation failed and is no longer running.

        
  
  **Exceptions**
  
  *   :py:class:`Athena.Client.exceptions.InternalServerException`

  
  *   :py:class:`Athena.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`Athena.Client.exceptions.ResourceNotFoundException`

  