Hi! I maintain sqlnbfmt, a SQL formatter for notebook cells. We recently added a jupyterlab-code-formatter integration so users can format SQL in notebook cells interactively (toolbar, shortcuts, format-on-save).
It handles:
- SQL in Python strings (
query = "SELECT ...")
- SQL in function calls (
pd.read_sql("SELECT ..."), cursor.execute(...))
%%sql / %sql magic cells
- F-string placeholders (
f"SELECT * FROM {table}")
Setup
pip install sqlnbfmt jupyterlab-code-formatter
# ~/.jupyter/jupyter_notebook_config.py
from sqlnbfmt.jupyterlab_integration import register
register() # or: register(dialect="postgres")
Then "Apply SQL Notebook Formatter" appears in the Format Cell menu.
Request
Would you be open to mentioning sqlnbfmt in the docs as an example of a custom formatter plugin? This could go in the README or a "Third-party formatters" section. Happy to submit a PR if that's preferred.
This would also help users discover that custom formatters are possible — I noticed #231 requesting entry point support, and documenting a working example might be useful context for that discussion.
Hi! I maintain sqlnbfmt, a SQL formatter for notebook cells. We recently added a
jupyterlab-code-formatterintegration so users can format SQL in notebook cells interactively (toolbar, shortcuts, format-on-save).It handles:
query = "SELECT ...")pd.read_sql("SELECT ..."),cursor.execute(...))%%sql/%sqlmagic cellsf"SELECT * FROM {table}")Setup
Then "Apply SQL Notebook Formatter" appears in the Format Cell menu.
Request
Would you be open to mentioning
sqlnbfmtin the docs as an example of a custom formatter plugin? This could go in the README or a "Third-party formatters" section. Happy to submit a PR if that's preferred.This would also help users discover that custom formatters are possible — I noticed #231 requesting entry point support, and documenting a working example might be useful context for that discussion.