简体   繁体   English

Pyodbc 和 AWS Lambda

[英]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.

相关问题 aws lambda 中没有模块名称 pyodbc - no module name pyodbc in aws lambda 无法将 pyodbc 与 aws lambda 和 API 网关一起使用 - Unable to use pyodbc with aws lambda and API Gateway 无法使用 PyODBC 和 AWS Lambda 连接 RDS SQL 服务器 - Unable to connect with RDS SQL Server using PyODBC & AWS Lambda 在 aws lambda 中找不到用于 python mssql 连接的模块 - no module found pyodbc in aws lambda for python mssql connection 未找到Pyodbc驱动程序/ DSN AWS lambda - 适用于EC2 - Pyodbc driver/DSN not found AWS lambda - works on EC2 无法在AWS Lambda for MS Sql Server中导入PyODBC - Unable to import PyODBC in AWS Lambda for MS Sql Server 使用 python pyodbc 库创建 AWS Lambda function 抛出错误“模块‘pyodbc’没有属性‘connect’ - Creating AWS Lambda function using python pyodbc library throw an error "module 'pyodbc' has no attribute ' connect' 在AWS Lambda中无法使用pydobc在Python 3.6中使用pyodbc连接到SQL Server - Unable to use pydobc to connect to SQL Server using pyodbc in Python 3.6 in AWS Lambda 带有pyodbc的AWS Lambda Python-无法导入模块'lambda_function':/var/task/lib/libodbc.so.2:文件太短 - AWS Lambda Python with pyodbc - Unable to import module 'lambda_function': /var/task/lib/libodbc.so.2: file too short AWS lambda和AWS lambda代理有什么区别? - What is difference in AWS lambda and AWS lambda proxy?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM