emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org Babel: Submit SQL to command line app & capture results
@ 2020-02-23 19:49 Nathan Neff
  2020-02-24 13:13 ` John Kitchin
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Neff @ 2020-02-23 19:49 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

Hello all,

I would like to use org-babel to have SQL code like this:

* Some heading

#+begin_src something
SELECT COUNT(*) FROM some_table;
#+end_src

I would like to have the code highlighted as SQL.  However, I'm not reading
from a DB matching the requirements of
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html

What I would like to do when I run the code above is to:
1) simply take the contents of the code and push it into a tmp file
2) run a shell program on the tmp file:
impala-shell -f tmp file.txt
3) Capture the STDOUT from the above command

How would I do this using org-babel?  Create a new "language"?
Are there already similar implementations which basically take the contents
of the source code, save to a temp file then execute a standalone program
and capture results?

Again, I would like to have SQL style highlighting.

Thanks for pointers -- I'm sure this is something that's reasonably easy
to implement - I just don't want to start off on the wrong foo.t
--Nate

[-- Attachment #2: Type: text/html, Size: 1486 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-24 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-23 19:49 Org Babel: Submit SQL to command line app & capture results Nathan Neff
2020-02-24 13:13 ` John Kitchin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).