Metadata-Version: 2.1
Name: squeel
Version: 1.0.1
Summary: Format embedded sql (squeel) in python source code files
Author: Ole-Jakob Olsen
Author-email: ole.jakob.olsen@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: sqlparse (>=0.5.3,<0.6.0)
Requires-Dist: tree_sitter (>=0.23.2,<0.24.0)
Requires-Dist: tree_sitter_python (>=0.23.5,<0.24.0)
Description-Content-Type: text/markdown

# Squeel

Format embedded sql (squeel) in python source code files.

Uses [treesitter](https://github.com/tree-sitter/tree-sitter) to query python strings inside the python files starting with a sql comment `-- sql`. Then formats the sql matching strings with the selected formatter, by default `pg_format`, and writes them back to the files.

Uses one of [sqlparse](https://github.com/andialbrecht/sqlparse) or [pg_format](https://github.com/darold/pgFormatter) to format the SQL within the python code.

## Warning

This is an experimental tool.

Running it might change files on your system. I recommend checking your changes into git before running this tool in case it explodes.


## Requirements

`pgFormatter` if using the default format strategy `pg_format`

## Install

`pip install squeel`

## Usage

See `squeel -h`

Example:

```
squeel --glob *.py --format_strategy sqlparse src
```


