CloudTrail / Client / get_query_results



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

See also: AWS API Documentation

Request Syntax

response = client.get_query_results(
  • EventDataStore (string) – The ARN (or ID suffix of the ARN) of the event data store against which the query was run.

  • QueryId (string) –


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

  • NextToken (string) – A token you can use to get the next page of query results.

  • MaxQueryResults (integer) – The maximum number of query results to display on a single page.

Return type:



Response Syntax

    '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.


  • CloudTrail.Client.exceptions.EventDataStoreARNInvalidException

  • CloudTrail.Client.exceptions.EventDataStoreNotFoundException

  • CloudTrail.Client.exceptions.InactiveEventDataStoreException

  • CloudTrail.Client.exceptions.InvalidMaxResultsException

  • CloudTrail.Client.exceptions.InvalidNextTokenException

  • CloudTrail.Client.exceptions.InvalidParameterException

  • CloudTrail.Client.exceptions.QueryIdNotFoundException

  • CloudTrail.Client.exceptions.InsufficientEncryptionPolicyException

  • CloudTrail.Client.exceptions.OperationNotPermittedException

  • CloudTrail.Client.exceptions.UnsupportedOperationException

  • CloudTrail.Client.exceptions.NoManagementAccountSLRExistsException