我可以从 Athena 中删除数据(表中的行)吗? [英] Can I delete data (rows in tables) from Athena?
问题描述
是否可以通过 Athena 查询删除存储在 S3 中的数据?我必须从几个表中删除一些行(它们指向 S3 中的单独存储桶).
Is it possible to delete data stored in S3 through an Athena query? I have some rows I have to delete from a couple of tables (they point to separate buckets in S3).
我在 Athena 用户指南中找不到这样做的方法:https://docs.aws.amazon.com/athena/latest/ug/athena-ug.pdf 和 DELETE FROM
不受支持,但我是想知道是否有比尝试在 S3 中查找文件并删除它们更简单的方法.
I couldn't find a way to do it in the Athena User Guide: https://docs.aws.amazon.com/athena/latest/ug/athena-ug.pdf and DELETE FROM
isn't supported, but I'm wondering if there is an easier way than trying to find the files in S3 and deleting them.
推荐答案
您可以利用 Athena 找出所有要删除的文件,然后单独删除它们.有一个特殊的变量$path".
You can leverage Athena to find out all the files that you want to delete and then delete them separately. There is a special variable "$path".
Select "$path" from <table> where <condition to get row of files to delete>
要自动执行此操作,您可以在 Athena 结果上使用迭代器,然后获取文件名并将其从 S3 中删除.
To automate this, you can have iterator on Athena results and then get filename and delete them from S3.
这篇关于我可以从 Athena 中删除数据(表中的行)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!