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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With