cloudera / impyla

Python DB API 2.0 client for Impala and Hive (HiveServer2 protocol)
Apache License 2.0
731 stars 248 forks source link

Not able to SELECT, apparent lack of privileges but the user has them. #272

Open SaucePan1 opened 7 years ago

SaucePan1 commented 7 years ago

I am using impyla to connecto to Hive. I have set the following:

from impala.dbapi import connect conn = connect(host='atgrzsl2654.avl01.avlcorp.lan', port=10000, user='my_user', auth_mechanism="PLAIN", database='my_database') cursor = conn.cursor() cursor.execute('SHOW TABLES')

And when I print the tables I can see the tables I have created, the problem is when I run

cursor.execute('SELECT * FROM my_table LIMIT 100')

I encounter the error:

HiveServer2Error: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: Principal [name=my_user, type=USER] does not have following privileges for operation QUERY [[SELECT] on Object [type=TABLE_OR_VIEW, name=my_table]]

Which is very strange since I can access the tables outside python. What am I doing wrong?

I have look at the hive config and I have found the following, so it seems that I am using the right authentication mechanism.

<property>
  <name>hive.server2.authentication</name>
  <value>NONE</value>
</property>

<property>
  <name>hive.server2.authentication.spnego.keytab</name>
  <value>HTTP/_HOST@EXAMPLE.COM</value>
</property>

<property>
  <name>hive.server2.authentication.spnego.principal</name>
  <value>/etc/security/keytabs/spnego.service.keytab</value>
</property>
iusshpandeh commented 3 years ago

How did you solve this issue? I am facing the same issue now.