Python client and allow_mult

Eric Moritz eric at themoritzfamily.com
Fri Apr 1 13:28:56 EDT 2011


I'm just tinkering; familiarizing myself with Riak's concurrency
control.  I wrote something a while back to explore allow_mult and I
thought it felt awkward.  I've been meaning to ask about it.

Here's the demo:
https://gist.github.com/882055

Eric.

On Fri, Apr 1, 2011 at 1:21 PM, Mark Phillips <mark at basho.com> wrote:
> Hey Eric,
>
> Can I ask what you're using/trying to use the Riak Python lib for? Is
> this a paid gig or are you just tinkering?
>
> Mark
>
> On Fri, Apr 1, 2011 at 10:08 AM, Eric Moritz <eric at themoritzfamily.com> wrote:
>> Does anyone have a standard pattern for working with allow_mult with
>> the Python library?  I feels a bit awkward to me.  I assume I need to
>> do the following:
>>
>> data = {"foo": "bar"}
>> obj = bucket.get("mykey")
>>
>> if not obj.exists():
>>      obj = bucket.new("mykey", data=data)
>> else:
>>   if obj.has_siblings():
>>       # do conflict resolution
>>   else:
>>       obj.set_data(data)
>>
>> obj.store()
>>
>> Is the the way to do it?  If so, that seems like a lot of boiler plating to me.
>>
>> Eric.
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>




More information about the riak-users mailing list