INSTALLATION DOCUMENTS BY RAVI

Sunday, May 13, 2018

Steps for connecting to Hbase using Python

Note: First we need to start the HBase thrift server

Starting the thrift server:

Open putty and run the below command to start the thrift server


/usr/hdp/current/hbase-master/bin/hbase-daemon.sh start thrift

Go to python prompt as below:







Connecting to HBase:

Run the following below in python prompt

import happybase
connection = happybase.Connection('localhost',9090,autoconnect=False)
connection.open()

Note: For connecting HBase "happybase" module must be present in our python



Printing the list of tables in HBase:

Use the below command to  print the list of tables in HBase

print(connection.tables())





Connecting to the table and printing the rows in the table:






No comments:

Post a Comment

Loading xml file data to oracle table using python

Sample xml file (test.xml): <?xml version="1.0"?> <data>     <customer name="Ravi" >     ...