emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Oliver Večerník" <ov@vecernik.at>
To: emacs-orgmode@gnu.org
Subject: sqlite im-/export
Date: Thu, 16 May 2013 19:07:42 +0200	[thread overview]
Message-ID: <87r4h6dfa9.fsf@kerstf.org> (raw)

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

             reply	other threads:[~2013-05-16 17:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 17:07 Oliver Večerník [this message]
2013-05-16 19:11 ` sqlite im-/export Eric Schulte
2013-05-16 20:03   ` Oliver Večerník
2013-05-16 20:48     ` Eric Schulte
2013-05-17  4:35       ` Oliver Večerník
2013-05-17  5:34       ` Oliver Večerník
2013-05-17 13:54         ` Eric Schulte
2013-05-18  6:21           ` Oliver Večerník
2013-05-18 14:10             ` Eric Schulte

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r4h6dfa9.fsf@kerstf.org \
    --to=ov@vecernik.at \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).