This for R, DBI
package. Is there any options or parameters to limit the SQL query time.
couldn't find any options from
dbConnect(drv, ...)
dbGetQuery(conn, statement, ...)
pool
package provides idleTimeout
options, but couldn't find options or parameters to limit query time
Expecting to returns null if exceeds the time limit, so that it would not impact external database
You can use the function withTimeout(QUERY, timeout=TIMEINSECONDS)
from package R.utils
By default it gives you an error if executing whatever you pass in the first parameter executes for more than the timout parameter seconds.
But if you tune parameter onTimeout
you can define " A character specifying what action to take if a timeout event occurs" and TimeoutException
to catch and treat the timeout. See ?withTimeout
examples