I'm using SQL Server with pyodbc on Linux. ( Web2py 1.99.7 )
I have been trying to force a database timeout in certain methods in my
controller.
I added the following conditional to models/db.py
db_connection_string='mssql://dbuser:pwd@dbserver/DB?DRIVER=FreeTDS'
if request.function == 'test_wait':
db = DAL(db_connection_string, migrate=migrate,
driver_args=dict(timeout=3))
else:
db = DAL(db_connection_string, migrate=migrate, pool_size=100)
and this method to my controller:
def test_wait():
db.executesql("WAITFOR DELAY '00:00:30'")
return 'OK'
I had presumed that the timeout argument would be passed to pyodbc.connect
and I get a timeout error raised. Instead I am seeing 'OK' returned.
Is there a better way to enforce a query timeout?
Chris Guest
--