[英]Pyodbc and AWS Lambda
I have a fairly simple SQL query that's taking forever to run in my Lambda function and I don't know why.我有一个相当简单的 SQL 查询,它永远在我的 Lambda function 中运行,我不知道为什么。 I know
OR
statements can be a killer in SQL, but in my database editor, it runs in about 800ms.我知道
OR
语句可能是 SQL 中的杀手,但在我的数据库编辑器中,它运行大约 800 毫秒。 Why would it take longer in a Lambda function?为什么 Lambda function 需要更长的时间?
I'm using cursor.execute()
and passing the SQL statement.我正在使用
cursor.execute()
并传递 SQL 语句。
SQL Query: SQL 查询:
select *
from dbo.housing
where App_date >= (select notification_date from dbo.hub_notification_log where object_name = 'HOUSING_ASSIGN')
or Application_Complete >= (select notification_date from dbo.hub_notification_log where object_name = 'HOUSING_ASSIGN')
or Application_Cancel_Date >= (select notification_date from dbo.hub_notification_log where object_name = 'HOUSING_ASSIGN')
or MoveIn_Date >= (select notification_date from dbo.hub_notification_log where object_name = 'HOUSING_ASSIGN')
or Check_Out >= (select notification_date from dbo.hub_notification_log where object_name = 'HOUSING_ASSIGN')
Any insight would be appreciated!任何见解将不胜感激!
Turns out this was an issue with my SQL Server table hub_notification_log
.原来这是我的 SQL 服务器表
hub_notification_log
的问题。 The AWS user account querying the data could not access the table and I ended up having to create a new table with a similar structure and re-apply the permissions for the AWS user account.查询数据的 AWS 用户账户无法访问该表,我最终不得不创建一个具有类似结构的新表并重新为 AWS 用户账户应用权限。 I'm not entirely certain what the difference was between the two tables and permissions, but it seems to work well now.
我不完全确定这两个表和权限之间的区别是什么,但它现在似乎运行良好。 Thanks @mechanical_meat for your insight and attempting to help me out.
感谢@mechanical_meat 的洞察力并试图帮助我。 I appreciate it!
我很感激!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.