Re: read-modify-write via python client

2012-09-29 Thread Adam Lindsay
David, Adding to what Michael said, an idiomatic pattern I've been using is: obj = kv.bucket(b).get(name) data = f.get_data() or {'my_list': []} data['my_list'].append(something) obj.set_data(data) obj.store() [usually it's `f.get_data() or {}` when I use it, but you should see the pattern.]

Re: read-modify-write via python client

2012-09-28 Thread Michael Clemmons
David, The way you're doing it is correct. As far as I can tell populate is mostly meant for internal use similar to set_siblings which has this comment in the code Set the array of siblings - used internally Not sure why they arnt using the convention of setting internal methods with _

read-modify-write via python client

2012-09-28 Thread David Lowell
Hi folks, Simple question here. Based on the python client documentation, I'm unclear on the canonical means to perform in python a read-modify-write cycle on an object stored in Riak. What seems intuitive to me: obj = kv.bucket(b).get(name) if f.exists(): data = f.get_data()