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년 전604회 조회
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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인