Riak & Timestamps (Python)

Mike Stoddart stodge at gmail.com
Sat Apr 2 21:25:03 EDT 2011


Ah thanks - I thought it was complaining about the value.

On Sat, Apr 2, 2011 at 9:23 PM, Rexxe <rexxe98 at gmail.com> wrote:
> Bucket keys are strings and you're passing an int (data['Time(PDT)'] which
> you set to int(ut))
>
> On Sat, Apr 2, 2011 at 6:13 PM, Mike Stoddart <stodge at gmail.com> wrote:
>>
>> Just want to quickly clarify how to store timestamps in Riak Search
>> using Python. My code:
>>
>>                dt = datetime.datetime.strptime(data['Time(PDT)'], "%b %d,
>> %Y %H:%M:%S")
>>                ut = time.mktime(dt.timetuple())
>>                data['Time(PDT)'] = int(ut)
>>
>>                # Save the object to Riak.
>>                json = simplejson.dumps(data)
>>                obj = bucket.new(data['Time(PDT)'], data=json)
>>                obj.store(return_body=False)
>>
>> This is giving me:
>>
>> TypeError: 1275598830 has type <type 'int'>, but expected one of:
>> (<type 'str'>,)
>>
>> Am I misunderstanding something fundamental here?
>>
>> Thanks
>> Mike
>>
>> _______________________________________________
>> 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