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())
===========테이블 내용이 출력 됨
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())
===========테이블 내용이 출력 됨
댓글
댓글 쓰기