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

Other fields required when trying to Add/Delete from a set #34

Closed
dlg opened this issue Sep 15, 2014 · 6 comments
Closed

Other fields required when trying to Add/Delete from a set #34

dlg opened this issue Sep 15, 2014 · 6 comments

Comments

@dlg
Copy link

dlg commented Sep 15, 2014

If I call update_item(attrib, value, action='ADD'), I get an error that an un-related field can't be None. As I read the docs, I only need to set the field I'm updating.

...
user.update_item('attribute_to_update', user_id, action='add')
File "/Users/danielgould/.virtualenvs/tmp_test/lib/python2.7/site-packages/pynamodb/models.py", line 320, in update_item
args, kwargs = self._get_save_args()
File "/Users/danielgould/.virtualenvs/tmp_test/lib/python2.7/site-packages/pynamodb/models.py", line 833, in _get_save_args
serialized = self._serialize(null_check=null_check)
File "/Users/danielgould/.virtualenvs/tmp_test/lib/python2.7/site-packages/pynamodb/models.py", line 994, in _serialize
raise ValueError("Attribute '{0}' cannot be None".format(attr.attr_name))
ValueError: Attribute 'other_attrib' cannot be None

@jlafon
Copy link
Contributor

jlafon commented Sep 16, 2014

I'm trying to reproduce this but can't. Can you provide the model definition? I specifically test for this functionality here (model definition here). Thanks.

@jlafon
Copy link
Contributor

jlafon commented Sep 16, 2014

Also, what version of PynamoDB are you using?

@dlg
Copy link
Author

dlg commented Sep 16, 2014

Thanks for taking a look.

I'm using

boto==2.32.1
pynamodb==1.3.2

I sent you some code off-list. Thanks so much.

@jlafon jlafon closed this as completed in 74caf49 Sep 17, 2014
@jlafon
Copy link
Contributor

jlafon commented Sep 17, 2014

Hi there. I think I've fixed the issue. Can you install from the devel branch on GitHub and retry?

$ pip install git+https://github.com/jlafon/PynamoDB.git@devel#egg=pynamodb

@jlafon jlafon reopened this Sep 17, 2014
@dlg
Copy link
Author

dlg commented Sep 17, 2014

Thanks. In my code I changed
user.update_item('attribute_to_update', user_id, action='add')
to
user.update_item('attribute_to_update', [user_id], action='add')
and the test passed. I'll double-check but I think you got it.

Really appreciate it.

@jlafon
Copy link
Contributor

jlafon commented Sep 17, 2014

Glad to hear it. I'll cut a new release soon including this and a few other fixes.

@jlafon jlafon closed this as completed Sep 18, 2014
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

2 participants