Delete whole partition or Delete using "begins_with" on the Partition Key?

0

Hello, I would like to know if it is possible to delete a whole partition or perform a delete operation with a "begins_with" or the Partition Key?

The problem here is when you use the Hash Key for grouping and the Sort Key for hierarchical data, when you need to delete all the hierarchies in the "grouping" you can't, so you end up having to do several queries and batch deletes on each particular item.

I would like a way to do the following pseudo query:

DELETE WHERE PARTITION_KEY='Project-123'

or

DELETE WHERE PARTITION_KEY='Project-123' AND SORT_KEY.begins_with('Activity')

Edited by: mojimi on May 16, 2019 11:52 AM

mojimi
已提问 5 年前563 查看次数
3 回答
0

Unfortunately no. You have to get a list of the items and then iterate through them or do them in multiple bulk calls.

已回答 5 年前
0

I was sad to hear that the API has limited support to Rick Houligan's modeling instructions

mojimi
已回答 5 年前
0

Hi,

Unfortunately, there is no DynamoDB API yet to delete the items in bulk.

WORKAROUND:
As a workaround, you can make use of Hive external table and then perform SQL like queries on DynamoDB table to acheive your use-case.
Sample Hive query to create external table on DynamoDB:

CREATE EXTERNAL TABLE MyExternalTable
(Name STRING, Epoch BIGINT)
STORED BY 'org.apache.hadoop.hive.dynamodb.DynamoDBStorageHandler'
TBLPROPERTIES (
"dynamodb.table.name" = "DDBTable",
"dynamodb.column.mapping" = "Name:Name,Epoch:Epoch"
);

Hope it helps. Please let us know if you face any further issues. We would be happy to help you.

AWS
已回答 5 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则