Skip to content

Feature Request: Formatted, Multi-Line SQL Output #3

@vladjerca

Description

@vladjerca

I was thinking about a small feature that could make it even better. Right now, when the logger prints a query, it's all on a single line. This works great for simple queries, but as soon as things get complex—with multiple JOINs, WHERE clauses, and subqueries—the output becomes a long, unreadable string.

It would be a huge quality-of-life improvement if the logger could format the SQL into a clean, multi-line structure.

Instead of the current output:

SELECT "posts"."id", "posts"."title", "users"."name" FROM "posts" LEFT JOIN "users" ON "posts"."author_id" = "users"."id" WHERE "posts"."status" = 'published'

We could see something like this:

SELECT
  "posts"."id",
  "posts"."title",
  "users"."name"
FROM "posts"
LEFT JOIN "users" ON "posts"."author_id" = "users"."id"
WHERE
  "posts"."status" = 'published';

This would make debugging complex queries so much faster since you wouldn't have to manually copy and paste the query into a formatter every time.

Is this something you'd consider adding? I think it would be a fantastic enhancement.

Thanks for the great work!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions