Auth with NOSASL doesn't work in latest PyHive 0.6.1
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 545
- PR merge metrics
- No merged PRs in 30d
Description
And this did work in PyHive 0.1.8.
I use thrift 0.11.0 and thrift-sasl 0.3.0.
Consider the following code in Python 2.7:
```python
import contextlib
def checkNosasl():
from pyhive import hive
with contextlib.closing(hive.connect(host='remote_host', port=10000, auth='NOSASL')) as conn:
with contextlib.closing(conn.cursor()) as cur:
cur.execute("SELECT 1 from dual")
print cur.fetchall()
if __name__ == "__main__":
checkNosasl()
```
I run it from my machine and I connect to Hive DB that is run on another machine. **My username has nothing to do with that remote machine**.
The code above didn't work with 0.6.1 and works just fine with 0.1.8.
I tried to investigate the issue, I think it is because the following change:
At hive.py Connection._ _init_ _() method the first line is
`username = username or getpass.getuser()`
and inside the body of Connection._ _init __():
`open_session_req = ttypes.TOpenSessionReq(
client_protocol=protocol_version,
configuration=configuration,
username=username,
)`
while in 0.1.8 version this snippet is
`open_session_req = ttypes.TOpenSessionReq(
client_protocol=ttypes.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1,
configuration=configuration,
)`
It is ok to factor out client_protocol, but it is not ok to pass username _at least in_ NOSASL case. My username is not relevant.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.