Skip to content

Integrations

Athena

Run SQL queries on data in Amazon S3 using AWS Athena

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 a saved AWS credential.

Use the block

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.

Actions

Athena Start Query

Start an SQL query execution in AWS Athena

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
queryStringstringYesSQL query string to execute
databasestringNoDatabase name within the catalog
catalogstringNoData catalog name (default: AwsDataCatalog)
outputLocationstringNoS3 output location for query results (e.g., s3://bucket/path/)
workGroupstringNoWorkgroup to execute the query in (default: primary)
executionParametersjsonNoValues 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
resultReuseEnabledbooleanNoReuse a previous result of the same query instead of re-scanning data (default: false)
resultReuseMaxAgeInMinutesnumberNoMaximum age in minutes of a previous result eligible for reuse (0-10080, default: 60)
encryptionOptionstringNoEncryption for the query results in S3: SSE_S3, SSE_KMS, or CSE_KMS. Overridden when the workgroup enforces its own settings
kmsKeystringNoKMS key ARN or ID used when encryptionOption is SSE_KMS or CSE_KMS
expectedBucketOwnerstringNoAWS account ID expected to own the output location bucket; the query fails if it does not
clientRequestTokenstringNoIdempotency token (32-128 characters). Repeating a request with the same token returns the original query execution instead of starting a new one

Output

ParameterTypeDescription
queryExecutionIdstringUnique ID of the started query execution

Athena Get Query Execution

Get the status and details of an Athena query execution

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
queryExecutionIdstringYesQuery execution ID to check

Output

ParameterTypeDescription
queryExecutionIdstringQuery execution ID
querystringSQL query string
statestringQuery state (QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED)
stateChangeReasonstringReason for state change (e.g., error message)
statementTypestringStatement type (DDL, DML, UTILITY)
databasestringDatabase name
catalogstringData catalog name
workGroupstringWorkgroup name
submissionDateTimenumberQuery submission time (Unix epoch ms)
completionDateTimenumberQuery completion time (Unix epoch ms)
dataScannedInBytesnumberAmount of data scanned in bytes
engineExecutionTimeInMillisnumberEngine execution time in milliseconds
queryPlanningTimeInMillisnumberQuery planning time in milliseconds
queryQueueTimeInMillisnumberTime the query spent in queue in milliseconds
totalExecutionTimeInMillisnumberTotal execution time in milliseconds
outputLocationstringS3 location of query results
servicePreProcessingTimeInMillisnumberTime Athena spent preprocessing the query before submitting it, in milliseconds
serviceProcessingTimeInMillisnumberTime Athena spent finalizing and publishing results after execution, in milliseconds
dataManifestLocationstringS3 location of the manifest file listing files written by the query
reusedPreviousResultbooleanWhether the query reused a previous result instead of scanning data
athenaErrorjsonFailure details for a FAILED query (errorCategory: 1 system, 2 user, 3 other; errorType; retryable; errorMessage)
executionParametersarrayValues supplied for the query's ? placeholders
substatementTypestringKind of query statement that was run (e.g., SELECT, INSERT, CREATE_TABLE)
engineVersionjsonEngine version used (selectedEngineVersion, effectiveEngineVersion)

Athena Get Query Results

Retrieve the results of a completed Athena query execution

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
queryExecutionIdstringYesQuery execution ID to get results for
maxResultsnumberNoMaximum number of rows to return (1-999)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
columnsarrayColumn metadata (name, type, label, precision, scale, nullable, caseSensitive)
rowsarrayResult rows as key-value objects
nextTokenstringPagination token for next page of results
updateCountnumberNumber of rows inserted or updated by a CREATE TABLE AS SELECT, INSERT INTO, or UPDATE statement

Athena Stop Query

Stop a running Athena query execution

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
queryExecutionIdstringYesQuery execution ID to stop

Output

ParameterTypeDescription
successbooleanWhether the query was successfully stopped

Athena List Query Executions

List recent Athena query execution IDs

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
workGroupstringNoWorkgroup to list executions for (default: primary)
maxResultsnumberNoMaximum number of results (0-50)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
queryExecutionIdsarrayList of query execution IDs
nextTokenstringPagination token for next page

Athena Batch Get Query Executions

Get the status and details of up to 50 Athena query executions in one call

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
queryExecutionIdsstringYesComma-separated query execution IDs to check (up to 50)

Output

ParameterTypeDescription
queryExecutionsarrayDetails for each successfully retrieved query execution
↳ queryExecutionIdstringQuery execution ID
↳ querystringSQL query string
↳ statestringQuery state (QUEUED, RUNNING, SUCCEEDED, FAILED, CANCELLED)
↳ stateChangeReasonstringReason for state change
↳ statementTypestringStatement type (DDL, DML, UTILITY)
↳ databasestringDatabase name
↳ catalogstringData catalog name
↳ workGroupstringWorkgroup name
↳ submissionDateTimenumberQuery submission time (Unix epoch ms)
↳ completionDateTimenumberQuery completion time (Unix epoch ms)
↳ dataScannedInBytesnumberAmount of data scanned in bytes
↳ engineExecutionTimeInMillisnumberEngine execution time in milliseconds
↳ queryPlanningTimeInMillisnumberQuery planning time in milliseconds
↳ queryQueueTimeInMillisnumberTime the query spent in queue in milliseconds
↳ totalExecutionTimeInMillisnumberTotal execution time in milliseconds
↳ outputLocationstringS3 location of query results
↳ servicePreProcessingTimeInMillisnumberTime Athena spent preprocessing the query before submitting it, in milliseconds
↳ serviceProcessingTimeInMillisnumberTime Athena spent finalizing and publishing results after execution, in milliseconds
↳ dataManifestLocationstringS3 location of the manifest file listing files written by the query
↳ reusedPreviousResultbooleanWhether the query reused a previous result instead of scanning data
↳ athenaErrorjsonFailure details for a FAILED query (errorCategory: 1 system, 2 user, 3 other; errorType; retryable; errorMessage)
↳ executionParametersarrayValues supplied for the query's ? placeholders
↳ substatementTypestringKind of query statement that was run (e.g., SELECT, INSERT, CREATE_TABLE)
↳ engineVersionjsonEngine version used (selectedEngineVersion, effectiveEngineVersion)
unprocessedQueryExecutionIdsarrayQuery execution IDs that could not be retrieved, with error details
↳ queryExecutionIdstringQuery execution ID
↳ errorCodestringError code
↳ errorMessagestringError message

Athena Create Named Query

Create a saved/named query in AWS Athena

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
namestringYesName for the saved query
databasestringYesDatabase the query runs against
queryStringstringYesSQL query string to save
descriptionstringNoDescription of the named query
workGroupstringNoWorkgroup to create the named query in

Output

ParameterTypeDescription
namedQueryIdstringID of the created named query

Athena Get Named Query

Get details of a saved/named query in AWS Athena

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
namedQueryIdstringYesNamed query ID to retrieve

Output

ParameterTypeDescription
namedQueryIdstringNamed query ID
namestringName of the saved query
descriptionstringQuery description
databasestringDatabase the query runs against
queryStringstringSQL query string
workGroupstringWorkgroup name

Athena List Named Queries

List saved/named query IDs in AWS Athena

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
workGroupstringNoWorkgroup to list named queries for
maxResultsnumberNoMaximum number of results (0-50)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
namedQueryIdsarrayList of named query IDs
nextTokenstringPagination token for next page

Athena Delete Named Query

Delete a saved/named query in AWS Athena

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
namedQueryIdstringYesNamed query ID to delete

Output

ParameterTypeDescription
successbooleanWhether the named query was successfully deleted

Athena List Databases

List the databases available in an Athena data catalog

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
catalogNamestringYesData catalog name to list databases from (e.g., AwsDataCatalog)
workGroupstringNoWorkgroup for which the metadata is being fetched (required for IAM Identity Center enabled catalogs)
maxResultsnumberNoMaximum number of results (1-50)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
databasesarrayList of databases (name, description, parameters)
↳ namestringDatabase name
↳ descriptionstringDatabase description
↳ parametersjsonKey/value properties set on the database
nextTokenstringPagination token for next page

Athena List Table Metadata

List tables and their column/partition metadata for an Athena database

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
catalogNamestringYesData catalog name (e.g., AwsDataCatalog)
databaseNamestringYesDatabase name to list tables from
expressionstringNoRegex filter that pattern-matches table names
workGroupstringNoWorkgroup for which the metadata is being fetched (required for IAM Identity Center enabled catalogs)
maxResultsnumberNoMaximum number of results (1-50)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
tablesarrayTable metadata (name, type, columns, partition keys, parameters)
↳ namestringTable name
↳ tableTypestringTable type
↳ createTimenumberTable creation time (Unix epoch ms)
↳ lastAccessTimenumberTable last access time (Unix epoch ms)
↳ columnsarrayColumn definitions
↳ namestringColumn name
↳ typestringColumn data type
↳ commentstringColumn comment
↳ partitionKeysarrayPartition key definitions
↳ namestringPartition key name
↳ typestringPartition key data type
↳ commentstringPartition key comment
↳ parametersjsonKey/value table properties (e.g., classification, location)
nextTokenstringPagination token for next page

Athena Get Query Runtime Statistics

Get runtime statistics (timeline, row counts, and output stage) for a completed Athena query execution

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
queryExecutionIdstringYesQuery execution ID to get runtime statistics for

Output

ParameterTypeDescription
queryExecutionIdstringQuery execution ID
timelinejsonTiming breakdown in milliseconds (available once the query has SUCCEEDED or FAILED)
↳ queryQueueTimeInMillisnumberTime spent in queue
↳ servicePreProcessingTimeInMillisnumberService pre-processing time
↳ queryPlanningTimeInMillisnumberQuery planning time
↳ engineExecutionTimeInMillisnumberEngine execution time
↳ serviceProcessingTimeInMillisnumberService processing time
↳ totalExecutionTimeInMillisnumberTotal execution time
rowStatisticsjsonRow and byte counts (updated asynchronously; may be null shortly after completion)
↳ inputRowsnumberRows read
↳ inputBytesnumberBytes read
↳ outputRowsnumberRows produced
↳ outputBytesnumberBytes produced
outputStagejsonSummary of the final query stage
↳ stageIdnumberStage identifier
↳ statestringStage state
↳ inputRowsnumberRows read by the stage
↳ inputBytesnumberBytes read by the stage
↳ outputRowsnumberRows produced by the stage
↳ outputBytesnumberBytes produced by the stage
↳ executionTimenumberStage execution time in milliseconds
↳ subStageCountnumberNumber of direct sub-stages

Athena Batch Get Named Queries

Get the details of up to 50 Athena named queries by ID in a single call

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
namedQueryIdsstringYesComma-separated named query IDs (up to 50)

Output

ParameterTypeDescription
namedQueriesarrayDetails for each named query that was found
↳ namedQueryIdstringNamed query ID
↳ namestringNamed query name
↳ descriptionstringNamed query description
↳ databasestringDatabase the query runs against
↳ queryStringstringSQL text of the named query
↳ workGroupstringWorkgroup the query is saved in
unprocessedNamedQueryIdsarrayNamed query IDs that could not be retrieved, with error details
↳ namedQueryIdstringNamed query ID
↳ errorCodestringError code
↳ errorMessagestringError message

Athena Update Named Query

Update the name, description, or SQL of an existing Athena named query (database and workgroup cannot change)

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
namedQueryIdstringYesNamed query ID to update
namestringYesNew name for the query (1-128 characters)
queryStringstringYesNew SQL query text
descriptionstringNoNew description; omit to keep the current one, or pass an empty string to clear it

Output

ParameterTypeDescription
successbooleanWhether the operation succeeded

Athena Create Prepared Statement

Create a parameterized prepared statement in an Athena workgroup for use with EXECUTE or execution parameters

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
statementNamestringYesPrepared statement name (letters, digits, _ @ : ; must start with a letter or underscore)
workGroupstringYesWorkgroup the prepared statement belongs to
queryStatementstringYesSQL statement with ? placeholders for parameters
descriptionstringNoDescription of the prepared statement

Output

ParameterTypeDescription
successbooleanWhether the operation succeeded

Athena Get Prepared Statement

Get the SQL and metadata of a prepared statement in an Athena workgroup

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
statementNamestringYesPrepared statement name (letters, digits, _ @ : ; must start with a letter or underscore)
workGroupstringYesWorkgroup the prepared statement belongs to

Output

ParameterTypeDescription
statementNamestringPrepared statement name
queryStatementstringSQL text of the prepared statement
workGroupNamestringWorkgroup the statement belongs to
descriptionstringPrepared statement description
lastModifiedTimenumberLast modified time (Unix epoch ms)

Athena Batch Get Prepared Statements

Get the details of up to 256 prepared statements in an Athena workgroup by name in a single call

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
preparedStatementNamesstringYesComma-separated prepared statement names (up to 256)
workGroupstringYesWorkgroup the prepared statement belongs to

Output

ParameterTypeDescription
preparedStatementsarrayDetails for each prepared statement that was found
↳ statementNamestringPrepared statement name
↳ queryStatementstringSQL text of the prepared statement
↳ workGroupNamestringWorkgroup the statement belongs to
↳ descriptionstringPrepared statement description
↳ lastModifiedTimenumberLast modified time (Unix epoch ms)
unprocessedPreparedStatementNamesarrayStatement names that could not be retrieved, with error details
↳ statementNamestringPrepared statement name
↳ errorCodestringError code
↳ errorMessagestringError message

Athena Update Prepared Statement

Replace the SQL and description of an existing prepared statement in an Athena workgroup

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
statementNamestringYesPrepared statement name (letters, digits, _ @ : ; must start with a letter or underscore)
workGroupstringYesWorkgroup the prepared statement belongs to
queryStatementstringYesNew SQL statement with ? placeholders for parameters
descriptionstringNoNew description of the prepared statement

Output

ParameterTypeDescription
successbooleanWhether the operation succeeded

Athena List Prepared Statements

List the prepared statements saved in an Athena workgroup

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
workGroupstringYesWorkgroup to list prepared statements for
maxResultsnumberNoMaximum number of results (1-50)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
preparedStatementsarrayPrepared statement summaries
↳ statementNamestringPrepared statement name
↳ lastModifiedTimenumberLast modified time (Unix epoch ms)
nextTokenstringPagination token for next page

Athena Delete Prepared Statement

Delete a prepared statement from an Athena workgroup

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
statementNamestringYesPrepared statement name (letters, digits, _ @ : ; must start with a letter or underscore)
workGroupstringYesWorkgroup the prepared statement belongs to

Output

ParameterTypeDescription
successbooleanWhether the operation succeeded

Athena List Data Catalogs

List the data catalogs (data sources) registered in the AWS account

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
workGroupstringNoWorkgroup name (required for IAM Identity Center requests)
maxResultsnumberNoMaximum number of results (2-50)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
dataCatalogsarrayData catalog summaries
↳ catalogNamestringCatalog name
↳ typestringCatalog type (LAMBDA, GLUE, HIVE, FEDERATED)
↳ statusstringCreation or deletion status (e.g., CREATE_COMPLETE)
↳ connectionTypestringConnector type for FEDERATED catalogs (e.g., MYSQL, REDSHIFT)
↳ errorstringError text from catalog creation or deletion
nextTokenstringPagination token for next page

Athena Get Data Catalog

Get the type, status, and connection parameters of an Athena data catalog

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
namestringYesData catalog name (e.g., AwsDataCatalog)
workGroupstringNoWorkgroup name (required for IAM Identity Center requests)

Output

ParameterTypeDescription
namestringCatalog name
typestringCatalog type (LAMBDA, GLUE, HIVE, FEDERATED)
descriptionstringCatalog description
statusstringCreation or deletion status (e.g., CREATE_COMPLETE)
connectionTypestringConnector type for FEDERATED catalogs (e.g., MYSQL, REDSHIFT)
errorstringError text from catalog creation or deletion
parametersjsonCatalog connection parameters (e.g., catalog-id, function ARN)

Athena Get Database

Get a single database (name, description, and parameters) from an Athena data catalog

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
catalogNamestringYesData catalog name (e.g., AwsDataCatalog)
databaseNamestringYesDatabase name
workGroupstringNoWorkgroup name (required for IAM Identity Center enabled catalogs)

Output

ParameterTypeDescription
namestringDatabase name
descriptionstringDatabase description
parametersjsonKey/value properties set on the database

Athena Get Table Metadata

Get the columns, partition keys, and properties of a single table in an Athena data catalog database

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
catalogNamestringYesData catalog name (e.g., AwsDataCatalog)
databaseNamestringYesDatabase name
tableNamestringYesTable name
workGroupstringNoWorkgroup name (required for IAM Identity Center enabled catalogs)

Output

ParameterTypeDescription
namestringTable name
tableTypestringTable type (e.g., EXTERNAL_TABLE, VIRTUAL_VIEW)
createTimenumberTable creation time (Unix epoch ms)
lastAccessTimenumberLast access time (Unix epoch ms)
columnsarrayTable columns
↳ namestringColumn name
↳ typestringColumn data type
↳ commentstringColumn comment
partitionKeysarrayPartition key columns
↳ namestringColumn name
↳ typestringColumn data type
↳ commentstringColumn comment
parametersjsonKey/value table properties (e.g., classification, location)

Athena List Workgroups

List the Athena workgroups available in the AWS account

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
maxResultsnumberNoMaximum number of results (1-50)
nextTokenstringNoPagination token from a previous request

Output

ParameterTypeDescription
workGroupsarrayWorkgroup summaries
↳ namestringWorkgroup name
↳ statestringWorkgroup state (ENABLED, DISABLED)
↳ descriptionstringWorkgroup description
↳ creationTimenumberCreation time (Unix epoch ms)
↳ engineVersionjsonEngine version setting (selected and effective versions)
↳ selectedEngineVersionstringRequested engine version
↳ effectiveEngineVersionstringEngine version Athena actually uses
↳ identityCenterApplicationArnstringIAM Identity Center application ARN
nextTokenstringPagination token for next page

Athena Get Workgroup

Get the configuration of an Athena workgroup, including its result location, encryption, and limits

Inputs and outputs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
workGroupstringYesWorkgroup name

Output

ParameterTypeDescription
namestringWorkgroup name
statestringWorkgroup state (ENABLED, DISABLED)
descriptionstringWorkgroup description
creationTimenumberCreation time (Unix epoch ms)
identityCenterApplicationArnstringIAM Identity Center application ARN
engineVersionjsonEngine version setting (selected and effective versions)
↳ selectedEngineVersionstringRequested engine version
↳ effectiveEngineVersionstringEngine version Athena actually uses
outputLocationstringS3 location where query results are written
encryptionOptionstringResult encryption option (SSE_S3, SSE_KMS, CSE_KMS)
kmsKeystringKMS key ARN or ID used for result encryption
expectedBucketOwnerstringExpected AWS account ID of the results bucket owner
managedQueryResultsEnabledbooleanWhether results are stored in Athena-owned storage
enforceWorkGroupConfigurationbooleanWhether workgroup settings override client-side settings
publishCloudWatchMetricsEnabledbooleanWhether CloudWatch metrics are published for the workgroup
bytesScannedCutoffPerQuerynumberPer-query data scan limit in bytes
requesterPaysEnabledbooleanWhether Requester Pays S3 buckets may be queried
enableMinimumEncryptionConfigurationbooleanWhether a minimum encryption level is enforced
executionRolestringExecution role ARN for Spark or IAM Identity Center workgroups
Was this helpful?
Suggest an edit