2

I have built deployment package to connect to a AWS RDS instance via pyodbc, after zipping up and uploading to AWS lambda this connection works.

When trying to connect via an AWS layer, following error is displayed.

"errorMessage": "('01000', \"[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 13 for SQL Server' : file not found (0) (SQLDriverConnect)\")",
  "errorType": "Error",

Tried to change the path for the driver in the odbcinst.ini file, but with no luck

Example of text in odbcinst.ini file

[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/var/task/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2
UsageCount=1
1

1 Answer 1

3

If you're willing to use ODBC Driver 17 then I recommend Alexander's pyodbc layer which you can find on GitHub: https://github.com/alexanderluiscampino/lambda-layers

There's also a discussion of it when it was first being constructed that can be helpful for context: https://gist.github.com/diriver63/b72a954fa0da4851d89e5086aa13c6e8

I've used this myself and had good luck with it. I originally found it after finding that pyodbc has no binary wheels and so AWS SAM can't simply install it: https://github.com/awslabs/aws-sam-cli/issues/1577

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.