cloudera / impyla

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

AuthorizationException when I try to connect db #393

Open allen1106 opened 4 years ago

allen1106 commented 4 years ago

version

And then, I try to set user in cursor, like this:

from impala.dbapi import connect
conn = connect(host='<host>', port=<port>, user='<username>', database='<db>')
cursor = conn.cursor(user='<username>')

It works well

allen1106 commented 4 years ago

I checked the source code, and I found in NOSASL mode, it use the pure socket connection to connect impala without user & password. And then, impala side will fetch the host server user to do authentication. So, if you want to use NOSASL mode, you'd better to be sure your host user have the permission to access the target impala.

But for me, I want to control the user by sqlalchemy uri, so I change my impyla code. Set the user from uri in cursor function. It might be a ugly way, does anyone have another gentle one?

MerouaneBen commented 4 years ago

facing the same issue, don't know if there a clean way to use username and password in URI