From: Nathan Neff <nathan.neff@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Org Babel: Submit SQL to command line app & capture results
Date: Sun, 23 Feb 2020 13:49:52 -0600 [thread overview]
Message-ID: <CAC=HedCgFr=pPtU9w0A9TJkEW1eX-4jRz0-SEFJx0yWKKJ6Paw@mail.gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2020-02-23 19:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-23 19:49 Nathan Neff [this message]
2020-02-24 13:13 ` Org Babel: Submit SQL to command line app & capture results John Kitchin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAC=HedCgFr=pPtU9w0A9TJkEW1eX-4jRz0-SEFJx0yWKKJ6Paw@mail.gmail.com' \
--to=nathan.neff@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.