New Contributor
Posts: 1
Registered: ‎06-30-2017

How to use python connect impala with kerberos?

I wany to use python connect impala,and the cluster is kerberozied,I can use java jdbc successful ,and the settings like this :






I have try Impyla,but failed, it throws sasl can't start,how can i connect impala with python?

Posts: 418
Topics: 13
Kudos: 67
Solutions: 39
Registered: ‎09-02-2016

Re: How to use python connect impala with kerberos?



Pls try to add the below principal in your connection string, it 'may' help you




hostname - hostname where you have configured impala/hive

REALM - for your kerberos

Cloudera Employee
Posts: 232
Registered: ‎03-23-2015

Re: How to use python connect impala with kerberos?

Hi yueyang,

Can you please share your impyla source code and the error you are getting? That will help me understand why it failed.

New Contributor
Posts: 1
Registered: ‎03-21-2018

Re: How to use python connect impala with kerberos?

I'm trying to establish connection to impala using python's impyla package. However I'm facing issues with the same.


Here is my connection code:


`from impala.dbapi import connect

conn = connect(host="****", port=21050, timeout=100000, use_ssl=True, auth_mechanism='GSSAPI', ca_cert='/opt/cloudera/security/pki/x509/truststore.pem', kerberos_service_name='impala/****', database='some value').cursor()`


I have the below dependencies installed:








But I get the below error:

`AttributeError: 'TSSLSocket' object has no attribute 'isOpen'`


I then tried using thrift==0.9.3 and thrift-sasl==0.2.1

But it gives me:

`TTransportException: TTransportException(message="Could not connect to ('****', 21050)", type=1)`

However when I try connecting via impala shell I'm able to login:

`env -i impala-shell -i **** -d default -k --ssl --ca_cert=/opt/cloudera/security/pki/x509/truststore.pem`


Please help me with what I'm missing here. I have been trying for hours to establish a successful connection to impala.