简体   繁体   English

AWS Lambda python函数可以连接到SQL Server吗?

[英]Can AWS Lambda python function connect to a SQL Server?

I am working on an item whereby a CloudWatch alarm triggers an SNS notification, which in turn triggers an AWS Lambda Function (in Python). 我正在研究CloudWatch警报触发SNS通知的项目,SNS通知又触发了AWS Lambda函数(在Python中)。 I need the function to connect to a SQL server and run a command. 我需要功能来连接到SQL Server并运行命令。 I have tried with pyodbc and pypyodbc, and so far no luck. 我已经尝试过pyodbc和pypyodbc,到目前为止还算不上运气。 I'm starting to think it won't be possible. 我开始认为这是不可能的。

If not possible in Python, can it be done in C# ? 如果无法在Python中使用C#完成吗?

As of Dec 1, 2016, you can now develop AWS Lambda functions in C# using the .NET Core 1.0 runtime. 自2016年12月1日起,您现在可以使用.NET Core 1.0运行时以C#开发AWS Lambda函数。 As far as connecting to SQL, you can use entity framework core nuget package or use the SQL Server Database Provider and write a wrapper for it. 就连接到SQL而言,您可以使用实体框架核心nuget包或使用SQL Server数据库提供程序并为其编写包装。 See example here . 在这里查看示例

I tried creating a C# lambda function (a month ago for developing Alexa skill) when it first became available and published it on AWS but got some error publishing it. 我尝试创建一个C#lambda函数(一个月前用于开发Alexa技能),并将其首次发布并发布到AWS上,但发布时出现了一些错误。 I posted this question in SO here: Error in publishing an AWS Lambda function built in .NET Core 我在这里的SO中发布了此问题: 发布在.NET Core中构建的AWS Lambda函数时出错

So just refer to that link if you get into some publishing errors. 因此,如果您遇到一些发布错误,只需参考该链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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