⚠️ This post links to an external website. ⚠️
Formatting SQL often raises common questions, like how to capitalize keywords or where to place commas. Dimitri Fontaine has finally introduced
sqlfmt, a gofmt-style SQL formatter that adheres closely to his own formatting preferences developed over years. Unlike other tools,sqlfmtoffers a single, opinionated style with no configuration required. This formatter aligns clause keywords to form a "river," making SQL visually coherent and easy to manage.
sqlfmtincludes a web tool that runs the same Go engine as its CLI counterpart, with a simple command-line interface mirroringgofmt. Additionally, it promises seamless integration with editors like Emacs and Vim. The approach is designed for use with standalone SQL files, ensuring comments are retained and formatted correctly. This practical tool is now available on GitHub and can be tried out live at The Art of PostgreSQL website.
continue reading ontapoueh.org
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.