【问题标题】:How to access Hive created in EMR cluster from Python如何从 Python 访问在 EMR 集群中创建的 Hive
【发布时间】:2021-06-25 13:14:11
【问题描述】:

我的 hive 表位于 EMR 集群中。 我已经创建了 SSH 隧道:

ssh -L 8888:localhost:8888 -i atlas-emr-xx.pem hadoop@ec2-aa-bbb-ccc-ddd.us-west-2.compute.amazonaws.com

我能够通过 HUE 从 http://localhost:8888/ 创建和访问配置单元表

现在,我需要从 Python 访问配置单元表,并且代码从我的本地机器执行。

我的代码:

from pyhive import hive
import pandas as pd
conn = hive.Connection(host='localhost', port=8888, username='admin',auth='NOSASL')
df = pd.read_sql("SELECT * FROM atlas_emr.us_disease limit 10", conn)
print(df.head())

我得到的错误:

  File "C:\Users\User\PycharmProjects\Hive\venv\lib\site-packages\thrift\transport\TSocket.py", line 143, in read
    message='TSocket read 0 bytes')
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

如果我修改代码:

conn = hive.Connection(host='localhost', port=8888, username='admin')

我得到的错误是:

thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'

我已遵循How to Access Hive via Python? 中提到的所有代码。但没有运气

让我知道是否可以访问在 EMR 集群中创建的 Hive。谢谢。

【问题讨论】:

    标签: python hive amazon-emr pyhive


    【解决方案1】:

    【讨论】:

    • 确切地说,我正在复制雪花表的结构并在 Hive 中创建这些表。但是 Athena 不支持创建表。
    猜你喜欢
    • 2018-01-12
    • 2021-10-22
    • 1970-01-01
    • 1970-01-01
    • 2015-03-21
    • 2018-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多