Support Questions
Find answers, ask questions, and share your expertise

Connect to Hive from Python using HiveServer2 JDBC string

Highlighted

Connect to Hive from Python using HiveServer2 JDBC string

New Contributor

I am currently using PyHive python package to connect to Hive. When using this package I am not able to provide HiveServer2 JDBC string as the host. I can only provide one host name.

jdbc:hive2://server1:2181,server2:2181,server3:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

Is there a way to connect to Hive from Python using the JDBC string? Does any other Python package allow that? Please provide samples.

Current code:

 

 

from pyhive import hive

hive_conn = hive.Connection(host=hive_host, configuration {'serviceDiscoveryMode':'zooKeeper','zooKeeperNamespace':'hiveserver2'})

 

 

Also tried using pyodbc but could not figure out the correct driver for Hortonworks Hadoop distribution.
Need a working code for Linux distribution

Don't have an account?