2 Risposte
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
1
Not answering the question but why use the PK and SK as the conditions? You're already supplying them as part of the DeleteItem call - you don't need to further specify them as conditions. Conditions are there so that you can specify other attributes in the record.
1
While it is possible to use ConditionExpressions
with a DeleteItem
, I believe your understanding on how it works is wrong. When using a ConditionExpression
on a Put/Delete/Update you only evaluate the item which you are operating on, DynamoDB does not look at any other items in the table.
This is the reason why begins_with(SK, :v2)
is giving you issues. You already know the sort key begins with that, so there is no need for the condition.
Contenuto pertinente
- AWS UFFICIALEAggiornata 3 anni fa
- AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 5 mesi fa
Oh because in the table I have SK as TEST#414fbe9f-1675-47a1-9c3d-f40cb7a25c51#DATE#1700671174102 (composed of testId and Date) and I would like to find SK that begins with TEST#414fbe9f-1675-47a1-9c3d-f40cb7a25c51 (testId only).
Is this the wrong way about deleting an item? Just want to delete an item that matches PK and SK that starts with something.
Just found out that I can't do ConditionExpression of PK and SK. Thank you for the clue