Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Athena query results at specific path on S3

I am aware that running a saved Athena query stores results in an Amazon S3 location based on the name of the query and the date the query ran, as follows:

QueryLocation}/{QueryName|Saved}/{yyyy}/{mm}/{dd}/{QueryID}/

Is it possible to override this and store it on a path similar to

QueryLocation}/QueryName

overwriting the results file whenever the query is run?

Surely it can be done by renaming (moving + deleting) file on S3 but wonder if there is a straighter way.

like image 655
siberiancrane Avatar asked Nov 23 '17 06:11

siberiancrane


Video Answer


1 Answers

It is not possible to set the output location, you can only set the prefix. Athena will always use the query execution ID as the last part of the S3 key, i.e. what can be thought of as the filename. One reason for this is that the GetQueryResults API call reads the data off of S3, and if queries could overwrite each other's output you would end up with inconsistent states.

like image 100
Theo Avatar answered Sep 21 '22 17:09

Theo