0

I have a situation where a pymysql query may take longer than the amount of time allowed. Ideally, the call aborts with an exception after a set number of seconds or mills, so it can be reported and move forward.

Is there a way to limit the amount of time a query can execute for a given session/connection?

darren
  • 579
  • 8
  • 23

1 Answers1

0

based on this answer you can do:

with timeout(seconds=3):
    cursor.execute('your sql query')
Panagiotis Simakis
  • 1,245
  • 1
  • 18
  • 45