Query Results and History

Amazon Athena automatically stores query results and metadata in an Amazon S3 location that you can specify. These results can be accessed, downloaded, and reviewed in the Athena console.

Viewing Query History

  1. Click on Recent Queries in the Athena console.
  2. View all queries submitted in this workgroup, including their State, Run Time, and Data Scanned.
    Connect
  3. Select a Query ID and click Download results to download the query output as a CSV file.
    Connect

Locating Query Results in S3

  1. In the AWS Search Bar, type S3, then select S3 from the search results.
    Connect
  2. Locate the bucket named athena-workshop-[your AWS account number]
    • Example: athena-workshop-12345678910
      Connect
  3. Click on the bucket name to open it.

Understanding the Query Results Storage

  • The S3 bucket will contain:
    • A prefix for each saved query that has been run.
    • An Unsaved folder storing results from unsaved queries.
    • Note: If you don’t see the Unsaved folder, copy a previous query into a new query tab, run it, and then check the S3 bucket again.
  1. Click on the Athena_create_coustomer_csv prefix. Connect
  2. Click through the Year, Month, and Day prefixes.
  • Year Connect
  • Month Connect
  • Day Connect
  1. The results will be stored with a unique Query ID. Connect