From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Org Babel: Submit SQL to command line app & capture results Date: Sun, 23 Feb 2020 13:49:52 -0600 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009c423c059f438f59" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:48898) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5xGR-0003O5-L3 for emacs-orgmode@gnu.org; Sun, 23 Feb 2020 14:50:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5xGQ-0007uG-9E for emacs-orgmode@gnu.org; Sun, 23 Feb 2020 14:50:07 -0500 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:38648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5xGQ-0007tw-2o for emacs-orgmode@gnu.org; Sun, 23 Feb 2020 14:50:06 -0500 Received: by mail-il1-x129.google.com with SMTP id f5so5988508ilq.5 for ; Sun, 23 Feb 2020 11:50:05 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode --0000000000009c423c059f438f59 Content-Type: text/plain; charset="UTF-8" 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 --0000000000009c423c059f438f59 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello all,

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

* Some heading

#+begin_src something
SE= LECT COUNT(*) FROM some_table;
#+end_src

I would like to have the code highlighted as SQL.=C2=A0 However, I'm n= ot reading
from a DB matching the requirements of=C2=A0http= s://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html=C2=A0<= /div>

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:
impal= a-shell -f tmp file.txt
3) Capture the STDOUT from the above comm= and

How would I do this using org-babel?=C2=A0 Cre= ate a new "language"?
Are there already similar impleme= ntations which basically take the contents
of the source code, sa= ve to a temp file then execute=C2=A0a standalone program
and capt= ure results?

Again, I would like to have SQL style= =C2=A0highlighting.

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
--0000000000009c423c059f438f59--