-
Notifications
You must be signed in to change notification settings - Fork 428
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
Use Attribute Name Based on Attribute Class #160
Conversation
@@ -349,12 +349,12 @@ def update_item(self, attribute, value=None, action=None, conditional_operator=N | |||
if len(expected_values): | |||
kwargs.update(expected=self._build_expected_values(expected_values, UPDATE_FILTER_OPERATOR_MAP)) | |||
kwargs[pythonic(ATTR_UPDATES)] = { | |||
attribute: { | |||
attribute_cls.attr_name: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder if we should pull the name out up here and save to a local var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you want to save it to a local var for readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya just so we don't have to keep accessing it that way.. seems error prone if someone changes this in the future, but may just be a matter of opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
ACTION: action.upper() if action else None, | ||
} | ||
} | ||
if action is not None and action.upper() != DELETE: | ||
kwargs[pythonic(ATTR_UPDATES)][attribute][VALUE] = {ATTR_TYPE_MAP[attribute_cls.attr_type]: value} | ||
kwargs[pythonic(ATTR_UPDATES)][attribute_cls.attr_name][VALUE] = {ATTR_TYPE_MAP[attribute_cls.attr_type]: value} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could then use that var here...
+1 |
If you use
attr_name
, such that the name in the Dynamo database is different from the ORM, update_item would do the wrong thing and create a new attribute using the ORM name.This PR fixes that bug.