[emacs-berlin] A new header arg option for SQL source blocks

Stefano Rodighiero stefano.rodighiero at gmail.com
Thu Sep 26 08:01:28 UTC 2019


Hi all,

thank you for the meeting last evening!

I think my illustration of the patch for Org-mode Babel was a
bit rushed, and that I didn't make the two parts I presented
clear enough. Moreover, someone expressed interest in seeing
the code, so here some explanations.

1. There will be a new feature in org-mode allowing users to specify
a `:dbconnection` header arg for SQL source blocks. This way,
instead of writing connection parameters directly in the header,
which is tedious, error-prone and exposes credentials as plain-text
content, one can use `sql-connection-alist`, a data structure users
can redefine (defined in `sql.el`, practically a dictionary of
names -> connection params, used for example in `sql-connect`).
Org-mode maintainers kindly merged my patch (
https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-sql.el#L179) so it
will available at some point
in the future.

2. "How can I maintain `sql-connection-alist`?"
There are many options.  In my configuration there's a mechanism
that keeps `sql-connection-alist` in sync with `~/.pgpass`.
You can see it starting from here:
https://github.com/larsen/emacs-configuration/blob/master/larsen-sql.el#L70

s.


-- 
www.stefanorodighiero.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailb.org/pipermail/emacs-berlin/attachments/20190926/c1a81e05/attachment.html>


More information about the emacs-berlin mailing list