Skip to content

Add athq subcommand to run Athena queries#15

Open
waltervargas wants to merge 1 commit into
mainfrom
claude/busy-darwin-Z23bd
Open

Add athq subcommand to run Athena queries#15
waltervargas wants to merge 1 commit into
mainfrom
claude/busy-darwin-Z23bd

Conversation

@waltervargas

Copy link
Copy Markdown
Owner

Summary

Adds a top-level ewcli athq command that runs an Athena query synchronously and prints the result rows. Designed for the AWS CloudShell workflow: wget the binary from a release, then run ewcli athq "SELECT ..." using the active console credentials.

  • Uses the existing aws-sdk-go v1 dependency (no new SDK pulled in).
  • Credentials/region resolved from the standard AWS chain (env vars, shared config, instance/role) — works out of the box in CloudShell.
  • Polls GetQueryExecution until the query reaches a terminal state, then streams GetQueryResultsPages to stdout.
  • Flags: --database/-d, --catalog/-c, --workgroup/-w (default primary), --output-location/-o, --region/-r, --format/-f (tsv or csv), --poll-interval.
  • Status line (ewcli: athena query <id>) goes to stderr so stdout stays clean for piping.

Example

ewcli athq -d walterdb "SELECT * FROM AwsCatalog.walterdb.waltertable;"

If the workgroup has no default result location, pass -o s3://bucket/prefix/.

Test plan

  • go build ./... succeeds
  • go vet ./... clean
  • ewcli athq --help renders flags as expected
  • ewcli --help lists athq alongside aws
  • Run against a real Athena workgroup in CloudShell to confirm end-to-end behavior

Generated by Claude Code

ewcli athq "SELECT ..." starts a query, polls until it completes, and
prints rows as TSV (or CSV). Intended for use in AWS CloudShell where
credentials are already available.
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.

2 participants