Cant find pyodbc driver despite install

Solution 1:

I was having same issue. The only workaround I found was to pass the driver file location to the connection request. But the connection/bandwidth is extremely slow when trying to query using pyodbc (compared with using SQL Ops Studio).

import pyodbc
import pandas as pd

driver = '/usr/local/lib/libtdsodbc.so' # Change this to where FreeTDS installed the driver library!

conn = pyodbc.connect(
    driver = driver,
    TDS_Version = '7.3', 
    server = <tunneled server>,
    port = 1433,
    uid = <sql_user_id>,
    pwd = <sql_password>)

crsr = conn.cursor()
table = pd.read_sql(<sql statement>, conn)
crsr.close()
conn.close()