# -*- coding:utf-8 -*-
__author__ = 'yangxin_ryan'
import pyhs2
"""
hive客户端
"""
class HiveClient(object):
def __init__(self, host, port, user_name, password, database, authMechanism):
self.conn = pyhs2.connect(host=host,
port=port,
authMechanism=authMechanism,
user=user_name,
password=password,
database=database)
# 查询方法
def query_data(self, sql):
with self.conn.cursor() as cursor:
cursor.execute(sql)
return cursor.fetch()
# 插入方法
def insert_data(self, sql):
with self.conn.cursor() as cursor:
re
Python实现pyhs2的JDCB链接Hive
最新推荐文章于 2024-08-25 09:21:08 发布