通过Python配置单元utils/HIVE\u服务配置单元:以特定用户身份登录

通过Python配置单元utils/HIVE\u服务配置单元:以特定用户身份登录,python,hive,Python,Hive,目前,我可以通过使用配置单元utils在配置单元上成功连接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) 但是,包含条

目前,我可以通过使用配置单元utils在配置单元上成功连接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)
但是,包含条件语句的查询(以及适用于色调的查询),例如:

已返回此错误:

HiveServerException:errorCode=1,message='Query返回非零 代码:1'原因:失败:执行错误从返回代码1 org.apache.hadoop.hive.ql.exec.MapRedTask SQLState='08S01'

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


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

请参考以下内容:

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)

最相关的部分是:

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.