通过Python的HIVE hive_utils / hive_service:以特定用户身份登录

时间:2013-11-22 18:45:33

标签: python hive

目前,我可以使用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'原因:FAILED:执行错误返回代码1   org.apache.hadoop.hive.ql.exec.MapRedTask SQLState ='08S01'

由于我在建立连接时没有发送任何类型的用户信息,我怀疑错误是由于可用于任何用户设置的权限类型。

如何将自己标识为特定用户?

1 个答案:

答案 0 :(得分:0)

请参阅以下内容:

Re: FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.MapRedTask

最相关的部分是:

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.