From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Oliver_Ve=C4=8Dern=C3=ADk?= Subject: sqlite im-/export Date: Thu, 16 May 2013 19:07:42 +0200 Message-ID: <87r4h6dfa9.fsf@kerstf.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:52840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud1ep-0003bL-6o for emacs-orgmode@gnu.org; Thu, 16 May 2013 13:08:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud1en-0003am-W7 for emacs-orgmode@gnu.org; Thu, 16 May 2013 13:07:59 -0400 Received: from plane.gmane.org ([80.91.229.3]:39504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud1en-0003ad-Q6 for emacs-orgmode@gnu.org; Thu, 16 May 2013 13:07:57 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ud1em-0002Xi-DS for emacs-orgmode@gnu.org; Thu, 16 May 2013 19:07:56 +0200 Received: from 178.112.125.204.wireless.dyn.drei.com ([178.112.125.204]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 May 2013 19:07:56 +0200 Received: from ov by 178.112.125.204.wireless.dyn.drei.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 May 2013 19:07:56 +0200 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, I've got a small test case which I believe is a bug: $ cat t1.sql PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE t1(id integer,product text); INSERT INTO "t1" VALUES(1,'apple pie'); INSERT INTO "t1" VALUES(2,'sugar'); COMMIT; sqlite3 test.sqlite < t1.sql #+BEGIN_SRC sh echo "ID|product" sqlite3 test.sqlite " SELECT * from t1; " #+END_SRC #+RESULTS: | ID | product | | | 1 | apple | pie | | 2 | sugar | | Why are there three columns exported? Tested with Org-mode version 8.0.3 (release_8.0.3-114-gab3f45 @ /home/user/org-mode/lisp/) on GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.4) of 2013-05-13 on myhost? Is it also possible to produce a separator line in the results table? I tried a couple of variations, but nothing worked: echo "|-" echo "-----+----" echo "|-----+----|" I have a couple of csv tables now which are imported with a src block like this: #+BEGIN_SRC sqlite :db test.sqlite :exports none :results silent PRAGMA foreign_keys=off; DROP TABLE IF EXISTS t1; CREATE TABLE t1(id INTEGER, product TEXT); .import t1.csv t1 #+END_SRC But it would be really nice to maintain these data in org tables and convert them on fly maybe just in memory. I couldn't figure out how to achieve this. Has anybody a sample? -- Best, Oliver