本文主要是介绍python通过SSH链接HIVE,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
from sshtunnel import SSHTunnelForwarder
from pyhive import hive
import pandas as pd
server = SSHTunnelForwarder(
ssh_address_or_host=('XX', 2210),
ssh_password='XX',
ssh_username='XX',
remote_bind_address=('XX',10000)
)
server.start()
conn = hive.Connection(host='127.0.0.1', username='XX', port=server.local_bind_port, database='XX')
df = pd.read_sql('select * from XX', conn)
print(df)
server.stop()
这篇关于python通过SSH链接HIVE的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!