BatchGetQueryExecutionCommand

Returns the details of a single query execution or a list of up to 50 query executions, which you provide as an array of query execution ID strings. Requires you to have access to the workgroup in which the queries ran. To get a list of query execution IDs, use ListQueryExecutionsInput$WorkGroup. Query executions differ from named (saved) queries. Use BatchGetNamedQueryInput to get details about named queries.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { AthenaClient, BatchGetQueryExecutionCommand } from "@aws-sdk/client-athena"; // ES Modules import
// const { AthenaClient, BatchGetQueryExecutionCommand } = require("@aws-sdk/client-athena"); // CommonJS import
const client = new AthenaClient(config);
const input = { // BatchGetQueryExecutionInput
  QueryExecutionIds: [ // QueryExecutionIdList // required
    "STRING_VALUE",
  ],
};
const command = new BatchGetQueryExecutionCommand(input);
const response = await client.send(command);
// { // BatchGetQueryExecutionOutput
//   QueryExecutions: [ // QueryExecutionList
//     { // QueryExecution
//       QueryExecutionId: "STRING_VALUE",
//       Query: "STRING_VALUE",
//       StatementType: "DDL" || "DML" || "UTILITY",
//       ResultConfiguration: { // ResultConfiguration
//         OutputLocation: "STRING_VALUE",
//         EncryptionConfiguration: { // EncryptionConfiguration
//           EncryptionOption: "SSE_S3" || "SSE_KMS" || "CSE_KMS", // required
//           KmsKey: "STRING_VALUE",
//         },
//         ExpectedBucketOwner: "STRING_VALUE",
//         AclConfiguration: { // AclConfiguration
//           S3AclOption: "BUCKET_OWNER_FULL_CONTROL", // required
//         },
//       },
//       ResultReuseConfiguration: { // ResultReuseConfiguration
//         ResultReuseByAgeConfiguration: { // ResultReuseByAgeConfiguration
//           Enabled: true || false, // required
//           MaxAgeInMinutes: Number("int"),
//         },
//       },
//       QueryExecutionContext: { // QueryExecutionContext
//         Database: "STRING_VALUE",
//         Catalog: "STRING_VALUE",
//       },
//       Status: { // QueryExecutionStatus
//         State: "QUEUED" || "RUNNING" || "SUCCEEDED" || "FAILED" || "CANCELLED",
//         StateChangeReason: "STRING_VALUE",
//         SubmissionDateTime: new Date("TIMESTAMP"),
//         CompletionDateTime: new Date("TIMESTAMP"),
//         AthenaError: { // AthenaError
//           ErrorCategory: Number("int"),
//           ErrorType: Number("int"),
//           Retryable: true || false,
//           ErrorMessage: "STRING_VALUE",
//         },
//       },
//       Statistics: { // QueryExecutionStatistics
//         EngineExecutionTimeInMillis: Number("long"),
//         DataScannedInBytes: Number("long"),
//         DataManifestLocation: "STRING_VALUE",
//         TotalExecutionTimeInMillis: Number("long"),
//         QueryQueueTimeInMillis: Number("long"),
//         ServicePreProcessingTimeInMillis: Number("long"),
//         QueryPlanningTimeInMillis: Number("long"),
//         ServiceProcessingTimeInMillis: Number("long"),
//         ResultReuseInformation: { // ResultReuseInformation
//           ReusedPreviousResult: true || false, // required
//         },
//       },
//       WorkGroup: "STRING_VALUE",
//       EngineVersion: { // EngineVersion
//         SelectedEngineVersion: "STRING_VALUE",
//         EffectiveEngineVersion: "STRING_VALUE",
//       },
//       ExecutionParameters: [ // ExecutionParameters
//         "STRING_VALUE",
//       ],
//       SubstatementType: "STRING_VALUE",
//       QueryResultsS3AccessGrantsConfiguration: { // QueryResultsS3AccessGrantsConfiguration
//         EnableS3AccessGrants: true || false, // required
//         CreateUserLevelPrefix: true || false,
//         AuthenticationType: "DIRECTORY_IDENTITY", // required
//       },
//     },
//   ],
//   UnprocessedQueryExecutionIds: [ // UnprocessedQueryExecutionIdList
//     { // UnprocessedQueryExecutionId
//       QueryExecutionId: "STRING_VALUE",
//       ErrorCode: "STRING_VALUE",
//       ErrorMessage: "STRING_VALUE",
//     },
//   ],
// };

BatchGetQueryExecutionCommand Input

Parameter
Type
Description
QueryExecutionIds
Required
string[] | undefined

An array of query execution IDs.

BatchGetQueryExecutionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
QueryExecutions
QueryExecution[] | undefined

Information about a query execution.

UnprocessedQueryExecutionIds
UnprocessedQueryExecutionId[] | undefined

Information about the query executions that failed to run.

Throws

Name
Fault
Details
InternalServerException
server

Indicates a platform issue, which may be due to a transient condition or outage.

InvalidRequestException
client

Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.

AthenaServiceException
Base exception class for all service exceptions from Athena service.