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
posta 5 anni fa634 visualizzazioni
3 Risposte
0

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

con risposta 5 anni fa
0

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

mojimi
con risposta 5 anni fa
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
con risposta 5 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande