How to resolve the HiveServer2Error Error that occurs while connecting to Impala DB

Viewed 233

I am doing Data comparison Testing between Oracle DB & Impala DB. Before that we need to connect to Impala DB. Impala Db contains Record Sets. I need to fetch those records for comparing with Oracle DB contents which also contains the same records. Her is the Code for Connecting to Impala DB.

import pandas as pd
import cx_Oracle``
from impala.util import as_pandas
import os
import pandas
from impala.dbapi import connect

#impala

IMPALA_HOST = os.getenv('IMPALA_HOST', 'dubuedgdh06q.quintiles.net')
impconn = connect(host='dubuedgdh06q.quintiles.net',
port=21050,
use_ssl=True,
database='edgeuistd_bkp',
user='q1065246',
kerberos_service_name='impala',
auth_mechanism = 'NOSASL')
impcursor = impconn.cursor()
#impcursor.execute('select * from unmask1_prod_3385_crf_futdr')


But the following Error message is displayed upon execution in Jupyter Notebook.


HiveServer2Error                          Traceback (most recent call last)
<ipython-input-16-8e5a9ca22e88> in <module>
     54 auth_mechanism = 'NOSASL')
     55 # Execute using SQL
---> 56 impcursor = impconn.cursor()
     57 #impcursor.execute('select * from unmask1_prod_3385_crf_futdr')
     58 

~\Apps\Anaconda3\lib\site-packages\impala\hiveserver2.py in cursor(self, user, configuration, 
convert_types, dictify, fetch_error)
    122         log.debug('.cursor(): getting new session_handle')
    123 
--> 124         session = self.service.open_session(user, configuration)
    125 
    126         log.debug('HiveServer2Cursor(service=%s, session_handle=%s, '

~\Apps\Anaconda3\lib\site-packages\impala\hiveserver2.py in open_session(self, user, configuration)
   1073                               username=user,
   1074                               configuration=configuration)
-> 1075         resp = self._rpc('OpenSession', req)
   1076         return HS2Session(self, resp.sessionHandle,
   1077                           resp.configuration,

~\Apps\Anaconda3\lib\site-packages\impala\hiveserver2.py in _rpc(self, func_name, request) 991 def _rpc(self, func_name, request): 992 self._log_request(func_name, request) --> 993 response = self._execute(func_name, request) 994 self._log_response(func_name, response) 995 err_if_rpc_not_ok(response)

~\Apps\Anaconda3\lib\site-packages\impala\hiveserver2.py in _execute(self, func_name, request)
   1021             tries_left -= 1
   1022 
-> 1023         raise HiveServer2Error('Failed after retrying {0} times'
   1024                                .format(self.retries))
   1025 

    HiveServer2Error: Failed after retrying 3 times

    Can you help me in resolving this issue?

Thanks,
Mallikarjun
0 Answers
Related