1 year ago

#366492

test-img

Epsi95

Running impala-shell from jupyter notebook

I am trying to run impala from jupyter-notebook as follows--

from impala.dbapi import connect
conn = connect(host='xx-xx-xx.xx.com', 
               port=21000,
               auth_mechanism="PLAIN",
               user='xxxx',
               password='xxxx',
              )
cursor = conn.cursor()

But I am getting this error

TTransportException                       Traceback (most recent call last)
<ipython-input-28-6c858acffc1b> in <module>
.
.
TTransportException: Bad status: 3 (b'Unsupported mechanism type PLAIN')

After trying out many things which did not work I thought to run impala command as python subprocess.run but I am getting no output (return code 1)--

r = subprocess.run(['impala-shell', '-q', "select xxx...xxx"],
                  stdout=subprocess.PIPE)
print(r.stdout.decode()) # returncode=1

Also !impala-shell in jupyter giving this error

File "/opt/xxxx/xxxx/xxxx/impala-shell/impala_shell.py", line 262
    print "Query options (defaults shown in []):"
                                                ^
SyntaxError: invalid syntax

Can anyone let me know the problem and guide me on how to resolve this?

python

hive

cloudera

impala

0 Answers

Your Answer

Accepted video resources