Guest User

Untitled

a guest
Jan 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import riak
  2.  
  3. client = riak.RiakClient(port=8087, transport_class=riak.RiakPbcTransport)
  4. bucket = client.bucket('bucket')
  5.  
  6. john = bucket.new('john', {'name': 'john', 'job': 'programmer', 'age': '27'})
  7. john.set_indexes({'job_bin': 'programmer', 'age_int': 31})
  8. john.store()
  9.  
  10. results = client.index('bucket', 'age_int', 30, 50).run()
  11.  
  12. # Python 2.6, 2.7 json.loads function return unicode.
  13. key = results[0].get_key()
  14.  
  15. results[0].get()
  16. # raise TypeError: Unicode bucket names are not supported.
Add Comment
Please, Sign In to add comment