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
demandé il y a 5 ans562 vues
3 réponses
0

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

répondu il y a 5 ans
0

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

mojimi
répondu il y a 5 ans
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
répondu il y a 5 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions