python读取hive表

  1. 安装thrift_sasl(hive要开启thrift server)

注意pypi上的包有bug,要从github源码包安装

git clone https://github.com/cloudera/thrift_sasl.git
cd thrift_sasl
python setup.py install
  1. 安装pyhive
pip install pyhive
  1. 使用
import pandas as pd
from sqlalchemy.engine import create_engine
eg = create_engine('hive://localhost:10000/default')
pd.read_sql('show tables', eg)

你可能感兴趣的:(python读取hive表)