Skip to content
Advertisement

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. I know OR statements can be a killer in SQL, but in my database editor, it runs in about 800ms. Why would it take longer in a Lambda function?

I’m using cursor.execute() and passing the SQL statement.
SQL Query:

Any insight would be appreciated!

Advertisement

Answer

Turns out this was an issue with my SQL Server table 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. 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. I appreciate it!

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement