79280703

Date: 2024-12-14 13:38:19
Score: 0.5
Natty:
Report link

I'm not certain, but you could try mapping "PK" to an expression attribute name, and then referencing the string "PK" using that?

So, change the top bit to:

deleteInput := &dynamodb.DeleteItemInput{
    TableName: aws.String("YourTableName"),
    Key: map[string]*dynamodb.AttributeValue{
        "PK": {S: aws.String("PrimaryKeyValue")},
    },
    ConditionExpression: aws.String("attribute_not_exists(#part_key) OR #status = :statusValue"),
    ExpressionAttributeNames: map[string]*string{
        "#status": aws.String("Status"),
        "#part_key": aws.String("PK"),
    },
    ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
        ":statusValue": {S: aws.String("Completed")},
    },
}

Might work.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Ponty