Cancelling a query leads to an error message, there is no 'KILL' command in sqlite
mjpieters opened this issue · 1 comments
mjpieters commented
On keyboard interrupt during a long-running query, an error message is printed:
Encountered error while cancelling query: near "kill": syntax error
That's because litecli tries to treat sqlite like a remote database and sends a kill <connectionid>
command, which sqlite doesn't support.
Instead, litecli should call the connection.interrupt()
method. No new connection is needed. In main.py:LiteCli.one_iteration()
, replace the last KeyboardInterrupt
exception handler with:
except KeyboardInterrupt:
try:
sqlexecute.conn.interrupt()
except Exception as e:
self.echo(
"Encountered error while cancelling query: {}".format(e),
err=True,
fg="red",
)
else:
logger.debug("cancelled query")
self.echo("cancelled query", err=True, fg="red")
amjith commented
Do you mind making a PR?