DocumentClient: inconsistant requirement of conditional expressions vs Dynamodb, for transact writes
Opened this issue · 0 comments
seba-i commented
Hi, it is frustrating that DocumentClient transactWrite forces you to use a 'conditional expression', whereas the underlying Dynamodb transactWriteItem does not.
DocumentClient TransactWrite uses class Operation, where the field expression
is a required field, even though it then gets translated into a Dynamodb TransactWriteItem, whose conditionExpression
is not required.
Its inconvenient to always have to use a conditional expression, eg just PUT an object into db.
Happy to submit a PR if there's agreement (to change Option.expression type to nullable String)
// workaround...
TransactWrite(
put: Operation(
value: {'pk': '123', 'sk': '456'},
tableName: 'my-table',
expression: 'attribute_not_exists(arrrgghhhh)')), // :-(