Skip to content

feat(athena): add AWS Athena integration#4034

Merged
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/aws-athena-integration
Apr 8, 2026
Merged

feat(athena): add AWS Athena integration#4034
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/aws-athena-integration

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add full AWS Athena integration with 8 operations: start query, get query execution, get query results, stop query, list query executions, create named query, get named query, list named queries
  • Tools, API routes, block config, icon, and auto-generated docs
  • Uses @aws-sdk/client-athena with standard AWS credential auth pattern (access key + secret key + region)
  • Follows established AWS integration patterns (CloudWatch, S3, DynamoDB)

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 8, 2026 3:12am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 8, 2026

PR Summary

Medium Risk
Introduces new authenticated API routes that accept AWS access keys and execute Athena commands; mistakes could expose credentials or enable unintended AWS actions. Changes are largely additive but touch backend request validation and tool/registry wiring.

Overview
Adds a new AWS Athena integration end-to-end: new icon, docs page (tools/athena.mdx), and inclusion in docs/integrations icon maps and tool metadata.

Implements eight new Athena tool endpoints under apps/sim/app/api/tools/athena/* (start/stop query, fetch execution/results, list executions, and manage named queries) using @aws-sdk/client-athena, plus a shared createAthenaClient helper.

Registers the new tool configs (apps/sim/tools/athena/*), adds an AthenaBlock with operation dropdown + parameter mapping, and wires everything into the blocks and tools registries so it’s available in workflows and the landing integrations catalog.

Reviewed by Cursor Bugbot for commit 9cae283. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 8, 2026

Greptile Summary

This PR adds a full AWS Athena integration to Sim, exposing 8 operations (start query, get query execution, get query results, stop query, list query executions, create named query, get named query, list named queries) through a unified block UI. The implementation follows the established AWS integration pattern using @aws-sdk/client-athena with static credential auth. All four issues flagged in the previous review round have been resolved.

Confidence Score: 5/5

Safe to merge — all previously flagged P1 issues have been resolved and no new issues were found.

All four P1 findings from the prior review round are confirmed fixed: the rowData variable shadowing, alphabetical ordering in tools/registry.ts, the queryString runtime guard in create_named_query, and the maxResults ceiling lowered to 999. The implementation follows established AWS integration patterns, credentials use user-only visibility, auth is checked on every route, and the Zod schemas correctly validate inputs. No remaining P0 or P1 issues detected.

No files require special attention.

Vulnerabilities

  • AWS credentials (accessKeyId, secretAccessKey) are handled server-side only and all routes are protected by checkInternalAuth before processing the request body.
  • Credentials are declared with visibility: 'user-only' in tool param definitions, consistent with project rules for user-provided secrets.
  • No SQL injection surface: query strings are passed as-is to Athena's fully parameterized SDK commands.
  • No secrets are logged; only error messages reach logger.error.

Important Files Changed

Filename Overview
apps/sim/app/api/tools/athena/get-query-results/route.ts Correctly handles header-row skipping on first page, previously flagged rowData shadowing resolved, maxResults now capped at 999 to stay within AWS hard limit of 1000.
apps/sim/blocks/blocks/athena.ts Well-structured block with per-operation sub-block conditions, required guards, wandConfig for SQL generation, and explicit runtime validation for all required fields.
apps/sim/app/api/tools/athena/start-query/route.ts Clean implementation; correctly builds QueryExecutionContext only when database or catalog is provided.
apps/sim/tools/registry.ts Athena tools correctly inserted in alphabetical order after ashby_* entries.
apps/sim/tools/athena/types.ts Complete, well-typed interfaces for all 8 operations extending AthenaConnectionConfig.
apps/sim/app/api/tools/athena/utils.ts Minimal shared factory — correct pattern for reusing the Athena client across all route handlers.
apps/sim/tools/athena/index.ts Barrel export correctly re-exports all 8 tools and the types module, following project conventions.

Reviews (3): Last reviewed commit: "fix(athena): cap maxResults at 999 to pr..." | Re-trigger Greptile

- Fix variable shadowing: rename inner `data` to `rowData` in row mapper
- Fix first-page maxResults off-by-one: request maxResults+1 to compensate for header row
- Add missing runtime guard for queryString in create_named_query
- Move athena registry entries to correct alphabetical position
- Reorder athena_* registry keys to strict alphabetical order
- Add type re-exports from index.ts barrel
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

…w adjustment

The +1 adjustment for the header row on first-page requests could
produce MaxResults=1001 when user requests 1000, exceeding the AWS
API hard cap of 1000.
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9cae283. Configure here.

@waleedlatif1 waleedlatif1 merged commit 2504bfb into staging Apr 8, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/aws-athena-integration branch April 8, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant