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

*****************
get_query_results
*****************



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

  

  Gets event data results of a query. You must specify the ``QueryID`` value returned by the ``StartQuery`` operation.

  

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


  **Request Syntax**
  ::

    response = client.get_query_results(
        EventDataStore='string',
        QueryId='string',
        NextToken='string',
        MaxQueryResults=123,
        EventDataStoreOwnerAccountId='string'
    )
    
  :type EventDataStore: string
  :param EventDataStore: 

    The ARN (or ID suffix of the ARN) of the event data store against which the query was run.

    

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

    The ID of the query for which you want to get results.

    

  
  :type NextToken: string
  :param NextToken: 

    A token you can use to get the next page of query results.

    

  
  :type MaxQueryResults: integer
  :param MaxQueryResults: 

    The maximum number of query results to display on a single page.

    

  
  :type EventDataStoreOwnerAccountId: string
  :param EventDataStoreOwnerAccountId: 

    The account ID of the event data store owner.

    

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

    
    ::

      {
          'QueryStatus': 'QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT',
          'QueryStatistics': {
              'ResultsCount': 123,
              'TotalResultsCount': 123,
              'BytesScanned': 123
          },
          'QueryResultRows': [
              [
                  {
                      'string': 'string'
                  },
              ],
          ],
          'NextToken': 'string',
          'ErrorMessage': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

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

        The status of the query. Values include ``QUEUED``, ``RUNNING``, ``FINISHED``, ``FAILED``, ``TIMED_OUT``, or ``CANCELLED``.

        
      

      - **QueryStatistics** *(dict) --* 

        Shows the count of query results.

        
        

        - **ResultsCount** *(integer) --* 

          The number of results returned.

          
        

        - **TotalResultsCount** *(integer) --* 

          The total number of results returned by a query.

          
        

        - **BytesScanned** *(integer) --* 

          The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running.

          
    
      

      - **QueryResultRows** *(list) --* 

        Contains the individual event results of the query.

        
        

        - *(list) --* 
          

          - *(dict) --* 
            

            - *(string) --* 
              

              - *(string) --* 
        
      
      
    
      

      - **NextToken** *(string) --* 

        A token you can use to get the next page of query results.

        
      

      - **ErrorMessage** *(string) --* 

        The error message returned if a query failed.

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

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

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

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

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

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

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

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

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

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

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

  