From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nik Clayton Subject: RFC: ob-sql-mode.el: Use sql-mode with Org Babel Date: Sat, 17 Dec 2016 10:33:34 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c06edd86767680543d7616c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cIBN3-00026f-1W for Emacs-orgmode@gnu.org; Sat, 17 Dec 2016 04:33:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cIBN1-0002zv-VF for Emacs-orgmode@gnu.org; Sat, 17 Dec 2016 04:33:37 -0500 Received: from mail-yb0-x22d.google.com ([2607:f8b0:4002:c09::22d]:33074) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cIBN1-0002yq-Oi for Emacs-orgmode@gnu.org; Sat, 17 Dec 2016 04:33:35 -0500 Received: by mail-yb0-x22d.google.com with SMTP id v132so45553842yba.0 for ; Sat, 17 Dec 2016 01:33:35 -0800 (PST) In-Reply-To: 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.org@gnu.org Sender: "Emacs-orgmode" To: Emacs-orgmode@gnu.org --94eb2c06edd86767680543d7616c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hoi, I'd like to solicit feedback on ob-sql-mode.el, https://github .com/nikclayton/org-mode/commit/106b22e9ef4835e15efc47d63aaeee675a1ebb69. This introduces a new Org Babel language, "sql-mode". Unlike the current "sql" language, this one uses sql-mode to manage the interaction with the SQL interpreters, so it supports all the backends that sql-mode supports. It also supports sessions, so you can have different src blocks connected to different databases or configurations in that database. If you have, for example, "sqlite" installed on your system, you can put the following (rather trivial) query in an Org file and evaluate it in the usual way #+BEGIN_SRC sql-mode :product sqlite SELECT 1, 2, 3; #+END_SRC The evaluation result will look like #+RESULTS: : 1|2|3 Org property headers and drawers are also supported, so you could omit the :product argument if you had #+PROPERTY: header-args:sql-mode :product sqlite or a property drawer that looked like :PROPERTIES: :header-args: :product sqlite :END: in scope. =E2=80=8BI'm about to go on vacation for a few weeks, so won't have the cha= nce to respond to feedback in detail until early January, but I wanted to get this out there. I'm releasing this in my capacity as a Google employee, and Google has a copyright assignment on file with the FSF.=E2=80=8B Best, =E2=80=8BN --=20 Google Switzerland GmbH, Identifikationsnummer: CH-020.4.028.116-1 --94eb2c06edd86767680543d7616c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hoi,
=
<= br>

This introduces a = new Org Babel language, "sql-mode". Unlike the current "sql&= quot; language, this one uses sql-mode to manage the interaction with the S= QL interpreters, so it supports all the backends that sql-mode supports.

It also supports sessions, so you can have different src blocks = connected to different databases or configurations in that database.
<= div style=3D"font-family:'arial','helvetica',sans-serif">
If you have, for example, "sqlite" installed on your syste= m, you can put the following (rather trivial) query in an Org file and eval= uate it in the usual way

#+BEGIN_SRC sql-mode :product sqlite
SELECT 1, 2, 3;
#+END_SRC

The evaluation result wil= l look like

#+RESULT= S:
: 1|2|3
=

Org property headers and drawers are also supported, so y= ou could omit the :product argument if you had

#+PROPERTY: header-args:sql-mode :product sqlite=

or a property drawer that looked like

:PROPERTIES:
:header-args: :product sqlite
:END:
<= font face=3D"arial, helvetica, sans-serif">
in scope.<= /div>

=E2=80=8BI'm about to go on vacation for = a few weeks, so won't have the chance to respond to feedback in detail = until early January, but I wanted to get this out there. I'm releasing = this in my capacity as a Google employee, and Google has a copyright assign= ment on file with the FSF.=E2=80=8B

Best, =E2=80=8BN
--=C2=A0
Google Switzerland = GmbH, Identifikationsnummer: CH-020.4.028.116-1
--94eb2c06edd86767680543d7616c--