update_multiple_fields_return_old
Update multiple fields values from a single record and return their previous values, in a single database operation.
Will usually be Atomic
Any setter that does not pass data validation will be discarded client side by StructNoSQL, but since all of your valid setters will be grouped in a single operation, if a single of your setter is invalid and cause the operation to crash, all of your setters will be rejected/and reverted (for example, trying to access/modify a value inside a field that should be a dict, where it is in reality a list)
Not always Atomic !
The data validation will be ran on the entirety of your data before starting to send database requests. As explained in Operations Sectioning, if the sum of the size of all your setters exceeds 400KB (the DynamoDB limit per operation), your request will automatically be divided into multiple requests. If a/some part's of your operation are executed without causing a database rejection, and then one of the part of your operation is rejected, you will get a success value of False from the function call, yet, the parts of your operation that have already been completed, will not be reverted.
#
ParametersProperty name | Required | Accepted types | Default | Description |
---|---|---|---|---|
key_value | YES | Any | - | The path expression to target the attribute to set/update in your record. See Field path selectors |
setters | YES | Dict[str, FieldSetter] | - | A dict of FieldSetter object. See FieldSetter |
data_validation | NO | bool | True | Whether data validation from your table model should be applied on the retrieved data. |
#
AvailabilityTable | Available |
---|---|
DynamoDBBasicTable | ✅ |
DynamoDBCachingTable | ✅ |
ExternalDynamoDBApiBasicTable | ✅ |
ExternalDynamoDBApiCachingTable | ✅ |