-
Notifications
You must be signed in to change notification settings - Fork 65
Document sqlnbfmt as a custom SQL formatter plugin #388
Copy link
Copy link
Open
Description
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/%sqlmagic 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels