Re: interrupting a running sql statement in python
Posted in 2006
On Tue, 2006-12-19 at 13:31 -0600, Andrew Ford wrote: > Does anyone know if any of the Informix modules for Python allow you to > interrupt or time out a long running query? ESQL/C appears to have this > functionality via the sqlbreakcallback () function. > > Thanks, > > Andrew All right, I have investigated how this works in ESQL/C and how this fits into the Python interpreter. It should be fairly easy to implement unconditional interrupts and timeouts along the following lines: 1) Interrupt: Implement a boolean cursor attribute that indicates whether a SIGINT during a cursor.execute or cursor.fetchXXX will attempt to interrupt the SQL operation. 2) Timeout: Implement a numeric cursor attribute that defines how long an execute or a fetch is allowed to run before it is automatically interrupted. Things get much more complicated if you need to have Python functions decide on whether to interrupt or not, either in a signal handler function or a timeout callback function. I'd need a financial incentive for implementing such a feature, while the unconditional interrupt and timeout are easy enough to be done in my spare time. ;) Best regards, -- Carsten Haese | Phone: (419) 861-3331 Software Engineer | Direct Line: (419) 794-2531 Unique Systems, Inc. | FAX: (419) 893-2840 1687 Woodlands Drive | Cell: (419) 343-7045 Maumee, OH 43537 | Email: carsten@uniqsys.com