Connect to Impala using impyla client with Kerberos auth

后端 未结 7 1315
栀梦
栀梦 2021-01-01 03:23

I\'m on a W8 machine, where I use Python (Anaconda distribution) to connect to Impala in our Hadoop cluster using the

7条回答
  •  抹茶落季
    2021-01-01 04:00

    I ran into the same issue but i fixed it by installing the right version of required libraries.

    Install below python libraries using pip:

    six==1.12.0
    bit_array==0.1.0
    thrift==0.9.3
    thrift_sasl==0.2.1
    sasl==0.2.1
    impyla==0.13.8
    

    Below code is working fine with the python version 2.7 and 3.4.

    import ssl
    from impala.dbapi import connect
    import os
    os.system("kinit")
    conn = connect(host='hostname.io', port=21050, use_ssl=True, database='default', user='urusername', kerberos_service_name='impala', auth_mechanism = 'GSSAPI')
    cur = conn.cursor()
    cur.execute('SHOW DATABASES;')
    result=cur.fetchall()
    for data in result:
        print (data) 
    

提交回复
热议问题