Skip to content

More information and care on KeyboardInterrupt #1239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Features
--------

* Support SSL query parameters on DSNs.
* More information and care on KeyboardInterrupt.

Internal
--------
Expand Down
10 changes: 9 additions & 1 deletion mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,11 +774,19 @@ def one_iteration(text=None):
status_str = str(status).lower()
if status_str.find("ok") > -1:
logger.debug("cancelled query, connection id: %r, sql: %r", connection_id_to_kill, text)
self.echo("cancelled query", err=True, fg="red")
self.echo(f"Cancelled query id: {connection_id_to_kill}", err=True, fg="blue")
else:
logger.debug(
"Failed to confirm query cancellation, connection id: %r, sql: %r",
connection_id_to_kill,
text,
)
self.echo(f"Failed to confirm query cancellation, id: {connection_id_to_kill}", err=True, fg="red")
except Exception as e:
self.echo("Encountered error while cancelling query: {}".format(e), err=True, fg="red")
else:
logger.debug("Did not get a connection id, skip cancelling query")
self.echo("Did not get a connection id, skip cancelling query", err=True, fg="red")
except NotImplementedError:
self.echo("Not Yet Implemented.", fg="yellow")
except OperationalError as e:
Expand Down