简体   繁体   中英

Unable to import PyODBC in AWS Lambda for MS Sql Server

I want to connect to MS SQL Server using pyodbc on AWS Lambda. When i deploy the package, i get an error:

No module named "pyodbc".

I have added the following files in the Lambda package:

  • pyodbc.cp36-win32
  • pyodbc-4.0.16.dist-info
  • dbaccess.py

dbaccess.py contains the working code with pyodbc.

What am I missing to deploy pyodbc on AWS Lambda so I can connect to SQL Server?

Amazon provides a guide on how to build packages for deployment here: https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html

The being said, you can short-cut the process for pyodbc for Lambda here: https://github.com/Miserlou/lambda-packages/tree/master/lambda_packages/pyodbc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM