[IPython-User] Ctrl-C to kill queries in iPython

Dave Himrod dhrod5@gmail....
Mon Nov 28 11:56:23 CST 2011

Yeah I saw that one, not sure if that helps yet because i am still confused about the problem.  

I made a little test and have realized the situation is a little stranger. If i write a simple python script and run/ctrl-c from the terminal on my mac It will stop the script and kill the mysql query fine.  It goes away in show processlist too.  However, if i do this on our cloud centos boxes it does not kill it.  Could this be something about the differences in the shell and how it sends the keyboard interrupt?

from usr.dave import *
local = dbmgr.connection('my.local')
local.select('select sleep(500)')


On Nov 28, 2011, at 12:17 PM, Thomas Kluyver wrote:

> On 28 November 2011 15:43, Dave Himrod <dhrod5@gmail.com> wrote:
> I wrote a database/connection wrapper that can connect to different types of databases (mysql, netezza, vertica and mysql).  A problem we have is that hitting ctrl-c does not necessarily kill the query, sometimes the ctrl-c interrupt isn't even handled until the query returns.  Does anyone have any experience with this?  How can I handle the sigint to stop the query? Is there a generic way for me to tell the databases to kill the queries on their end as well so it does not go zombie, I am hoping it is not specific to each db and is part of the pyodbc or mysqldb packages?
> Is this only a problem in IPython? Have you tried Ctrl-C when a query is running from a standard Python interpreter?
> I haven't done much database programming, but I expect that each database might need a specific command to kill the query. E.g. a quick search turned up this for MySQL: http://price.mit.edu/blog/2010/06/killing-a-mysql-query/
> Thomas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20111128/0364c125/attachment-0001.html 

More information about the IPython-User mailing list