remote connection python hive (원격 서버에서 파이썬(python)으로 하이브(hive) 쿼리)

원격 서버에 설치해야할 파이썬 패키지


pip install sasl
pip install thrift
pip install thrift-sasl
pip install pyhive



예제 프로그램

from pyhive import hive
import pandas as pd
import sys

conn = hive.Connection(host="hive 아이피", port=10000, username="hive에 권한을 갖은 OS 사용자")

cursor = conn.cursor()
df = pd.read_sql("SELECT * FROM DB명.테이블명", conn)
print (df.head())


===========테이블 내용이 출력 됨

댓글

이 블로그의 인기 게시물

LSF (GPU 스케쥴링) 명령어 사용법

CentOS 7 리부팅 없이 새 디스크 인식 (find a new disk without reboot)

python에서 hive 사용