:doc:`CloudTrail <../../cloudtrail>` / Client / cancel_query

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



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

  

  Cancels a query if the query is not in a terminated state, such as ``CANCELLED``, ``FAILED``, ``TIMED_OUT``, or ``FINISHED``. You must specify an ARN value for ``EventDataStore``. The ID of the query that you want to cancel is also required. When you run ``CancelQuery``, the query status might show as ``CANCELLED`` even if the operation is not yet finished.

  

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


  **Request Syntax**
  ::

    response = client.cancel_query(
        EventDataStore='string',
        QueryId='string',
        EventDataStoreOwnerAccountId='string'
    )
    
  :type EventDataStore: string
  :param EventDataStore: 

    The ARN (or the ID suffix of the ARN) of an event data store on which the specified query is running.

    

  
  :type QueryId: string
  :param QueryId: **[REQUIRED]** 

    The ID of the query that you want to cancel. The ``QueryId`` comes from the response of a ``StartQuery`` operation.

    

  
  :type EventDataStoreOwnerAccountId: string
  :param EventDataStoreOwnerAccountId: 

    The account ID of the event data store owner.

    

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

    
    ::

      {
          'QueryId': 'string',
          'QueryStatus': 'QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT',
          'EventDataStoreOwnerAccountId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **QueryId** *(string) --* 

        The ID of the canceled query.

        
      

      - **QueryStatus** *(string) --* 

        Shows the status of a query after a ``CancelQuery`` request. Typically, the values shown are either ``RUNNING`` or ``CANCELLED``.

        
      

      - **EventDataStoreOwnerAccountId** *(string) --* 

        The account ID of the event data store owner.

        
  
  **Exceptions**
  
  *   :py:class:`CloudTrail.Client.exceptions.EventDataStoreARNInvalidException`

  
  *   :py:class:`CloudTrail.Client.exceptions.EventDataStoreNotFoundException`

  
  *   :py:class:`CloudTrail.Client.exceptions.InactiveEventDataStoreException`

  
  *   :py:class:`CloudTrail.Client.exceptions.InactiveQueryException`

  
  *   :py:class:`CloudTrail.Client.exceptions.InvalidParameterException`

  
  *   :py:class:`CloudTrail.Client.exceptions.QueryIdNotFoundException`

  
  *   :py:class:`CloudTrail.Client.exceptions.OperationNotPermittedException`

  
  *   :py:class:`CloudTrail.Client.exceptions.UnsupportedOperationException`

  
  *   :py:class:`CloudTrail.Client.exceptions.NoManagementAccountSLRExistsException`

  
  *   :py:class:`CloudTrail.Client.exceptions.ConflictException`

  