Overview
This node executes SQL queries on AWS Athena, a serverless interactive query service that allows you to analyze data directly in Amazon S3 using standard SQL. It is useful for workflows that require querying large datasets stored in S3 without managing infrastructure or complex ETL processes.
Common scenarios include:
- Extracting and transforming data from S3 for further processing.
- Running ad-hoc analytics queries within an automated workflow.
- Integrating Athena query results into other systems or reports.
For example, you can use this node to run a query like SELECT * FROM my_table LIMIT 10 on your Athena database and then process each row individually in subsequent workflow steps.
Properties
| Name | Meaning |
|---|---|
| Region | AWS region where your Athena service is located (e.g., us-east-1). |
| Database Name | Optional name of the Athena database to query. Leave empty to use the default database. |
| SQL Query | The SQL query string to execute on Athena. |
| S3 Output Location | S3 bucket path (e.g., s3://my-bucket/athena-results/) where Athena will save query results. |
| Query Timeout (Seconds) | Maximum time in seconds to wait for query completion. Defaults to 300 seconds. |
| Output Format | How to structure the query results: - Table Format: Each database row becomes a separate workflow item. - Raw Format: All results returned in one item with metadata (query ID, row count, columns). |
| Max Rows Returned | Controls how many rows are returned: - No Limit: Return all available rows (may be slow). - Limit Applied: Return up to a maximum number of rows specified by "Max Rows". |
| Max Rows | Maximum number of rows to return when limit is applied. Must be a positive integer. |
Output
The output depends on the selected Output Format:
Table Format:
Each row from the Athena query result is emitted as a separate workflow item with its fields mapped as key-value pairs in thejsonproperty.Raw Format:
A single workflow item is emitted containing:queryExecutionId: The Athena query execution ID.rowCount: Number of rows returned.columns: Array of column names.results: Array of objects representing each row with column-value mappings.
If no rows are returned, the raw format outputs an item with empty results and zero row count.
The node does not output binary data.
Dependencies
- Requires valid AWS credentials with permissions to execute Athena queries and access the specified S3 bucket.
- The node uses AWS Signature Version 4 signing for authentication.
- Requires network access to AWS Athena endpoints in the specified region.
- No additional external libraries beyond those bundled with n8n.
Troubleshooting
Invalid AWS Credentials:
Error if AWS access key or secret key is missing or incorrect. Ensure credentials are configured properly in n8n.Missing Required Parameters:
Errors occur if Region, SQL Query, or S3 Output Location are empty or invalid.Query Timeout:
If the query takes longer than the specified timeout, the node throws a timeout error. Increase the timeout or optimize the query.Query Failure or Cancellation:
If Athena returns a failed or cancelled status, the node throws an error with the reason provided by Athena.Max Rows Validation:
When "Limit Applied" mode is selected, max rows must be a positive integer; otherwise, an error is thrown.Performance Warning:
Using "No Limit" for max rows may cause slow performance or large memory usage if the query returns many rows.