jupysql icon indicating copy to clipboard operation
jupysql copied to clipboard

error converted to print statement

Open edublancas opened this issue 2 years ago • 3 comments

while reviewing a PR, I saw this line:

https://github.com/ploomber/jupysql/blame/51782f1871c63f5c73d33bdbbba8a19ea599df68/src/sql/magic.py#L440

an exception is converted into a print statement, which shouldn't happen. instead, we should raise another exception with whatever message we want to display. because an exception will interrupt execution of the notebook (which we want), while a print statement will not

edublancas avatar May 24 '23 21:05 edublancas

This was an existing flow. if user runs %config SqlMagic.short_errors=True then it should print the exception only. if %config SqlMagic.short_errors=False it would re-raise the original exception.

Also, if I replace the print(e) with raise many of the existing test cases were failing, since now those are raising exceptions. Some issues with the the tables created in conftest.py also. they don't always get dropped after the function exits.

@edublancas

neelasha23 avatar May 25 '23 04:05 neelasha23

thanks a lot for the context!

we need to change this since printing exceptions isn't ideal (doesn't interrupt the program workflow, which you'd expect when your cell fails). but since this is an existing workflow inherited from ipython-sql, it isn't urgent) so let's keep this issue open.

edublancas avatar May 25 '23 20:05 edublancas

I'm clearing the issue assignment since it's not a priority

edublancas avatar May 25 '23 20:05 edublancas