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 공식업데이트됨 일 년 전