答案是肯定的,现在你可以从Athena删除数据,AWS最近推出了支持ACID属性的ICEBERG表格。
您需要按以下步骤创建一个Iceberg表格,该表格将具有与Athena表格相同的数据(您希望删除/更新记录的表格)。
创建ICEBERG表格
Create table new_iceberg_table
(id double, name string)
LOCATION 'S3://path/where/you/want/to_save/'
TBLPROPERTIES (table_type='iceberg')
从数据目录加载数据到新的“冰山”表中。
Insert into datasource.new_iceberg_table
Select * from datasource.main_athena_table.
main_athena_table = 您想要执行删除/更新或ACID操作的表格。
new_iceberg_table = 新创建的表格。
现在,您可以向Iceberg表插入、更新和删除数据。
您还可以使用SYSTEM_TIME进行时间旅行。
相关的SQL语句
#更新SQL =
UPDATE from datasource.new_iceberg_table set id = 04 where name='ABC' ;
#删除SQL =
DELETE from datasource.new_iceberg_table where name='ABC' ;
#时间旅行SQL(如果你想要穿越时空并查看旧数据)
SELECT * from datasource.new_iceberg_table for SYSTEM_TIME as of (current_timestamp - interval '10' minutes) where name='ABC'
谢谢您的选择。