jupysql icon indicating copy to clipboard operation
jupysql copied to clipboard

Auto-format plugins don't work for SQL in Jupyter notebooks

Open jaanli opened this issue 1 year ago • 4 comments

What happens?

Hi! This has been an amazing teaching tool.

Unfortunately we are unable to figure out how to debug Visual Studio Code formatting extensions to have them work in cells decorated with %%sql cell magics. E.g. this extension doesn't work: https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.duckdb-sql-tools nor other formatters.

P.S. Fun anecdote, last year I started my class at Princeton with this notebook + Jupysql: https://github.com/onefact/datathinking.org-codespace/blob/main/notebooks/princeton-university/week-1-visualizing-33-million-phone-calls-in-new-york-city.ipynb

Now Motherduck has used the same dataset + SQL code written thanks to this in their blog! https://motherduck.com/blog/introducing-column-explorer/

To Reproduce

Try to use the formatting shortcut, alt + cmd + f to format, and nothing happens.

OS:

MacOS

JupySQL Version:

Latest

Full Name:

Dr. Jaan Lı

Affiliation:

University of Tartu / One Fact Foundation

jaanli avatar Apr 21 '24 13:04 jaanli

Hi, I'm unsure about the issue you're reporting. It sounds like a VSCode question (?)

edublancas avatar Apr 22 '24 02:04 edublancas

Yes I think so! Thank you @edublancas - what formatter would you recommend for JupySQL cells?

jaanli avatar Apr 22 '24 14:04 jaanli

I only use JupySQL via Jupyter, so I don't know if there is any VSCode extension that works.

edublancas avatar Apr 22 '24 16:04 edublancas

Ah okay - this is via Jupyter as well; sorry for being unclear.

How would you recommend using a formatter in Jupyter, independent of Visual Studio Code? I can reproduce this issue in the Jupyter notebook interface, in a Colaboratory notebook, or WASM Jupyter notebook if needed 🙏

jaanli avatar Apr 22 '24 17:04 jaanli