We're excited to announce `sqlnbfmt` v0.1.0, a formatting tool that automatically formats SQL code within Jupyter Notebooks. This tool helps maintain clean, consistent SQL code in both standard code cells and magic cells.
Key Features
- Formats SQL queries in both standard code cells and magic cells (`%%sql`)
- Uses AST parsing for precise SQL identification and formatting
- Preserves query placeholders (`%s`, `?`) in parameterized queries
- Supports custom configuration via `config.yaml`
- Maintains SQL comments during formatting
Installation
bash
pip install sqlnbfmt
Usage
Format a notebook by running:
bash
sqlnbfmt path/to/your_notebook.ipynb
For detailed usage instructions, visit our [GitHub repository](https://github.com/flyersworder/sqlnbfmt).
Known Limitations
- Some complex placeholder scenarios may not be formatted correctly
- Partial support for dialect-specific SQL syntax
Contributing
We welcome contributions!
Acknowledgments
- Built with [sqlglot](https://github.com/tobymao/sqlglot) for SQL parsing
- Thanks to our early testers and contributors