我可以从雅典娜删除数据(表中的行)吗? [英] Can I delete data (rows in tables) from Athena?

查看:76
本文介绍了我可以从雅典娜删除数据(表中的行)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过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).

我在《雅典娜用户指南》中找不到解决方法: 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找出要删除的所有文件,然后分别删除它们。

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.

这篇关于我可以从雅典娜删除数据(表中的行)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆