On Mon, Jun 1, 2020 at 4:16 AM Kyle Meyer <kyle@kyleam.com> wrote:

Daniel Kraus writes:

> I use ob-sql with the :dbconnection param so I don't have my username and password in my org file.
> But often I don't want to use the default database from the dbconnection alist but
> rather specify it explicitly with :database.
> Attached is a patch that fixes this.

Thank you @Daniel
 
[…]
From what I can gather from your description, this looks reasonable.
I'm not an ob-sql user, so perhaps I missing something, but would it
make sense for any connection parameter to take precedence if explicitly
given in the source block header (i.e. something like the patch below)?
[+cc Stefano, who added the :dbconneciton feature.]

I think it makes sense.

(I personally handle cases like those described by Daniel differently,
keeping distinct sql-connection-alist entries for each DB 
param combination I might need, but I can imagine why someone
would want to "override" the database or the host params. 
For port, user and password I have more difficulties imagining a
case where combinations of those params would need override,
but I think @Kyle's generic solution is better)

s.


--
www.stefanorodighiero.net