0

I would like to feed python output to sqlite input as below:

#+NAME: sqlcmd
#+begin_src python :results output
print("select * from tablename")
#+end_src

#+RESULTS: sqlcmd
: select * from tablename

#+begin_src sqlite :db /media/sf_work/a.db -header -column :var sqlcmd=sqlcmd :results output
sqcmd
#+end_src

It not work now.

What's proper way to use sql command output from python script?

1 Answer 1

0

Read C-hig (org)Noweb Reference Syntax

Example:

#+NAME: foo
#+BEGIN_SRC emacs-lisp :results verbatim
'(+ 1 2)
#+END_SRC

#+RESULTS: foo
: (+ 1 2)

#+BEGIN_SRC emacs-lisp :noweb yes :results verbatim
<<foo()>>
#+END_SRC

#+RESULTS:
: 3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.