From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cecil Westerhof Subject: Re: A strange problem with org-babel and SQLite Date: Fri, 31 Aug 2018 12:24:33 +0200 Message-ID: References: <20180831111725.3aeba880@lt70.mpip-mainz.mpg.de> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000000f40b90574b899d6" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvgbU-0001L6-8D for emacs-orgmode@gnu.org; Fri, 31 Aug 2018 06:24:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvgbT-0003aE-Fr for emacs-orgmode@gnu.org; Fri, 31 Aug 2018 06:24:36 -0400 Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:33444) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fvgbT-0003a8-Ao for emacs-orgmode@gnu.org; Fri, 31 Aug 2018 06:24:35 -0400 Received: by mail-oi0-x22d.google.com with SMTP id 8-v6so20834510oip.0 for ; Fri, 31 Aug 2018 03:24:35 -0700 (PDT) In-Reply-To: <20180831111725.3aeba880@lt70.mpip-mainz.mpg.de> 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 --0000000000000f40b90574b899d6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2018-08-31 11:17 GMT+02:00 Robert Klein : > Hi Cecil, > > On Fri, 31 Aug 2018 10:47:50 +0200 > Cecil Westerhof wrote: > > > I have a strange problem with org-babel and SQLite. > > > > I have a database that is created with: > > CREATE TABLE "quotes" ( > > quoteID TEXT PRIMARY KEY, > > quote TEXT NOT NULL UNIQUE, > > lastUsed TEXT, > > totalUsed INT DEFAULT 'unused' > > ) > > > > When using: > > #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes > > SELECT lastUsed > > , totalUsed > > FROM quotes > > ORDER BY lastused ASC > > , totalUsed DESC > > LIMIT 40 > > #+END_SRC > > > > Everything is fine. But when I use (add the quote field in the > > select): #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes > > SELECT quote > > , lastUsed > > , totalUsed > > FROM quotes > > ORDER BY lastused ASC > > , totalUsed DESC > > LIMIT 40 > > #+END_SRC > > > > I get: > > executing Sqlite code block... > > Wrote /tmp/babel-27920y_/ob-input-2792BTG > > org-babel-read: End of file during parsing > > > > What could be the problem? > > > > does it work outside of org/babel/emacs, that is, when you use the > query in a command line sqlite session, does it work? =E2=80=9Cquote=E2= =80=9D is also > a function in sqlite, so this might be your issue. > Yes, in sqlite3 and sqlitebrowser it works without problems. In org-babel even 'SELECT *' goes wrong. --=20 Cecil Westerhof --0000000000000f40b90574b899d6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
2018= -08-31 11:17 GMT+02:00 Robert Klein <roklein@roklein.de>:
Hi Cecil,

On Fri, 31 Aug 2018 10:47:50 +0200
Cecil Westerhof <cldwesterhof@= gmail.com> wrote:

> I have a strange problem with org-babel and SQLite.
>
> I have a database that is created with:
>=C2=A0 =C2=A0 =C2=A0CREATE TABLE "quotes" (
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0quoteID=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0TEXT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PRIMARY KEY,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0quote=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0TEXT NOT NULL=C2=A0 UNIQUE,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lastUsed=C2=A0 =C2=A0 =C2=A0 =C2=A0 T= EXT,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0totalUsed=C2=A0 =C2=A0 =C2=A0 =C2=A0I= NT=C2=A0 DEFAULT 'unused'
>=C2=A0 =C2=A0 =C2=A0)
>
> When using:
>=C2=A0 =C2=A0 =C2=A0#+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :co= lnames yes
>=C2=A0 =C2=A0 =C2=A0SELECT=C2=A0 =C2=A0lastUsed
>=C2=A0 =C2=A0 =C2=A0,=C2=A0 =C2=A0 =C2=A0 =C2=A0 totalUsed
>=C2=A0 =C2=A0 =C2=A0FROM=C2=A0 =C2=A0 =C2=A0quotes
>=C2=A0 =C2=A0 =C2=A0ORDER BY lastused=C2=A0 ASC
>=C2=A0 =C2=A0 =C2=A0,=C2=A0 =C2=A0 =C2=A0 =C2=A0 totalUsed DESC
>=C2=A0 =C2=A0 =C2=A0LIMIT=C2=A0 =C2=A0 40
>=C2=A0 =C2=A0 =C2=A0#+END_SRC
>
> Everything is fine. But when I use (add the quote field in the
> select): #+BEGIN_SRC sqlite :db ~/Twitter/twitter.sqlite :colnames yes=
>=C2=A0 =C2=A0 =C2=A0SELECT=C2=A0 =C2=A0quote
>=C2=A0 =C2=A0 =C2=A0,=C2=A0 =C2=A0 =C2=A0 =C2=A0 lastUsed
>=C2=A0 =C2=A0 =C2=A0,=C2=A0 =C2=A0 =C2=A0 =C2=A0 totalUsed
>=C2=A0 =C2=A0 =C2=A0FROM=C2=A0 =C2=A0 =C2=A0quotes
>=C2=A0 =C2=A0 =C2=A0ORDER BY lastused=C2=A0 ASC
>=C2=A0 =C2=A0 =C2=A0,=C2=A0 =C2=A0 =C2=A0 =C2=A0 totalUsed DESC
>=C2=A0 =C2=A0 =C2=A0LIMIT=C2=A0 =C2=A0 40
>=C2=A0 =C2=A0 =C2=A0#+END_SRC
>
> I get:
>=C2=A0 =C2=A0 =C2=A0executing Sqlite code block...
>=C2=A0 =C2=A0 =C2=A0Wrote /tmp/babel-27920y_/ob-input-2792BTG
>=C2=A0 =C2=A0 =C2=A0org-babel-read: End of file during parsing
>
> What could be the problem?
>

does it work outside of org/babel/emacs, that is, when you use = the
query in a command line sqlite session, does it work?=C2=A0 =E2=80=9Cquote= =E2=80=9D is also
a function in sqlite, so this might be your issue.
Yes, in sqlite3 and sqlite= browser it works without problems.
In= org-babel even 'SELECT *' goes wrong.

--
=
Cec= il Westerhof
--0000000000000f40b90574b899d6--