How to change the name of the Athena results stored in S3?

此生再无相见时 提交于 2019-12-21 05:10:26

问题


The results of Athena query is saved by the query id (a long string) in S3. I was wondering if there's a way to save the results of the query with a pre-specified name? (that can later be easily looked up)


回答1:


unfortunately no (at least not yet)! the best way to do this as of now is to write a script to go through all the results of each run and rename (moving+deleting) all the files in that s3 bucket!




回答2:


For named queries your results location will be structured as follows:

s3://athena-query-results-<account>-<region>/<query-name>/<year>/<month>/<day>/<UUID>.csv

I don't know any method of specifying the UUID by the client. But you could look for the newest file within the s3 folder of your named query.

Alternatively, you could use the s3 API or the aws cli to copy the result into a location of your choice.

Does this answer your question?



来源:https://stackoverflow.com/questions/51412005/how-to-change-the-name-of-the-athena-results-stored-in-s3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!