Skip to content

ihazem/HBaseThriftPython

Repository files navigation

HBaseThriftPython

Install thrift on Mac:

$ brew install thrift

Install thrift on Linux:

$ yum install thrift

Generate HBase Thrift Bindings for Python

Create Project working directory

$ cd /Volumes/Files-Pics-Vids/Files/Files/Hazem/Professional/Career/Cloudera/Development/Git/Projects/
$ mkdir HBaseThrift
$ cd HBaseThrift/

To generate the bindings for Python, use the HBase IDL (Interface Definition Language). Target language libraries for C++, Java, Ruby, PHP, (and more) are generated by running this file through the Thrift compiler with the appropriate flags. This will create a dir ‘gen-py/hbase’ that will have the Python libraries used by all your Python code as it interacts with HBase

$ thrift -gen py /Volumes/Files-Pics-Vids/Files/Files/Hazem/Professional/Career/Cloudera/Development/Git/Projects/hbase/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift

On CDH Cluster

thrift -gen py /opt/cloudera/parcels/CDH-6.2.0-1.cdh6.2.0.p0.967373/lib/hue/apps/hbase/thrift/Hbase.thrift

Save Hbase.thrift file for future reference

$ cp /Volumes/Files-Pics-Vids/Files/Files/Hazem/Professional/Career/Cloudera/Development/Git/Projects/hbase/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift .
$ mv gen-py/* .
$ rm -rf gen-py/

get the Thrift code for the language (Python) that contains all the classes for connection to Thrift and its protocols. This code can be found at /path/to/thrift/thrift-0.9.0/lib/py/src/.

$ wget http://archive.apache.org/dist/thrift/0.12.0/thrift-0.12.0.tar.gz
$ tar -xzf thrift-0.12.0.tar.gz
$ mkdir thrift
$ cp -rp thrift-0.12.0/lib/py/src/* ./thrift/

If you need to install hbase python module

pip3 install hbase-thrift

References:

https://blog.cloudera.com/how-to-use-the-hbase-thrift-interface-part-1/

About

HBase Thrift Python Code and Examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published