New260+ blocks and 240+ tools are now fully documented
DocumentationReferenceTool IntegrationsCloud & Infrastructure
Tool

AWS Athena

Run SQL queries on data stored in Amazon S3 using AWS Athena

Execute SQL queries directly against data in Amazon S3 with AWS Athena — no servers to provision. Use it in workflows to query data lakes, retrieve results, monitor running queries, and cancel them when needed.

Overview

PropertyValue
Typeathena
CategoryTool — Database
AuthAWS Access Key ID + Secret Access Key

Operations

OperationTool IDDescription
Start Queryathena_start_querySubmit a SQL query for execution; returns the execution ID immediately (async)
Get Query Resultsathena_get_query_resultsRetrieve the result rows of a completed query execution
Get Query Executionathena_get_query_executionCheck the status and performance details of any query execution
Stop Queryathena_stop_queryCancel a running or queued query execution
List Query Executionsathena_list_query_executionsList recent query execution IDs in a workgroup

Configuration

SettingTypeRequiredDescription
awsRegionstringYesAWS region where your Athena workgroup lives (e.g., us-east-1)
awsAccessKeyIdstringYesSecret. AWS access key ID for the IAM user or role
awsSecretAccessKeystringYesSecret. AWS secret access key paired with the access key ID
queryStringstringYes (Start Query only)SQL statement to execute (e.g., SELECT * FROM logs LIMIT 100)
databasestringNoDatabase name within the catalog to run the query against
catalogstringNoData catalog name; defaults to AwsDataCatalog
outputLocationstringNoS3 URI where Athena writes result files (e.g., s3://my-bucket/query-results/)
workGroupstringNoAthena workgroup to use; defaults to primary
queryExecutionIdstringYes (Get Results / Get Execution / Stop Query)The execution ID returned by Start Query or List Query Executions
maxResultsnumberNoMaximum rows/IDs to return per page. Get Query Results: 1–999; List Query Executions: 0–50
nextTokenstringNoPagination token from a previous Get Query Results or List Query Executions response

Outputs

Start Query (athena_start_query)

FieldTypeDescription
queryExecutionIdstringUnique ID of the started query execution; pass this to subsequent operations

Get Query Results (athena_get_query_results)

FieldTypeDescription
columnsarrayColumn metadata objects (name and type)
rowsarrayResult rows as key-value objects
nextTokenstringPagination token for the next page of results (optional)
updateCountnumberNumber of rows affected for INSERT/UPDATE statements (optional)

Get Query Execution (athena_get_query_execution)

FieldTypeDescription
queryExecutionIdstringThe execution ID
querystringThe SQL statement that was submitted
statestringCurrent state: QUEUED, RUNNING, SUCCEEDED, FAILED, or CANCELLED
stateChangeReasonstringError message or reason for state transition (optional)
statementTypestringStatement category: DDL, DML, or UTILITY (optional)
databasestringDatabase the query ran against (optional)
catalogstringData catalog used (optional)
workGroupstringWorkgroup the query ran in (optional)
submissionDateTimenumberUnix epoch ms when the query was submitted (optional)
completionDateTimenumberUnix epoch ms when the query finished (optional)
dataScannedInBytesnumberBytes of S3 data scanned (optional)
engineExecutionTimeInMillisnumberTime the engine spent executing in ms (optional)
queryPlanningTimeInMillisnumberTime spent on query planning in ms (optional)
queryQueueTimeInMillisnumberTime the query waited in queue in ms (optional)
totalExecutionTimeInMillisnumberTotal wall-clock execution time in ms (optional)
outputLocationstringS3 URI of the result files (optional)

Stop Query (athena_stop_query)

FieldTypeDescription
successbooleantrue if the cancellation request was accepted

List Query Executions (athena_list_query_executions)

FieldTypeDescription
queryExecutionIdsarrayList of query execution ID strings
nextTokenstringPagination token for the next page (optional)

Example

[Starter] → [Athena: Start Query] → [Athena: Get Query Execution] → [Agent: summarize results]

Configure the Start Query block with awsAccessKeyId: {{AWS_ACCESS_KEY_ID}}, awsSecretAccessKey: {{AWS_SECRET_ACCESS_KEY}}, awsRegion: us-east-1, and a query like SELECT user_id, event, COUNT(*) as cnt FROM events.clicks WHERE dt = '{{starter.date}}' GROUP BY 1, 2. Feed the returned {{startQuery.queryExecutionId}} into Get Query Execution to poll for SUCCEEDED, then pass {{startQuery.queryExecutionId}} to Get Query Results and hand {{getQueryResults.rows}} to an Agent block to narrate the findings.

Tips

  • Athena is asynchronous — Start Query returns immediately with an execution ID; use Get Query Execution in a loop (or a Wait block) to poll until state is SUCCEEDED before calling Get Query Results.
  • outputLocation is required unless your workgroup has a default — if you omit it and your workgroup has no configured output location, Athena will reject the query with an error.
  • Cost control — use LIMIT clauses and partition filters in your SQL; check dataScannedInBytes from Get Query Execution to monitor scan volume.
  • IAM permissions needed — the access key must have athena:StartQueryExecution, athena:GetQueryExecution, athena:GetQueryResults, athena:StopQueryExecution, athena:ListQueryExecutions, and s3:PutObject/s3:GetObject on the output bucket.
  • Pagination — Get Query Results caps at 999 rows per call; use the returned nextToken in a loop to page through large result sets.