My code:
import pyodbc
connection = pyodbc.connect("DRIVER={SQL Server};SERVER=MYSERVER;DATABASE=mydatabase;Trusted_Connection=yes")
connection.timeout = 3
cursor = connection.cursor()
results = cursor.execute("SELECT * FROM someLongTable").fetchall()
The timeout argument is ignored and the query runs for as long as it takes to complete (several minutes).
It's the same problem that this guy had, but the solution that worked for him didn't work for me. Now, unlike him I'm on Windows (both the client and the server are Windows machines). I know that signal doesn't work well on Windows and that sometimes people use signal to write timeout functions, so maybe Windows is the problem here? Could that be it? If so, is there any workaround?
(Python 2.7.9, pyodbc 3.0.7, Windows Server 2012, MSSQL 2012)