Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Reformat SQL queries for ease of reading #1237

Merged
merged 3 commits into from
Jan 26, 2025

Conversation

nikclayton
Copy link
Contributor

The database queries in the @query annotations were in a range of different styles which made them difficult to read, and difficult to write new ones in a consistent style.

Fix this.

Write a new tool, sqlfmt. This processes the DAO files looking for @Query(...) annotations. It extracts the SQL from those annotations and calls sqlfluff (https://github.com/sqlfluff/sqlfluff, which must be installed separately) to lint and fix formatting issues in the SQL.

The file is re-written with the newly formatted SQL queries.

The database queries in the @query annotations were in a range of
different styles which made them difficult to read, and difficult to
write new ones in a consistent style.

Fix this.

Write a new tool, `sqlfmt`. This processes the DAO files looking for
`@Query(...)` annotations. It extracts the SQL from those annotations
and calls `sqlfluff` (https://github.com/sqlfluff/sqlfluff, which must
be installed separately) to lint and fix formatting issues in the SQL.

The file is re-written with the newly formatted SQL queries.
@nikclayton nikclayton merged commit c81bb02 into pachli:main Jan 26, 2025
24 checks passed
@nikclayton nikclayton deleted the sqlfmt branch January 26, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant