Support Questions
Find answers, ask questions, and share your expertise
Alert: Please see the Cloudera blog for information on the Cloudera Response to CVE-2021-4428

Cannot connect to Hive on HDInsight from python3.5 solution

New Contributor

I have a python3.5 solution which currently access sql server, I need to connect it to hive on HDInsight to query.

I installed hive through pip3 but wile import am getting error as "Hive module not found".

I also was not able to install sasl through pip3, hence couldn't use pyHive as it has a dependency on sasl.

I tried with pyodbc to connect by using the code below:

pyodbc.autocommit = True

con = pyodbc.connect(Driver=Hortonworks Hive ODBC Driver;Host=<host_name>t;Port=10000;HiveServerType=2;AuthMech=3;ThriftTransport=SASL;Schema=Hive_database;UID=user_name;PWD=password, autocommit=True)

but am getting the following error:

pyodbc.Error: ('HY000', '[HY000] [Hortonworks][Hardy] (34) Error from server: connect() failed: errno = 10060. (34) (SQLDriverConnect)')

Please let me know where I am going wrong to connect hive from my python solution.



New Contributor

@Artem Ervits the example you cited uses pyhs2, But pyhs2 is no longer maintained and also it was primarily designed for connecting to Impala and depends on “cloudera” module


fair enough, maybe someone else can step in. Thank you

Have you got solution, i'm getting same problem