Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Using python to connect to Hive in cloudera

avatar
New Contributor

please i need help , i write this simple code in python but i have problem with packages 

 

from pyhive import hive
import pandas as pd

#Create Hive connection
conn = hive.Connection(host="10.111.22.11", port=10000, username="cloudera" , database="default")

# Read Hive table and Create pandas dataframe
df = pd.read_sql("SELECT * FROM etudiantsv ", conn)
print(df.head())


sur anaconda avec python 2 : erreur 
in __init__(self, host, port, username, database, auth, configuration, kerberos_service_name, password, thrift_transport)
150 elif auth in ('LDAP', 'KERBEROS', 'NONE', 'CUSTOM'):
151 # Defer import so package dependency is optional
--> 152 import sasl
153 import thrift_sasl
154 

ImportError: No module named sasl


in  pycharm python 3.7

i have this error : 


def execute(self, operation, parameters=None, async=False):
^
SyntaxError: invalid syntax

1 REPLY 1

avatar
Super Collaborator

Regarding python 2. If your hive server is configured with SSL, then you should consider installing "sasl" package in python.

 

As about python3, although this is a python question not hive related, usually the issue is on the previous lines, e.g. quotes or parentheses that do not terminate.