logoalt Hacker News

adityaathalyeyesterday at 10:28 AM0 repliesview on HN

My “Poor Man’s SQL Workbench” trick is to…

    Use org-babel to execute the queries, from my “sql-queries.org” file.
    Overwrite results into a /tmp file, also an org-mode file, with latest query results (call it anything — “query-result.org”).
    Make psql spit out org-formatted tables for extra oomph.
    Keep that results file open in another buffer (or frame on a big screen, if the table is wide).
    Let Emacs auto-refresh the buffer, when it detects the file has changed.
Et voila! L’établi SQL du pauvre.

Screenshot + sample code in the gist below (a `.org` file, as befits this topic :)

https://gist.github.com/adityaathalye/a6004acd34c683bcc806b2...