09-26-2017 04:34 PM
So I am having an issue connecting to Impala using the
Here is the test script I am using to test the connection. My end goal is to use Supersets via SQLAlchemy (impyla):
from impala.dbapi import connect conn = connect(host='impalaLoadBalancer',
database='default' port=21050, auth_mechanism='NOSASL', use_ssl='true', ca_cert='/home/centos/supersets/cacerts', user='myUsername',password='myPassword') cursor = conn.cursor() cursor.execute('SELECT * FROM test.mytable LIMIT 100') print cursor.description # prints the result set's schema results = cursor.fetchall()
When I run this I get the error:
Traceback (most recent call last): File "sqltest.py", line 9, in <module> user='myUsername',password='myPassword') File "/home/centos/supersets/venv/lib/python2.7/site-packages/impala/dbapi.py", line 147, in connect auth_mechanism=auth_mechanism) File "/home/centos/supersets/venv/lib/python2.7/site-packages/impala/hiveserver2.py", line 658, in connect transport.open() File "/home/centos/supersets/venv/lib/python2.7/site-packages/thrift/transport/TTransport.py", line 149, in open return self.__trans.open() File "/home/centos/supersets/venv/lib/python2.7/site-packages/thrift/transport/TSSLSocket.py", line 118, in open message=message) thrift.transport.TTransport.TTransportException: Could not connect to impalaLoadBalancer:21050: unknown error (_ssl.c:2782)
I looked at the auth_mechanism and I believe NOSASL is the correct mechanism to use, per the comments here:
https://github.com/cloudera/impyla/blob/master/impala/dbapi.py#L68
I thought it might be a python SSL error. So I checked and double checked ssl. I have :
cyrus-sasl-devel.x86_64 version 2.1.26-21.el7
Here is pip freeze:
alembic==0.9.5 amqp==1.4.9 anyjson==0.3.3 asn1crypto==0.22.0 Babel==2.5.1 backports.ssl-match-hostname==3.5.0.1 billiard==3.3.0.23 bitarray==0.8.1 boto3==1.4.4 botocore==1.5.95 celery==3.1.25 certifi==2017.7.27.1 cffi==1.11.0 chardet==3.0.4 click==6.7 colorama==0.3.9 cryptography==1.9 docutils==0.14 enum34==1.1.6 Flask==0.12.2 Flask-AppBuilder==1.9.4 Flask-Babel==0.11.1 Flask-Cache==0.13.1 Flask-Login==0.2.11 Flask-Migrate==2.0.3 Flask-OpenID==1.2.5 Flask-Script==2.0.5 Flask-SQLAlchemy==2.1 Flask-Testing==0.6.2 Flask-WTF==0.14.2 flower==0.9.1 future==0.16.0 futures==3.1.1 gunicorn==19.7.1 humanize==0.5.1 idna==2.6 impyla==0.13.8 ipaddress==1.0.18 itsdangerous==0.24 Jinja2==2.9.6 jmespath==0.9.3 kerberos==1.2.5 kombu==3.0.37 Mako==1.0.7 Markdown==2.6.8 MarkupSafe==1.0 numpy==1.13.1 pandas==0.20.2 parsedatetime==2.0 ply==3.10 pure-sasl==0.4.0 py==1.4.34 pycparser==2.18 pydruid==0.3.1 PyHive==0.5.0 pykerberos==1.1.14 pytest==3.2.2 python-dateutil==2.6.0 python-editor==1.0.3 python-openid==2.2.5 pytz==2017.2 requests==2.17.3 s3transfer==0.1.11 sasl==0.2.1 simplejson==3.10.0 six==1.11.0 SQLAlchemy==1.1.14 SQLAlchemy-Utils==0.32.14 sqlparse==0.2.3 superset==0.19.1 thrift==0.9.3 thrift-sasl==0.2.1 thriftpy==0.3.9 tornado==4.2 urllib3==1.21.1 Werkzeug==0.12.2 WTForms==2.1
I have been able to successfully connect using a JDBC String via a Java program:
jdbc:impala://impalaLoadBalancer:21050/default;AuthMech=4;SSL=1;SSLKeyStore=/home/centos/supersets/cacerts;UID=myUsername;PWD=
myPassword
Auth Mech 4 is just: User Name and Password with SSL
I have also tried changing the username/password, the only thing that seems to give me different errors is the auth_mechanism.