Search code examples
pythonodbcmlrun

Issue with ODBC in MLRun Jupyter (installation SSL, Kerberos, ODBC)


I would like to access from MLRun jupyter to bigdata platform via ODBC with SSL and Kerberos and use this sample/easy code.

import pyodbc
import pandas as pd

conn=pyodbc.connect("DSN=TST", autocommit=True)
crsr = conn.cursor()
crsr.execute('show databases;')
print(crsr.fetchall())
conn.close()

I would like to install relevant version of libraries for SSL, Kerberos, ODBC and define DNS name 'TST'. Do you know root user for MLRun Jupyter Notebook (default password was changed)?


Solution

  • The SSL and Kerberos are in MLRun Jupyter, you can directly use command 'kinit'.

    It is much easier to use Impala instead of ODBC. You have to install only python package impyla and the similar sample will work:

    from impala.dbapi import connect
     
    con = connect(host='192.168.250.23', port=21050, use_ssl=True, database='test', user='username', kerberos_service_name='impala', auth_mechanism = 'GSSAPI')
        
    cur = con.cursor()
    cur.execute('show databases;')
    print(cur.fetchall())
    cur.close()
    con.close()