簡體   English   中英

通過Python進行HIVE hive_utils / hive_service:以特定用戶身份登錄

[英]HIVE via Python hive_utils/hive_service: logging in as a particular user

目前,我可以使用hive_utils在HIVE上成功連接並運行來自Python的查詢,並執行以下操作:

import hive_utils     

query = """ select * from table
            where partition = x 
""" 

conn = hive_utils.HiveClient(server=x, port=10000,db='default')

a = conn.execute(query)
a = list(a)

但是,包含條件語句的查詢(並且適用於HUE),例如:

 query = """ select * from table
             where partition = x
             and app_id = y
 """ 

已返回此錯誤:

HiveServerException:errorCode = 1,message ='查詢返回的非零代碼:1'原因:失敗:執行錯誤從org.apache.hadoop.hive.ql.exec.MapRedTask SQLState ='08S01'返回了代碼1

由於建立連接時我沒有發送任何類型的用戶信息,因此我懷疑該錯誤是由於所設置的任何用戶均可使用的權限類型引起的。

如何確定自己是特定用戶?

請參考以下內容:

回復:失敗:執行錯誤,從org.apache.hadoop.hive.ql.exec.MapRedTask返回代碼-101

最相關的部分是:

Go to this link :
http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_Hive.html


and add

hadoop-0.20-core.jar
hive/lib/hive-exec-0.7.1.jar
hive/lib/hive-jdbc-0.7.1.jar
hive/lib/hive-metastore-0.7.1.jar
hive/lib/hive-service-0.7.1.jar
hive/lib/libfb303.jar
lib/commons-logging-1.0.4.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar


to the class path of your project , add this jars from the lib of hadoop
and hive, and try the code. and also add the path of hadoop, hive, and
hbase(if your are using) lib folder path to the project class path, like
you have added the jars.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM