s3 inventory Atena query

0

I have s3 inventory service setup done. I have imported data into Athena as CSV format. Is there a way that I can query number of objects in a particularly directory in Athena ?

已提問 2 年前檢視次數 949 次
1 個回答
1

Yes

You can run something like

select count(key) from <your_table>
where key like 'your_prefix%'

Lets say you have 3 objects

  • prefix1/prefix2/object1.txt
  • prefix1/prefix2/object2.txt
  • prefix1/prefix3/object3.txt
select count(key) from <your_table>
where key like 'prefix1/prefix2/%'

This would return 2

Check out this blog post for more examples

https://aws.amazon.com/blogs/storage/manage-and-analyze-your-data-at-scale-using-amazon-s3-inventory-and-amazon-athena/

profile pictureAWS
專家
Matt-B
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南