Use the Apache Thrift Proxy API
The Apache Thrift library provides cross-language client-server remote procedure calls (RPCs), using Thrift bindings.
A Thrift binding is a client code generated by the Apache Thrift Compiler for a target language (such as Python) that allows communication between the Thrift server and clients using that client code. HBase includes an Apache Thrift Proxy API, which allows you to write HBase applications in Python, C, C++, or another language that Thrift supports. The Thrift Proxy API is slower than the Java API and may have fewer features. T use the Thrift Proxy API, you need to configure and run the HBase Thrift server on your cluster. You also need to install the Apache Thrift compiler on your development system.
HBase.thriftis included as part of HBase. After generating the bindings, copy the Thrift libraries for your language into the same directory as the generated bindings. In the following Python example, these libraries provide the
thrift.protocollibraries. These commands show how you might generate the Thrift bindings for Python and copy the libraries on a Linux system.
mkdir HBaseThrift cd HBaseThrift/ thrift -gen py /path/to/Hbase.thrift mv gen-py/* . rm -rf gen-py/ mkdir thrift cp -rp ~/Downloads/thrift-0.9.0/lib/py/src/* ./thrift/
from thrift.transport import TSocket from thrift.protocol import TBinaryProtocol from thrift.transport import TTransport from hbase import Hbase # Connect to HBase Thrift server transport = TTransport.TBufferedTransport(TSocket.TSocket(host, port)) protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport) # Create and open the client connection client = Hbase.Client(protocol) transport.open() # Modify a single row mutations = [Hbase.Mutation( column='columnfamily:columndescriptor', value='columnvalue')] client.mutateRow('tablename', 'rowkey', mutations) # Modify a batch of rows # Create a list of mutations per work of Shakespeare mutationsbatch =  for line in myDataFile: rowkey = username + "-" + filename + "-" + str(linenumber).zfill(6) mutations = [ Hbase.Mutation(column=messagecolumncf, value=line.strip()), Hbase.Mutation(column=linenumbercolumncf, value=encode(linenumber)), Hbase.Mutation(column=usernamecolumncf, value=username) ] mutationsbatch.append(Hbase.BatchMutation(row=rowkey,mutations=mutations)) # Run the mutations for all the lines in myDataFile client.mutateRows(tablename, mutationsbatch) transport.close()