Feature request: query formatting
Closed this issue ยท 19 comments
It would be nice to have query formatting button/hotkey
SQLyog, Sequel Pro can do that (also see http://www.dpriver.com/pp/sqlformat.htm)
P.S. also https://github.com/TaoK/PoorMansTSqlFormatter (http://poorsql.com/), http://sqlformat.darold.net/, many more. part of them are opensource
+1: Nice to have
Would very much appreciate such feature. I use Postico to debug queries generated by ORM, and a single button press to convert the huge one-liner into a structured query would be greatly appreciated.
My vote +1
sqlformat.org has an api that can be used if nothing else fits https://sqlformat.org/api/
For what it's worth I am using Alfred with Format SQL Workflow
For the record, https://sequelpro.com/ is using the API approach to format queries.
It is a bit annoying UX, though since every time you want to format the query they prompt a dialog asking to give permission to send the query to external web service. If this to become a feature in this way, there should be a toggle to remember the selection.
I really don't want to use a web API for formatting queries -- code is private data, and shouldn't be shared needlessly with 3rd parties. Also, performance would be unpredictable, and it would require a network connection.
But I just discovered pgFormatter , a Perl based SQL formatting tool for PostgreSQL. Maybe I can use that to format queries!
You can try pgFormatter here: http://sqlformat.darold.net
Yeah, pgFormatter is quite good. I am using it in my Node.js projects, via https://github.com/gajus/pg-formatter.
Would like to see this also. Options on the formatting would be nice (I prefer to work in lowercase, personally.)
+1
Any update on this feature?
I'm using "Automator".
Select sql text and execute created Automator service.
Auto-format or hotkey would be awesome +1 from me
+1
+1
๐
waiting for this feature!!
+1
Hi! I just wanted to let you know that Postico 2 now has query formatting built in!
(We already added the feature a few weeks ago, but I forgot to update this thread. My apologies)
Our solution was to bundle pgFormatter with Postico, so we can format queries locally without sending anything to a web service.
You can trigger the new formatter with the shortcut ctrl-F. By default the current statement is formatted, but you can select more than one statement to format multiple statements at once.
Download the latest preview build of Postico 2 here: https://eggerapps.at/postico2/
Is there a way to disable (or change) ctrl-F to format a query in postico 2? This collides with ctrl-F to move forward one character
Edit: I worked around it by choosing a different key combination for the shortcut per https://eggerapps.at/postico/docs/v1.5.19/keyboard-shortcuts.html