Skip to content

Instantly share code, notes, and snippets.

@voluntas
Created September 22, 2011 14:33
Show Gist options
  • Save voluntas/1234920 to your computer and use it in GitHub Desktop.
Save voluntas/1234920 to your computer and use it in GitHub Desktop.
sample.py
import riak
client = riak.RiakClient(port=8087, transport_class=riak.RiakPbcTransport)
bucket = client.bucket('bucket')
john = bucket.new('john', {'name': 'john', 'job': 'programmer', 'age': '27'})
john.set_indexes({'job_bin': 'programmer', 'age_int': 31})
john.store()
results = client.index('bucket', 'age_int', 30, 50).run()
# Python 2.6, 2.7 json.loads function return unicode.
key = results[0].get_key()
results[0].get()
# raise TypeError: Unicode bucket names are not supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment