[This is the first patch I ever submitted. I hope it complies with
your standards: if it does not, I'll be happy to work on it until it's
fine. I am not sure it qualifies as a tiny change.]
Org-babel allows SQL snippets to be run on a database connection that
can be specified in the source block header using parameters such as
:dbhost, :dbuser, :dbpassword and so forth.
This is very useful, but I'd also like to be able to use symbolic
references to connections defined elsewhere, so that for example one
does not have to specify the password every time, interactively or,
worse, in the .org file itself.
I am also a user of sql.el, that provides a custom variable
`sql-connection-alist', where users can define a mapping between
connection names and connection details.
The patch I'm submitting extends the behavior of
org-babel-execute:sql so that it's possible to specify a new param
:dbconnection containing a connection name, used for looking up
For example, if `sql-connection-alist' contains something like:
(("mydb" (sql-product 'postgres)
Then it's possible to use:
#+begin_src sql :engine postgresql :dbconnection mydb
select foo, bar, baz from mytable