* SQL support in Babel
@ 2014-11-20 15:23 Seb
2014-11-21 4:35 ` Nick Dokos
0 siblings, 1 reply; 2+ messages in thread
From: Seb @ 2014-11-20 15:23 UTC (permalink / raw
To: emacs-orgmode
Hi,
The last code block in ob-doc-sql¹ suggests I should be able to place a
number of #+HEADER lines above my SQL source code to specify the
connection string. I am trying to connect to a remote PostgreSQL
server, and after lots of experimentation, the only way this works for
me is to have a single #+HEADER line with a :cmdline with the entire
connection string. All the other header arguments (:database, :dbuser,
etc.), whether in separate lines or in a single one, seem to be
completely ignored. Using Org 8.2.10 and Emacs 24.4.1 from Debian Sid
packages. Is this a problem with this version combination, or does the
functionality of the header arguments depend on the engine being used?
Thanks.
+--- Footnotes ---+
¹ http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html
--
Seb
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: SQL support in Babel
2014-11-20 15:23 SQL support in Babel Seb
@ 2014-11-21 4:35 ` Nick Dokos
0 siblings, 0 replies; 2+ messages in thread
From: Nick Dokos @ 2014-11-21 4:35 UTC (permalink / raw
To: emacs-orgmode
Seb <spluque@gmail.com> writes:
> Hi,
>
> The last code block in ob-doc-sql¹ suggests I should be able to place a
> number of #+HEADER lines above my SQL source code to specify the
> connection string. I am trying to connect to a remote PostgreSQL
> server, and after lots of experimentation, the only way this works for
> me is to have a single #+HEADER line with a :cmdline with the entire
> connection string. All the other header arguments (:database, :dbuser,
> etc.), whether in separate lines or in a single one, seem to be
> completely ignored. Using Org 8.2.10 and Emacs 24.4.1 from Debian Sid
> packages. Is this a problem with this version combination, or does the
> functionality of the header arguments depend on the engine being used?
> Thanks.
>
>
> +--- Footnotes ---+
> ¹ http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html
FWIW, the following worked fine for me:
#+name: my-query
#+header: :engine postgresql
#+header: :dbhost <host>
#+header: :dbuser <user>
#+header: :dbpassword <password>
#+header: :database sheetmusic
#+begin_src sql
SELECT id, creator, title, category, boxnumber FROM music
WHERE id > 300;
#+end_src
#+RESULTS: my-query
| # -*- coding: utf-8 -*- | | | | |
| id | creator | title | category | boxnumber |
|-------------------------+---------+-------------------------------------------------------------------+-----------+-----------|
| 387 | 92 | Lullay my Liking | Christmas | 101 |
| 397 | 303 | Te Deum in B minor | General | 314 |
| ...
GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9) of 2014-08-11
Org-mode version 8.3beta (release_8.3beta-559-g43ca1f @ /home/nick/elisp/org-mode/lisp/)
--
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-21 4:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 15:23 SQL support in Babel Seb
2014-11-21 4:35 ` Nick Dokos
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.