odbcaws-gluepyodbcaws-data-wrangler

How to add odbc driver to aws glue python shell


I want to use pyodbc in aws qlue python shell but it require odbc driver. Currently I get error like "Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)"

Is there any way to install odbc driver into glue


Solution

  • I wanted to do the same, but there is no straight forward way it seems. I guess, you could do it by adding a driver to your self-built Python .wheel or do some kind of run-time downloading of a driver etc.
    I can offer a simpler alternative though:
    pymssql does exactly this for you. It's a Python package that comes with the FreeTDS mssql odbc driver included. So it's just a pip install pymssql to get you started. I've tested it successfully on a Glue Pythonshell Job. You'll just need to add the package to the --additional-python-modules parameter of your job, so that is becomes available. Keep in mind, that you might still need to create a Glue Connection and add it to your Job. Even though you will not use the connection directly, you'll need it for the network connectivity from within your Job to your DB-Server.