1 回答
- 最新
- 投票最多
- 评论最多
0
Hi,
Athena automatically creates metadata files when it moves files using the start_query_execution command. In order to delete the .csv.metadata files, you can use the following logic below. Make sure to use item.key to get the name of the object. The try statement will skip over the s3.ObjectSummary object that is giving this error.
session = boto3.session.Session()
s3 = session.resource('s3')
my_bucket = s3.Bucket(<bucketname>)
for item in my_bucket.objects.filter(Prefix=<subbucketpath>):
try:
if item.key.endswith('.csv.metadata'):
item.delete()
except Exception as e:
print("The following error occured: {}".format(e))
Reference: https://docs.aws.amazon.com/athena/latest/ug/querying.html
已回答 9 个月前
相关内容
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前