emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] sql code block #+BEGIN_SRC sql :tangle qry/testthis.sql :cmdline "-v


From: Cook, Malcolm
Subject: [O] sql code block #+BEGIN_SRC sql :tangle qry/testthis.sql :cmdline "-v this=\\'asdf\\'"
Date: Tue, 3 Sep 2019 23:42:44 +0000

 

I am surprised by the level of quoting seemingly required by org-mode to pass a variable to psql in :cmdline

 

The following works:

 

#+PROPERTY: header-args:sql :engine postgresql :dbhost  my.host :database mydb :dbuser me

#+PROPERTY: header-args:sql+ :tangle no :results table :exports both

#+BEGIN_SRC sql :cmdline "-v this=\\'that\\'"

select :this as this

#+END_SRC

 

#+RESULTS:

| this |

|------|

| that |

 

 

However, I found no other quote/escape combination to work.  At first I expected to work:

 

:cmdline "-v this=\'asdf\'"

 

… but it is an error.

 

Is this expected and consistent with other emacs behavior? 

 

Is there another, perhaps simpler, way to pass variables to postgresql  code block in org ob-sql?

 

Thanks,

 

Malcolm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]