Returns metadata about a query, including query run time in milliseconds, number of events scanned and matched, and query status. You must specify an ARN for EventDataStore , and a value for QueryID .

See also: AWS API Documentation

Request Syntax

response = client.describe_query(
  • EventDataStore (string) -- The ARN (or the ID suffix of the ARN) of an event data store on which the specified query was run.
  • QueryId (string) --


    The query ID.

Return type



Response Syntax

    'QueryId': 'string',
    'QueryString': 'string',
    'QueryStatistics': {
        'EventsMatched': 123,
        'EventsScanned': 123,
        'BytesScanned': 123,
        'ExecutionTimeInMillis': 123,
        'CreationTime': datetime(2015, 1, 1)
    'ErrorMessage': 'string',
    'DeliveryS3Uri': 'string',

Response Structure

  • (dict) --

    • QueryId (string) --

      The ID of the query.

    • QueryString (string) --

      The SQL code of a query.

    • QueryStatus (string) --

      The status of a query. Values for QueryStatus include QUEUED , RUNNING , FINISHED , FAILED , TIMED_OUT , or CANCELLED

    • QueryStatistics (dict) --

      Metadata about a query, including the number of events that were matched, the total number of events scanned, the query run time in milliseconds, and the query's creation time.

      • EventsMatched (integer) --

        The number of events that matched a query.

      • EventsScanned (integer) --

        The number of events that the query scanned in the event data store.

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

      • ExecutionTimeInMillis (integer) --

        The query's run time, in milliseconds.

      • CreationTime (datetime) --

        The creation time of the query.

    • ErrorMessage (string) --

      The error message returned if a query failed.

    • DeliveryS3Uri (string) --

      The URI for the S3 bucket where CloudTrail delivered query results, if applicable.

    • DeliveryStatus (string) --

      The delivery status.


  • CloudTrail.Client.exceptions.EventDataStoreARNInvalidException
  • CloudTrail.Client.exceptions.EventDataStoreNotFoundException
  • CloudTrail.Client.exceptions.InactiveEventDataStoreException
  • CloudTrail.Client.exceptions.InvalidParameterException
  • CloudTrail.Client.exceptions.QueryIdNotFoundException
  • CloudTrail.Client.exceptions.OperationNotPermittedException
  • CloudTrail.Client.exceptions.UnsupportedOperationException
  • CloudTrail.Client.exceptions.NoManagementAccountSLRExistsException