Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Connect to Hive from Python using HiveServer2 JDBC string

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?
Coming from Hortonworks? Activate your account here