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年前616ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ