all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug with org-babel/sqlite?
@ 2016-09-14  8:48 Dushyant Juneja
  2016-09-14 19:00 ` Fwd: " Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Dushyant Juneja @ 2016-09-14  8:48 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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

Hi,

Looks like I stumbled upon a bug with org-babel and sqlite. I have the
following in my org file. PFA the bug description (bug.org). The essence is
that sqlite queries work with :results verbatim, but not otherwise. Any
ideas on how to get past this?

This is with emacs 24.5.2, RHEL6.

Dushyant

[-- Attachment #2: bug.org --]
[-- Type: application/octet-stream, Size: 1623 bytes --]

#+TITLE: Bug report
#+PROPERTY: mkdirp yes

* Setup
Need to exec this first in order for sqlite src to be exec'ed.
#+BEGIN_SRC emacs-lisp :results silent
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (sh         . t)
   (sqlite     . t)
   (C          . t)))
#+END_SRC

* CSV files
For a sample, I have the following CSV file:

#+BEGIN_SRC csv :tangle sample1.csv
Year,Make,Model,Description,Price
1997,Ford,E350,"ac, abs, moon",3000.00
1999,Chevy,"Venture ""Extended Edition""","",4900.00
1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00
1996,Jeep,Grand Cherokee,"MUST SELL!
air, moon roof, loaded",4799.00
#+END_SRC

* Playing with SQL
Now stat playing with SQL. 

The following snippet works fine:
#+BEGIN_SRC sqlite :db bug.db :exports results :results verbatim
DROP TABLE IF EXISTS cars;
CREATE TABLE cars (Year,Make,Model,Description,Price);
.mode csv
.separator ","
.import sample1.csv cars
SELECT * FROM cars;
#+END_SRC

#+RESULTS:
: Year,Make,Model,Description,Price
: 1997,Ford,E350,"ac, abs, moon",3000.00
: 1999,Chevy,"Venture ""Extended Edition""","",4900.00
: 1999,Chevy,"Venture ""Extended Edition, Very Large""","",5000.00
: 1996,Jeep,"Grand Cherokee","MUST SELL!
: air, moon roof, loaded",4799.00


However, the following fails, just because =:results= is set to default.
# BEGIN_SRC sqlite :db sample.db :exports results :results verbatim
#+BEGIN_SRC sqlite :db sample.db :exports results
DROP TABLE IF EXISTS cars;
CREATE TABLE cars ( Year,Make,Model,Description,Price );
select * from cars;
.mode csv
.import sample1.csv cars
SELECT * FROM cars;
#+END_SRC

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-15  6:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-14  8:48 bug with org-babel/sqlite? Dushyant Juneja
2016-09-14 19:00 ` Fwd: " Kaushal Modi
2016-09-14 21:16   ` Nick Dokos
     [not found]     ` <CAFyQvY34G=TSsQy-=hmB3ot-2CvpuwD66me6LemvfZaxr_8fjQ@mail.gmail.com>
2016-09-15  6:14       ` Dushyant Juneja

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.