Hi Michael,

Yes, I think this is a way to my previous question. But what I really want to achieve is to loop through a list of server names and execute a script on them.

Say I have 20 different database server. How can I do a loop with each server?


Regards,
David


On Wed, Dec 6, 2017 at 5:34 PM Michael Welle <mwe012008@gmx.net> wrote:
Hello,

Xi Shen <davidshen84@gmail.com> writes:

> Hi,
>
> http://orgmode.org/manual/var.html
>
> This wiki explains how to use variable inside a src block. But I wonder if
> it is possible to specify variable to the variables in the src definition.
>
> E.g. for the sql src block, I want to execute a script on different server.
> I want to define a variable for the ":dbhost" variable.
did you think about something like this?


(setq hmw/dbhost "db1")

#+BEGIN_SRC sql :dbhost (symbol-value 'hmw/dbhost) :dbuser weather :database environment :engine postgresql
select time, temperature from weather limit 20;
#+END_SRC

Regards
hmw