I'm getting following error while connecting to hive database configured with Kerberos using Python pyhive module.
kerberos_service_name should be set if and only if in KERBEROS mode
My Connection code:
import hive from pyhive
con = hive.Connection(host="hostnamexxxxx",port=10001,
database="db_namexxxx",username="usernamexxxx",
auth="KERBEROS",
kerberos_service_name="hive")
Full Error Trace:
File "/xx/xx/site-packages/pyhive/hive.py", line 126, in __init__
raise ValueError("kerberos_service_name should be set if and only if in KERBEROS mode")
ValueError: kerberos_service_name should be set if and only if in KERBEROS mode
Also tried changing the kerberos_service_name to 'attuid@principal' but no luck.
could you please help! Thanks in advance
Just was troubleshooting further the error was raised on line.
if (kerberos_service_name is not None) != (auth == 'KERBEROS'): raise ValueError("kerberos_service_name should be set if and only if in KERBEROS mode")
.
so check the auth output and as I was getting the authentication value from config parser it was including the quotes in word 'KERBEROS' and hence was returning false when compared with string 'KERBEROS'
i.e. 'KERBEROS' == ''KERBOROS''