To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:
Python: 3.11
pyodbc: 4.0.39
OS: Windows
DB: SQL Server
driver: SQL Server ODBC Driver
Issue
The cursor's SQL_ATTR_QUERY_TIMEOUT gets applied when the cursor is instaniated and it uses whatever timeout the connection has at that time... ok. But the problem is there's no way to change this. I thought changing the connection's timeout would do it but that's not the case after looking at the source code.
I'm running stuff inside AWS lambda and I want to the timeout to be a few seconds less than the "remaining execution time". Lambda lets you run for up to 15 minutes, so I want my query time to be reflective of the remaining time.
Is there at least a workaround where I can call SQLSetStmtAttr with SQL_ATTR_QUERY_TIMEOUT on the cursor object from python?
Please first make sure you have looked at:
Environment
To diagnose, we usually need to know the following, including version numbers. On Windows, be sure to specify 32-bit Python or 64-bit:
Issue
The cursor's SQL_ATTR_QUERY_TIMEOUT gets applied when the cursor is instaniated and it uses whatever timeout the connection has at that time... ok. But the problem is there's no way to change this. I thought changing the connection's timeout would do it but that's not the case after looking at the source code.
I'm running stuff inside AWS lambda and I want to the timeout to be a few seconds less than the "remaining execution time". Lambda lets you run for up to 15 minutes, so I want my query time to be reflective of the remaining time.
Is there at least a workaround where I can call SQLSetStmtAttr with SQL_ATTR_QUERY_TIMEOUT on the cursor object from python?