【发布时间】:2015-06-01 07:14:50
【问题描述】:
我正在尝试通过编写选择查询来通过 pyhs2 访问数据。
import pyhs2
with pyhs2.connect(host='localhost',
port=10000,
authMechanism="PLAIN",
user='hue',
password='',
database='default') as conn:
with conn.cursor() as cur:
print cur.getDatabases()
cur.execute("select * from orders")
print cur.getSchema()
for i in cur.fetch():
print i
这给了我一个错误:
pyhs2.error.Pyhs2Exception:'编译语句时出错:失败:HiveAccessControlException 权限被拒绝。主体 [name=hue, type=USER] 对对象 [type=TABLE_OR_VIEW, name=default.orders] 没有以下权限:[SELECT]'
建议使用以下几个可用答案:
grant SELECT on table orders to user hue
这又给了我一个错误:
yhs2.error.Pyhs2Exception:'处理语句时出错:FAILED:执行错误,从 org.apache.hadoop.hive.ql.exec.DDLTask 返回代码 1。没有权限。主体 [name=hue, type=USER] 对对象 [type=TABLE_OR_VIEW, name=default.orders] 没有以下权限:[SELECT with grant]'
【问题讨论】:
标签: python-2.7 hadoop hive hortonworks-data-platform