Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kyangmove opened this issue Apr 23, 2015 · 1 comment
Closed

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

kyangmove opened this issue Apr 23, 2015 · 1 comment

Comments

@kyangmove
Copy link

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
Copy link
Author

1.3.5 works fine on update item function

@kyangmove kyangmove changed the title Could not update item if using range key in the table Update failed in the new release 1.3.6. Could not update item if updating a table that has range key Apr 24, 2015
@kyangmove kyangmove changed the title Update failed in the new release 1.3.6. Could not update item if updating a table that has range key Update function stop working in the new release 1.3.6. Could not update item if updating a table that has range key Apr 24, 2015
@kyangmove kyangmove changed the title Update function stop working in the new release 1.3.6. Could not update item if updating a table that has range key Update function stop working in the new release 1.3.6. Apr 24, 2015
@kyangmove kyangmove changed the title Update function stop working in the new release 1.3.6. Urgent! Update function stop working in the new release 1.3.6. Apr 24, 2015
@jlafon jlafon closed this as completed in 134a476 Apr 25, 2015
jlafon added a commit that referenced this issue Jun 24, 2015
* devel:
  v1.3.7
  1.3.7 release notes
  Fixes documentation bug #58
  Resolves #59 where range keys were not included in item updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant