-
Notifications
You must be signed in to change notification settings - Fork 41
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
Support custom update expressions when update has no other attribute changes #138
Conversation
…changes This is a minimal implementation to allow update expressions to be passed through directly to the api call. To avoid conflicts, an error is raised if an update expression would have been generated by the sdk to update dirty attributes. Also: Adds support for pass-through API options to the class-level `.update` item operation. Resolves aws#137
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.
Looks good! This is on the right track. I think you will need a changelog for this. Are there any other improvements you can see while we're at it?
Would you like to see more than the changes already made in
There's a few subtle things here-and-there as we're using the sdk, though most we've been able to workaround or adjust our approach! |
Sorry... this is what I get for reviewing from mobile. :D |
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.
LGTM - requested one more reviewer and we can try to release this week.
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.
Looks good - few minor comments
@@ -581,19 +576,21 @@ def find_all(keys) | |||
# Aws::DynamoDB::Client#update_item} call immediately on the table, | |||
# using the attribute key/value pairs provided. | |||
# | |||
# @param [Hash] opts attribute-value pairs for the update operation you | |||
# wish to perform. You must include all key attributes for a valid | |||
# @param [Hash] new_params attribute-value pairs for the update operation |
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.
naming nit: maybe instead of new_params we could just use attributes
?
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.
new_params is what's used for all of the updates - I think it makes sense to stay consistent.
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.
Unfortunately attributes
would shadow the attributes method already used below:
https://github.com/aws/aws-sdk-ruby-record/blob/92e0070eea16698e23be8e31d3a36e681dc079e9/lib/aws-record/record/item_operations.rb#L599-L600
I used new_params
because it was consistent with the ItemOperations#update
/ItemOperations#update!
signatures also in this file. But maybe that's confusing since in this particular case it also must include the keys?
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.
Nvm - I think new_params
makes sense for consistency then.
Issue #, if available:
Resolves #137
Description of changes:
This is a minimal implementation to allow update expressions to be passed through directly to the api call. To avoid conflicts, an error is raised if an update expression would have been generated by the sdk to update dirty attributes.
Also: Adds support for pass-through API options to the class-level
.update
item operation.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.