PynamoDB icon indicating copy to clipboard operation
PynamoDB copied to clipboard

Urgent! Update function stop working in the new release 1.3.6.

Open kyangmove opened this issue 11 years ago • 1 comments

Could not update item if the table has range key.

This is in the update_item function. Range key is not passed to kwargs and caused the update failed with error.

(<class 'pynamodb.exceptions.UpdateError'>, UpdateError('Failed to update item: {"__type":"com.amazon.coral.validate#ValidationException","message":"The provided key element does not match the schema"}',), None)

args, _ = self._get_save_args(null_check=False) attribute_cls = None for attr_name, attr_cls in self._get_attributes().items(): if attr_name == attribute: value = attr_cls.serialize(value) attribute_cls = attr_cls break kwargs = {} if len(expected_values): kwargs.update(expected=self._build_expected_values(expected_values, UPDATE_FILTER_OPERATOR_MAP)) kwargs[pythonic(ATTR_UPDATES)] = { attribute: { ACTION: action.upper() if action else None, VALUE: { ATTR_TYPE_MAP[attribute_cls.attr_type]: value } } } kwargs[pythonic(RETURN_VALUES)] = ALL_NEW kwargs.update(conditional_operator=conditional_operator) data = self._get_connection().update_item( _args, *_kwargs )

kyangmove avatar Apr 23 '15 19:04 kyangmove

1.3.5 works fine on update item function

kyangmove avatar Apr 23 '15 19:04 kyangmove