Sqlnbfmt

Latest version: v0.1.8

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 2

0.1.2

Rework the code to ensure it works in a real notebook case.

0.1.0

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

Page 2 of 2

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.