jupysql
jupysql copied to clipboard
error converted to print statement
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
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
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.
I'm clearing the issue assignment since it's not a priority