:doc:`TimestreamQuery <../../timestream-query>` / Client / cancel_query

************
cancel_query
************



.. py:method:: TimestreamQuery.Client.cancel_query(**kwargs)

  

  Cancels a query that has been issued. Cancellation is provided only if the query has not completed running before the cancellation request was issued. Because cancellation is an idempotent operation, subsequent cancellation requests will return a ``CancellationMessage``, indicating that the query has already been canceled. See `code sample <https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.cancel-query.html>`__ for details.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/timestream-query-2018-11-01/CancelQuery>`_  


  **Request Syntax**
  ::

    response = client.cancel_query(
        QueryId='string'
    )
    
  :type QueryId: string
  :param QueryId: **[REQUIRED]** 

    The ID of the query that needs to be cancelled. ``QueryID`` is returned as part of the query result.

    

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

    
    ::

      {
          'CancellationMessage': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **CancellationMessage** *(string) --* 

        A ``CancellationMessage`` is returned when a ``CancelQuery`` request for the query specified by ``QueryId`` has already been issued.

        
  
  **Exceptions**
  
  *   :py:class:`TimestreamQuery.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`TimestreamQuery.Client.exceptions.InternalServerException`

  
  *   :py:class:`TimestreamQuery.Client.exceptions.ThrottlingException`

  
  *   :py:class:`TimestreamQuery.Client.exceptions.ValidationException`

  
  *   :py:class:`TimestreamQuery.Client.exceptions.InvalidEndpointException`

  