Access Hive Data Using Python -


i have data in hdfs,i need access data using python,can tell me how data accessed hive using python?

can use hive library access hive python,for want import hive class hive import thrifthive

below example

import sys  hive import thrifthive hive.ttypes import hiveserverexception  thrift import thrift thrift.transport import tsocket thrift.transport import ttransport thrift.protocol import tbinaryprotocol  try:   transport = tsocket.tsocket('localhost', 10000)   transport = ttransport.tbufferedtransport(transport)   protocol = tbinaryprotocol.tbinaryprotocol(transport)   client = thrifthive.client(protocol)   transport.open()   client.execute("create table r(a string, b int, c double)")   client.execute("load table local inpath '/path' table r")   client.execute("select * r")   while (1):     row = client.fetchone()     if (row == none):        break     print row    client.execute("select * r")   print client.fetchall()   transport.close() except thrift.texception, tx:   print '%s' % (tx.message) 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -