Athena

Run SQL queries on data in Amazon S3 using AWS Athena

Amazon Athena is an interactive query service from AWS that makes it easy to analyze data directly in Amazon S3 using standard SQL. Athena is serverless, so there is no infrastructure to manage, and you pay only for the queries you run.

With Athena, you can:

  • Query data in S3: Run SQL queries directly against data stored in Amazon S3 without loading it into a database
  • Support multiple formats: Query CSV, JSON, Parquet, ORC, Avro, and other common data formats
  • Integrate with AWS Glue: Use the AWS Glue Data Catalog to manage table metadata and schemas
  • Scale automatically: Handle queries of any size without provisioning servers or clusters
  • Save and reuse queries: Create named queries for frequently used SQL statements

In Sim, the Athena integration enables your agents to run SQL queries against data in S3, check query execution status, retrieve results, and manage saved queries — all within your agent workflows. Supported operations include:

  • Start Query: Execute SQL queries against your S3 data
  • Get Query Execution: Check the status and details of a running or completed query
  • Get Query Results: Retrieve the results of a completed query
  • Stop Query: Cancel a running query execution
  • List Query Executions: View recent query execution IDs
  • Create Named Query: Save a query for reuse
  • Get Named Query: Retrieve details of a saved query
  • List Named Queries: View all saved query IDs

This integration empowers Sim agents to automate data analysis tasks using AWS Athena, enabling workflows that query, monitor, and manage large-scale data in S3 without manual effort or infrastructure management.

Usage Instructions

Integrate AWS Athena into workflows. Execute SQL queries against data in S3, check query status, retrieve results, manage named queries, and list executions. Requires AWS access key and secret access key.

Tools

athena_start_query

Start an SQL query execution in AWS Athena

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
awsAccessKeyIdstringYesAWS access key ID
awsSecretAccessKeystringYesAWS secret access key
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)

Output

ParameterTypeDescription
queryExecutionIdstringUnique ID of the started query execution

athena_get_query_execution

Get the status and details of an Athena query execution

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
awsAccessKeyIdstringYesAWS access key ID
awsSecretAccessKeystringYesAWS secret access key
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

athena_get_query_results

Retrieve the results of a completed Athena query execution

Input

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

Output

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

athena_stop_query

Stop a running Athena query execution

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
awsAccessKeyIdstringYesAWS access key ID
awsSecretAccessKeystringYesAWS secret access key
queryExecutionIdstringYesQuery execution ID to stop

Output

ParameterTypeDescription
successbooleanWhether the query was successfully stopped

athena_list_query_executions

List recent Athena query execution IDs

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
awsAccessKeyIdstringYesAWS access key ID
awsSecretAccessKeystringYesAWS secret access key
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_create_named_query

Create a saved/named query in AWS Athena

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
awsAccessKeyIdstringYesAWS access key ID
awsSecretAccessKeystringYesAWS secret access key
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

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
awsAccessKeyIdstringYesAWS access key ID
awsSecretAccessKeystringYesAWS secret access key
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

Input

ParameterTypeRequiredDescription
awsRegionstringYesAWS region (e.g., us-east-1)
awsAccessKeyIdstringYesAWS access key ID
awsSecretAccessKeystringYesAWS secret access key
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

On this page