Amazon Athena queries data in Amazon S3 with SQL. Start a query, check its execution status, then retrieve the results; cancel a query when needed. Run parameterized queries with execution parameters and prepared statements, reuse recent results, and read runtime statistics after a query completes. The integration also manages named queries, browses data catalogs, databases, and table schemas, and inspects workgroup configuration. Connect with an AWS access key and secret access key.
Execute SQL queries against data in S3, check query status and runtime statistics, retrieve results, manage named queries and prepared statements, and inspect data catalogs, databases, tables, and workgroups. Requires AWS access key and secret access key.
Start an SQL query execution in AWS Athena
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryStringstring Yes SQL query string to execute databasestring No Database name within the catalog catalogstring No Data catalog name (default: AwsDataCatalog) outputLocationstring No S3 output location for query results (e.g., s3://bucket/path/) workGroupstring No Workgroup to execute the query in (default: primary) executionParametersjson No Values for ? placeholders in a parameterized query or EXECUTE statement, applied in order. Pass a JSON array of strings (e.g. ["2024-01-01", "US"]); a plain comma-separated list is also accepted when no value contains a comma resultReuseEnabledboolean No Reuse a previous result of the same query instead of re-scanning data (default: false) resultReuseMaxAgeInMinutesnumber No Maximum age in minutes of a previous result eligible for reuse (0-10080, default: 60)
Parameter Type Description queryExecutionIdstring Unique ID of the started query execution
Get the status and details of an Athena query execution
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryExecutionIdstring Yes Query execution ID to check
Parameter Type Description queryExecutionIdstring Query execution ID querystring SQL query string statestring Query state (QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED) stateChangeReasonstring Reason for state change (e.g., error message) statementTypestring Statement type (DDL, DML, UTILITY) databasestring Database name catalogstring Data catalog name workGroupstring Workgroup name submissionDateTimenumber Query submission time (Unix epoch ms) completionDateTimenumber Query completion time (Unix epoch ms) dataScannedInBytesnumber Amount of data scanned in bytes engineExecutionTimeInMillisnumber Engine execution time in milliseconds queryPlanningTimeInMillisnumber Query planning time in milliseconds queryQueueTimeInMillisnumber Time the query spent in queue in milliseconds totalExecutionTimeInMillisnumber Total execution time in milliseconds outputLocationstring S3 location of query results
Retrieve the results of a completed Athena query execution
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryExecutionIdstring Yes Query execution ID to get results for maxResultsnumber No Maximum number of rows to return (1-999) nextTokenstring No Pagination token from a previous request
Parameter Type Description columnsarray Column metadata (name and type) rowsarray Result rows as key-value objects nextTokenstring Pagination token for next page of results updateCountnumber Number of rows affected (for INSERT/UPDATE statements)
Stop a running Athena query execution
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryExecutionIdstring Yes Query execution ID to stop
Parameter Type Description successboolean Whether the query was successfully stopped
List recent Athena query execution IDs
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key workGroupstring No Workgroup to list executions for (default: primary) maxResultsnumber No Maximum number of results (0-50) nextTokenstring No Pagination token from a previous request
Parameter Type Description queryExecutionIdsarray List of query execution IDs nextTokenstring Pagination token for next page
Get the status and details of up to 50 Athena query executions in one call
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryExecutionIdsstring Yes Comma-separated query execution IDs to check (up to 50)
Parameter Type Description queryExecutionsarray Details for each successfully retrieved query execution ↳ queryExecutionId string Query execution ID ↳ query string SQL query string ↳ state string Query state (QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED) ↳ stateChangeReason string Reason for state change ↳ statementType string Statement type (DDL, DML, UTILITY) ↳ database string Database name ↳ catalog string Data catalog name ↳ workGroup string Workgroup name ↳ submissionDateTime number Query submission time (Unix epoch ms) ↳ completionDateTime number Query completion time (Unix epoch ms) ↳ dataScannedInBytes number Amount of data scanned in bytes ↳ engineExecutionTimeInMillis number Engine execution time in milliseconds ↳ queryPlanningTimeInMillis number Query planning time in milliseconds ↳ queryQueueTimeInMillis number Time the query spent in queue in milliseconds ↳ totalExecutionTimeInMillis number Total execution time in milliseconds ↳ outputLocation string S3 location of query results unprocessedQueryExecutionIdsarray Query execution IDs that could not be retrieved, with error details ↳ queryExecutionId string Query execution ID ↳ errorCode string Error code ↳ errorMessage string Error message
Create a saved/named query in AWS Athena
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namestring Yes Name for the saved query databasestring Yes Database the query runs against queryStringstring Yes SQL query string to save descriptionstring No Description of the named query workGroupstring No Workgroup to create the named query in
Parameter Type Description namedQueryIdstring ID of the created named query
Get details of a saved/named query in AWS Athena
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namedQueryIdstring Yes Named query ID to retrieve
Parameter Type Description namedQueryIdstring Named query ID namestring Name of the saved query descriptionstring Query description databasestring Database the query runs against queryStringstring SQL query string workGroupstring Workgroup name
List saved/named query IDs in AWS Athena
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key workGroupstring No Workgroup to list named queries for maxResultsnumber No Maximum number of results (0-50) nextTokenstring No Pagination token from a previous request
Parameter Type Description namedQueryIdsarray List of named query IDs nextTokenstring Pagination token for next page
Delete a saved/named query in AWS Athena
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namedQueryIdstring Yes Named query ID to delete
Parameter Type Description successboolean Whether the named query was successfully deleted
List the databases available in an Athena data catalog
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key catalogNamestring Yes Data catalog name to list databases from (e.g., AwsDataCatalog) workGroupstring No Workgroup for which the metadata is being fetched (required for IAM Identity Center enabled catalogs) maxResultsnumber No Maximum number of results (1-50) nextTokenstring No Pagination token from a previous request
Parameter Type Description databasesarray List of databases (name, description, parameters) ↳ name string Database name ↳ description string Database description ↳ parameters json Key/value properties set on the database nextTokenstring Pagination token for next page
List tables and their column/partition metadata for an Athena database
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key catalogNamestring Yes Data catalog name (e.g., AwsDataCatalog) databaseNamestring Yes Database name to list tables from expressionstring No Regex filter that pattern-matches table names workGroupstring No Workgroup for which the metadata is being fetched (required for IAM Identity Center enabled catalogs) maxResultsnumber No Maximum number of results (1-50) nextTokenstring No Pagination token from a previous request
Parameter Type Description tablesarray Table metadata (name, type, columns, partition keys, parameters) ↳ name string Table name ↳ tableType string Table type ↳ createTime number Table creation time (Unix epoch ms) ↳ lastAccessTime number Table last access time (Unix epoch ms) ↳ columns array Column definitions ↳ name string Column name ↳ type string Column data type ↳ comment string Column comment ↳ partitionKeys array Partition key definitions ↳ name string Partition key name ↳ type string Partition key data type ↳ comment string Partition key comment ↳ parameters json Key/value table properties (e.g., classification, location) nextTokenstring Pagination token for next page
Get runtime statistics (timeline, row counts, and output stage) for a completed Athena query execution
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key queryExecutionIdstring Yes Query execution ID to get runtime statistics for
Parameter Type Description queryExecutionIdstring Query execution ID timelinejson Timing breakdown in milliseconds (available once the query has SUCCEEDED or FAILED) ↳ queryQueueTimeInMillis number Time spent in queue ↳ servicePreProcessingTimeInMillis number Service pre-processing time ↳ queryPlanningTimeInMillis number Query planning time ↳ engineExecutionTimeInMillis number Engine execution time ↳ serviceProcessingTimeInMillis number Service processing time ↳ totalExecutionTimeInMillis number Total execution time rowStatisticsjson Row and byte counts (updated asynchronously; may be null shortly after completion) ↳ inputRows number Rows read ↳ inputBytes number Bytes read ↳ outputRows number Rows produced ↳ outputBytes number Bytes produced outputStagejson Summary of the final query stage ↳ stageId number Stage identifier ↳ state string Stage state ↳ inputRows number Rows read by the stage ↳ inputBytes number Bytes read by the stage ↳ outputRows number Rows produced by the stage ↳ outputBytes number Bytes produced by the stage ↳ executionTime number Stage execution time in milliseconds ↳ subStageCount number Number of direct sub-stages
Get the details of up to 50 Athena named queries by ID in a single call
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namedQueryIdsstring Yes Comma-separated named query IDs (up to 50)
Parameter Type Description namedQueriesarray Details for each named query that was found ↳ namedQueryId string Named query ID ↳ name string Named query name ↳ description string Named query description ↳ database string Database the query runs against ↳ queryString string SQL text of the named query ↳ workGroup string Workgroup the query is saved in unprocessedNamedQueryIdsarray Named query IDs that could not be retrieved, with error details ↳ namedQueryId string Named query ID ↳ errorCode string Error code ↳ errorMessage string Error message
Update the name, description, or SQL of an existing Athena named query (database and workgroup cannot change)
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namedQueryIdstring Yes Named query ID to update namestring Yes New name for the query (1-128 characters) queryStringstring Yes New SQL query text descriptionstring No New description; omit to keep the current one, or pass an empty string to clear it
Parameter Type Description successboolean Whether the operation succeeded
Create a parameterized prepared statement in an Athena workgroup for use with EXECUTE or execution parameters
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key statementNamestring Yes Prepared statement name (letters, digits, _ @ : ; must start with a letter or underscore) workGroupstring Yes Workgroup the prepared statement belongs to queryStatementstring Yes SQL statement with ? placeholders for parameters descriptionstring No Description of the prepared statement
Parameter Type Description successboolean Whether the operation succeeded
Get the SQL and metadata of a prepared statement in an Athena workgroup
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key statementNamestring Yes Prepared statement name (letters, digits, _ @ : ; must start with a letter or underscore) workGroupstring Yes Workgroup the prepared statement belongs to
Parameter Type Description statementNamestring Prepared statement name queryStatementstring SQL text of the prepared statement workGroupNamestring Workgroup the statement belongs to descriptionstring Prepared statement description lastModifiedTimenumber Last modified time (Unix epoch ms)
Get the details of up to 256 prepared statements in an Athena workgroup by name in a single call
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key preparedStatementNamesstring Yes Comma-separated prepared statement names (up to 256) workGroupstring Yes Workgroup the prepared statement belongs to
Parameter Type Description preparedStatementsarray Details for each prepared statement that was found ↳ statementName string Prepared statement name ↳ queryStatement string SQL text of the prepared statement ↳ workGroupName string Workgroup the statement belongs to ↳ description string Prepared statement description ↳ lastModifiedTime number Last modified time (Unix epoch ms) unprocessedPreparedStatementNamesarray Statement names that could not be retrieved, with error details ↳ statementName string Prepared statement name ↳ errorCode string Error code ↳ errorMessage string Error message
Replace the SQL and description of an existing prepared statement in an Athena workgroup
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key statementNamestring Yes Prepared statement name (letters, digits, _ @ : ; must start with a letter or underscore) workGroupstring Yes Workgroup the prepared statement belongs to queryStatementstring Yes New SQL statement with ? placeholders for parameters descriptionstring No New description of the prepared statement
Parameter Type Description successboolean Whether the operation succeeded
List the prepared statements saved in an Athena workgroup
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key workGroupstring Yes Workgroup to list prepared statements for maxResultsnumber No Maximum number of results (1-50) nextTokenstring No Pagination token from a previous request
Parameter Type Description preparedStatementsarray Prepared statement summaries ↳ statementName string Prepared statement name ↳ lastModifiedTime number Last modified time (Unix epoch ms) nextTokenstring Pagination token for next page
Delete a prepared statement from an Athena workgroup
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key statementNamestring Yes Prepared statement name (letters, digits, _ @ : ; must start with a letter or underscore) workGroupstring Yes Workgroup the prepared statement belongs to
Parameter Type Description successboolean Whether the operation succeeded
List the data catalogs (data sources) registered in the AWS account
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key workGroupstring No Workgroup name (required for IAM Identity Center requests) maxResultsnumber No Maximum number of results (2-50) nextTokenstring No Pagination token from a previous request
Parameter Type Description dataCatalogsarray Data catalog summaries ↳ catalogName string Catalog name ↳ type string Catalog type (LAMBDA, GLUE, HIVE, FEDERATED) ↳ status string Creation or deletion status (e.g., CREATE_COMPLETE) ↳ connectionType string Connector type for FEDERATED catalogs (e.g., MYSQL, REDSHIFT) ↳ error string Error text from catalog creation or deletion nextTokenstring Pagination token for next page
Get the type, status, and connection parameters of an Athena data catalog
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key namestring Yes Data catalog name (e.g., AwsDataCatalog) workGroupstring No Workgroup name (required for IAM Identity Center requests)
Parameter Type Description namestring Catalog name typestring Catalog type (LAMBDA, GLUE, HIVE, FEDERATED) descriptionstring Catalog description statusstring Creation or deletion status (e.g., CREATE_COMPLETE) connectionTypestring Connector type for FEDERATED catalogs (e.g., MYSQL, REDSHIFT) errorstring Error text from catalog creation or deletion parametersjson Catalog connection parameters (e.g., catalog-id, function ARN)
Get a single database (name, description, and parameters) from an Athena data catalog
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key catalogNamestring Yes Data catalog name (e.g., AwsDataCatalog) databaseNamestring Yes Database name workGroupstring No Workgroup name (required for IAM Identity Center enabled catalogs)
Parameter Type Description namestring Database name descriptionstring Database description parametersjson Key/value properties set on the database
Get the columns, partition keys, and properties of a single table in an Athena data catalog database
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key catalogNamestring Yes Data catalog name (e.g., AwsDataCatalog) databaseNamestring Yes Database name tableNamestring Yes Table name workGroupstring No Workgroup name (required for IAM Identity Center enabled catalogs)
Parameter Type Description namestring Table name tableTypestring Table type (e.g., EXTERNAL_TABLE, VIRTUAL_VIEW) createTimenumber Table creation time (Unix epoch ms) lastAccessTimenumber Last access time (Unix epoch ms) columnsarray Table columns ↳ name string Column name ↳ type string Column data type ↳ comment string Column comment partitionKeysarray Partition key columns ↳ name string Column name ↳ type string Column data type ↳ comment string Column comment parametersjson Key/value table properties (e.g., classification, location)
List the Athena workgroups available in the AWS account
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key maxResultsnumber No Maximum number of results (1-50) nextTokenstring No Pagination token from a previous request
Parameter Type Description workGroupsarray Workgroup summaries ↳ name string Workgroup name ↳ state string Workgroup state (ENABLED, DISABLED) ↳ description string Workgroup description ↳ creationTime number Creation time (Unix epoch ms) ↳ engineVersion json Engine version setting (selected and effective versions) ↳ selectedEngineVersion string Requested engine version ↳ effectiveEngineVersion string Engine version Athena actually uses ↳ identityCenterApplicationArn string IAM Identity Center application ARN nextTokenstring Pagination token for next page
Get the configuration of an Athena workgroup, including its result location, encryption, and limits
Inputs and outputsParameter Type Required Description awsRegionstring Yes AWS region (e.g., us-east-1) awsAccessKeyIdstring Yes AWS access key ID awsSecretAccessKeystring Yes AWS secret access key workGroupstring Yes Workgroup name
Parameter Type Description namestring Workgroup name statestring Workgroup state (ENABLED, DISABLED) descriptionstring Workgroup description creationTimenumber Creation time (Unix epoch ms) identityCenterApplicationArnstring IAM Identity Center application ARN engineVersionjson Engine version setting (selected and effective versions) ↳ selectedEngineVersion string Requested engine version ↳ effectiveEngineVersion string Engine version Athena actually uses outputLocationstring S3 location where query results are written encryptionOptionstring Result encryption option (SSE_S3, SSE_KMS, CSE_KMS) kmsKeystring KMS key ARN or ID used for result encryption expectedBucketOwnerstring Expected AWS account ID of the results bucket owner managedQueryResultsEnabledboolean Whether results are stored in Athena-owned storage enforceWorkGroupConfigurationboolean Whether workgroup settings override client-side settings publishCloudWatchMetricsEnabledboolean Whether CloudWatch metrics are published for the workgroup bytesScannedCutoffPerQuerynumber Per-query data scan limit in bytes requesterPaysEnabledboolean Whether Requester Pays S3 buckets may be queried enableMinimumEncryptionConfigurationboolean Whether a minimum encryption level is enforced executionRolestring Execution role ARN for Spark or IAM Identity Center workgroups