stevearc / flywheel

Object mapper for Amazon's DynamoDB
MIT License
128 stars 25 forks source link

Use attribute_not_exists() condition to avoid overwrite on save. #62

Closed garyd203 closed 5 years ago

garyd203 commented 6 years ago

This replaces the older primary-key-not-null pattern that we implemented using the deprecated expression syntax. It is now the recommended way to avoid overwriting an existing item in put - see https://boto3.readthedocs.io/en/latest/reference/services/dynamodb.html#DynamoDB.Client.put_item

A bonus is that the moto library (which is often used as an in-memory implementation for testing) implements the attribute_not_exists() semantics, whereas it does not implement is-null tests for a missing item.

garyd203 commented 6 years ago

Great, thanks for the feedback, I will have a look into that.

garyd203 commented 5 years ago

Hi @stevearc apologies that i never got back to this PR. I think I will just close it since it is basically abandoned at this point.

Cheers, gd