简体   繁体   English

使用 hive 删除 dynamoDB 记录

[英]Delete dynamoDB records using hive

I have a pipeline that runs periodically and dumps some data into s3.我有一个定期运行并将一些数据转储到 s3 的管道。 Now I want to completely replace the existing data in dynamoDb with the new data dumped in the s3.现在我想用转储到 s3 中的新数据完全替换 dynamoDb 中的现有数据。

if dynamoDB table key is present in s3 data the dynamo record should get updated.如果 dynamoDB 表键存在于 s3 数据中,则 dynamo 记录应该得到更新。

If key is absent in s3 data but present in dynmoDB, then record in dynamo needs to be deleted and any new data need to be inserted as new record in dynamo table.如果 s3 数据中不存在键但存在于 dynmoDB 中,则需要删除 dynamo 中的记录,并且需要将任何新数据作为新记录插入到 dynamo 表中。

Is it possible to accomplish this by hive query (external Hive table connected to a DynamoDB).是否可以通过 hive 查询(连接到 DynamoDB 的外部 Hive 表)来完成此操作。 I am aware we can insert data into dynamoDB using hive query.我知道我们可以使用 hive 查询将数据插入 dynamoDB。 Can we delete items from the dynamoDB as well using hive query.我们可以使用 hive 查询从 dynamoDB 中删除项目吗?

Run:跑步:

Insert Overwrite table <Dynamodbtablename> select columns from <s3_table>;

This will overwrite the existing records based on the key column values.这将根据键列值覆盖现有记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM