emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: "Oliver Večerník" <ov@vecernik.at>
Cc: emacs-orgmode@gnu.org
Subject: Re: sqlite im-/export
Date: Fri, 17 May 2013 07:54:53 -0600	[thread overview]
Message-ID: <87txm1k8ya.fsf@gmail.com> (raw)
In-Reply-To: <87a9nucgqf.fsf@kerstf.org> ("Oliver Večerník"'s message of "Fri, 17 May 2013 07:34:00 +0200")

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

Oliver Večerník <ov@vecernik.at> writes:

>> 2. use ":results drawer", and explicitly formatting the results in
>>    Org-mode syntax w/awk
>
> Unfortunately this doesn't work.  The output is always printed to the
> "#+RESULTS:" section and not piped through awk.  But working with
> ":results raw" works perfect for me.  I can even produce a separator
> line in the table now with =print "|-"=.
>
> The only question left, how to import org tables "on the fly" to sqlite,
> to keep everthing in Org mode.  This would also be an interesting
> candidate for an "ob-doc-sh.org" starter I guess.

I may have missed you spelling this out in a previous email, but can you
not import Org tables directly into sqlite code blocks?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: example.org --]
[-- Type: text/x-org, Size: 377 bytes --]

Evaluate this again after evaluating the second block.
#+BEGIN_SRC sqlite :csv :db test.sqlite
  SELECT * from t1;
#+END_SRC

#+RESULTS:
| 1 | apple pie |
| 2 | sugar     |

A manually created Org-mode block.

#+name: manual
| 3 | rhubarb |
| 4 | butter  |

#+BEGIN_SRC sqlite :csv :var data=manual :db test.sqlite :results silent
  .separator ","
  .import $data t1
#+END_SRC

[-- Attachment #3: Type: text/plain, Size: 46 bytes --]


-- 
Eric Schulte
http://cs.unm.edu/~eschulte

  reply	other threads:[~2013-05-17 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 17:07 sqlite im-/export Oliver Večerník
2013-05-16 19:11 ` 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 [this message]
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=87txm1k8ya.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ov@vecernik.at \
    /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).