# sqlfmt CHANGELOG
All notable changes to this project will be documented in this file.
## [Unreleased]
## [0.21.3] - 2024-04-25
### Bug Fixes
- The Postgres operators for `(NOT) (I)LIKE`, `~~`, `~~*`, `!~~`, `!~~*`, are now supported (these use two tildes where the posix version of these operators use a single tilde) ([#576](https://github.com/tconbeer/sqlfmt/issues/576) - thank you [@tuckerrc](https://github.com/tuckerrc)!).
## [0.21.2] - 2024-01-22
### Bug Fixes
- `{% for %}...{% else %}...{% endfor %}` loops are now supported. Previously, a BracketError was raised if a `for` loop included an `else` tag ([#549](https://github.com/tconbeer/sqlfmt/issues/549) - thank you, [@yassun7010](https://github.com/yassun7010)!).
## [0.21.1] - 2023-12-19
### Bug Fixes
- Fixes a bug where extra indentation was added inside multiline jinja tags if those jinja tags contained a python multiline string ([#536](https://github.com/tconbeer/sqlfmt/issues/500) - thank you [@yassun7010](https://github.com/yassun7010)!).
## [0.21.0] - 2023-10-20
### Bug Fixes
- Adds support for the `map<...>` type declaration syntax from Athena. ([#500](https://github.com/tconbeer/sqlfmt/issues/500) - thank you for the issue and fix, [@benjamin-awd](https://github.com/benjamin-awd)!)
- Fixes a bug where nested dicts inside jinja expressions (e.g., `{{ {'a': {'b': 1}} }}`) could cause parsing errors ([#471](https://github.com/tconbeer/sqlfmt/issues/500) - thank you [@rparvathaneni-sc](https://github.com/rparvathaneni-sc) and [@benjamin-awd](https://github.com/benjamin-awd)!). This fix introduces a dependency on jinja2 > v3.0.
- Fixes a bug in the lexing logic that prevented the walrus operator (`:=`) from being lexed as a single token ([#502](https://github.com/tconbeer/sqlfmt/issues/502) - thank you [@federico-hero](https://github.com/federico-hero)!).
## [0.20.0] - 2023-09-25
### BREAKING CHANGES
- Drops support for Python 3.7. Please upgrade to Python 3.8 or higher.
### Formatting Changes and Bug Fixes
- `any()` and `all()` will no longer get spaces between the function name and the parenthesis, unless they are a part of a `like any ()` or `like all ()` operator ([#483](https://github.com/tconbeer/sqlfmt/issues/483) - thank you [@damirbk](https://github.com/damirbk)!).
- Snowflake's `//` comment markers are now parsed as comments and rewritten to `--` on formatting ([#468](https://github.com/tconbeer/sqlfmt/issues/468) - thank you [@nilsonavp](https://github.com/nilsonavp)!).
- DuckDB's `semi`, `anti`, `positional`, and `asof` joins are now supported. ([#482](https://github.com/tconbeer/sqlfmt/issues/482)).
## [0.19.2] - 2023-07-31
### Bug Fixes
- Fixes a bug where `--exclude` would not follow symlinks when globbing
([#457](https://github.com/tconbeer/sqlfmt/issues/457) - thank you [@jeancochrane](https://github.com/jeancochrane)!).
## [0.19.1] - 2023-07-13
### Bug Fixes
- Fixes a bug where `--fmt: off` comments could cause an error in formatting a file
([#447](https://github.com/tconbeer/sqlfmt/issues/447) - thank you [@ramonvermeulen](https://github.com/ramonvermeulen)!).
- Fixes a bug where some formatting changes were applied to sections of code in
`--fmt: off` blocks.
- Fixes a bug where comments inside of `--fmt: off` would still be formatted.
([#136](https://github.com/tconbeer/sqlfmt/issues/136)).
## [0.19.0] - 2023-06-08
### Bug Fixes
- Relative `exclude` paths defined in `pyproject.toml` files are now evaluated relative to the location of the file, not the current working directory.
Relative paths provided to the `--exclude` option (or env var) are evaluated relative to the current working directory. Files and exclude paths
are now compared as resolved, absolute paths. (Fixes [#431](https://github.com/tconbeer/sqlfmt/issues/431) - thank you [@cmcnicoll](https://github.com/cmcnicoll)!)
- Fixes a bug where a comment like `{#-- comment --#}` would cause a false positive for the
comment safety check. ([#434](https://github.com/tconbeer/sqlfmt/issues/434))
### Formatting Changes
- sqlfmt now supports the `<=>` operator ([#432](https://github.com/tconbeer/sqlfmt/issues/432) - thank you [@kathykwon](https://github.com/kathykwon)!)
## [0.18.3] - 2023-05-31
### Bug Fixes
- fixes a bug where multiple c-style comments (e.g., `/* comment */`) on a single line would cause sqlfmt
to not include all comments in formatted output ([#419](https://github.com/tconbeer/sqlfmt/issues/419) - thank you [@aersam](https://github.com/aersam)!)
### Features
- adds a safety check to ensure comments are preserved in formatted output
## [0.18.2] - 2023-05-31
- fixes a bug where specifying both relative and absolute paths would cause sqlfmt to crash ([#426](https://github.com/tconbeer/sqlfmt/issues/426) - thank you for the issue and fix, [@smcgivern](https://github.com/smcgivern)!)
## [0.18.1] - 2023-05-10
- fixes a bug when lexing `union distinct` tokens ([#417](https://github.com/tconbeer/sqlfmt/issues/417) - thank you, [@paschmaria](https://github.com/paschmaria)!)
## [0.18.0] - 2023-04-19
### Formatting Changes
- the contents of jinja blocks are now indented if the block wraps onto multiple rows ([#403](https://github.com/tconbeer/sqlfmt/issues/403)). This is now the proper sqlfmt style:
```sql
select
some_field,
{% for some_item in some_sequence %}
some_function({{ some_item }}){% if not loop.last %}, {% endif %}
{% endfor %}
```
While in this simple example the new style makes it less clear
that `some_field` and `some_function` are at the
same SQL depth, the formatting of complex files with nested jinja blocks is much improved.
For example:
```sql
{%- for col in cols -%}
{%- if col.column.lower() not in remove | map(
"lower"
) and col.column.lower() not in exclude | map("lower") -%}
{% do include_cols.append(col) %}
{%- endif %}
{%- endfor %}
```
See also [this discussion](https://github.com/tconbeer/sqlfmt/discussions/317). Thank you
[@dave-connors-3](https://github.com/dave-connors-3) and
[@alrocar](https://github.com/alrocar)!
- sqlfmt now supports all [Postgres frame clauses](https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS), not just those that start with `rows between`. ([#404](https://github.com/tconbeer/sqlfmt/issues/404))
## [0.17.1] - 2023-04-12
### Bug Fixes
- fixed a bug where format-off tokens could cause sqlfmt to raise a bracket mismatch error ([#395](https://github.com/tconbeer/sqlfmt/issues/395) - thank you, [@AndrewLaneAtPowerSchool](https://github.com/AndrewLaneAtPowerSchool)!).
## [0.17.0] - 2023-02-24
### Features
- sqlfmt now defaults to reading and writing files using the `utf-8` encoding. Previously, we used Python's default behavior of using the encoding from the host machine's locale. However, as `utf-8` becomes a de-facto standard, this was causing issues for some Windows users, whose locale was set to use older encodings. You can use the `--encoding` option to specify a different encoding. Setting encoding to `inherit`, e.g., `sqlfmt --encoding inherit foo.sql` will revert to the old behavior of using the host's locale. sqlfmt will detect and preserve a UTF BOM if it is present. If you specify `--encoding utf-8-sig`, sqlfmt will always write a UTF-8 BOM in the formatted file. ([#350](https://github.com/tconbeer/sqlfmt/issues/350), [#381]((https://github.com/tconbeer/sqlfmt/issues/381)), [#383]((https://github.com/tconbeer/sqlfmt/issues/383)) - thank you [@profesia-company](https://github.com/profesia-company), [@cmcnicoll](https://github.com/cmcnicoll), [@aersam](https://github.com/aersam), and [@ryanmeekins](https://github.com/ryanmeekins)!)
## [0.16.0] - 2023-01-27
### Formatting Changes + Bug Fixes
- sqlfmt no longer merges lines that contain comments, unless the position of those comments can be preserved ([#348](https://github.com/tconbeer/sqlfmt/issues/348) - thank you, [@rileyschack](https://github.com/rileyschack) and [@IanEdington](https://github.com/IanEdington)!). Accordingly, comments that are inline will stay inline, even if they are too long to fit.
- sqlfmt no longer merges together lines containing multiline jinja blocks unless those lines start with an operator or comma ([#365](https://github.com/tconbeer/sqlfmt/issues/365) - thank you, [@gavlt](https://github.com/gavlt)!).
- fixed a bug where adding a jinja end tag (e.g., `{% endif %}`) to a line could cause bad formatting of everything on that line
## [0.15.2] - 2023-01-23
### Features
- adds support for ARM-based platforms using Docker.
## [0.15.1] - 2023-01-20
### Features
- added a Dockerfile for running sqlfmt in a container. New versions of sqlfmt will include Docker builds pushed to the GitHub Container Registry (thank you [@ysmilda](https://github.com/ysmilda)!).
## [0.15.0] - 2023-01-18
### Formatting Changes + Bug Fixes
- sqlfmt now removes extra blank lines ([#249](https://github.com/tconbeer/sqlfmt/issues/313) - thank you, [@nfcampos](https://github.com/nfcampos)!). Basically, no more than 1 blank line inside queries or blocks; no more than 2 between queries or blocks.
- sqlfmt now supports `create