From: tsd@tsdye.com (Thomas S. Dye)
To: Alexander Vorobiev <alexander.vorobiev@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [Babel][R] Inclusion of multi-line named code blocks in R code
Date: Mon, 07 Oct 2013 05:42:27 -1000 [thread overview]
Message-ID: <m14n8t6qak.fsf@poto.myhome.westell.com> (raw)
In-Reply-To: <CAGOCFPVPGTDVNKME=qtRXp8OAsv1zthcU0jjT+mpR+wB+YXymw@mail.gmail.com> (Alexander Vorobiev's message of "Wed, 18 Sep 2013 19:43:09 -0500")
Hi Alex,
I made a first draft of the Babel SQL documentation for Worg. See
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html
Please edit or augment as you see fit.
I believe you need FSF papers to contribute to ob-sql.el. If you have
those, then by all means, please add Netezza support and get the ball
rolling on sessions.
All the best,
Tom
Alexander Vorobiev <alexander.vorobiev@gmail.com> writes:
> Hi Tom,
>
> Unfortunately I can't have pure SQL output in my org files for two reasons:
>
> 1. The result set I am dealing with for this particular problem is about
> 20000 records
> 2. My SQL server (Netezza, "big data appliance") is not supported by
> Babel-SQL. I configured sql-mode to work with Netezza but session-based SQL
> is not supported by Babel either. I started adding support for SQL sessions
> to ob-sql.el and it kind of works but the results I am getting are
> inconsistent and only a small subset of header parameters is supported. Of
> course I haven't tested is with any other database. I can share what I've
> done if anybody is interested.
>
> Regards,
> Alex
>
>
> On Wed, Sep 18, 2013 at 5:27 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> Aloha Alex,
>>
>> My work flow in this situation evaluates the SQL to create an Org-mode
>> table, which serves as input to the R source code block.
>>
>> For me, seeing the SQL output in a table is a sanity check.
>>
>> hth,
>> Tom
>>
>> Alexander Vorobiev <alexander.vorobiev@gmail.com> writes:
>>
>> > I have R code which submits SQL statements to a database server. Since
>> the
>> > SQL is rather complex, I want to put it into a separate code block in
>> order
>> > to have proper formatting, syntax highlighting, etc:
>> >
>> > #+name: long-sql
>> > #+begin_src sql
>> > select *
>> > from many, tables
>> > where
>> > complex_condition1 = 1,
>> > complex_condition2 = 2
>> > #+end_src
>> >
>> > * Load the data to R session
>> > #+begin_src R :session *R* :noweb yes
>> > result <- submit_query('<<long-sql>>')
>> > #+end_src
>> >
>> > Unfortunately, the R block doesn't work. When I open the file generated
>> by
>> > Babel, I see this:
>> >
>> > result <- submit_query('select *
>> > result <- submit_query('from many, tables
>> > etc
>> >
>> > instead of the one R submit_query call with my SQL statement as an
>> > argument. Is there anything I can do to achieve that?
>> >
>> > Thanks
>> > Alex
>> > I have R code which submits SQL statements to a database server. Since
>> > the SQL is rather complex, I want to put it into a separate code block
>> > in order to have proper formatting, syntax highlighting, etc:
>> >
>> > #+name: long-sql
>> > #+begin_src sql
>> > select *
>> > from many, tables
>> > where
>> > complex_condition1 = 1,
>> > complex_condition2 = 2
>> > #+end_src
>> >
>> > * Load the data to R session
>> > #+begin_src R :session *R* :noweb yes
>> > result <- submit_query('<<long-sql>>')
>> > #+end_src
>> >
>> > Unfortunately, the R block doesn't work. When I open the file
>> > generated by Babel, I see this:
>> >
>> > result <- submit_query('select *
>> > result <- submit_query('from many, tables
>> > etc
>> >
>> > instead of the one R submit_query call with my SQL statement as an
>> > argument. Is there anything I can do to achieve that?
>> >
>> > Thanks
>> > Alex
>> >
>> >
>>
>> --
>> Thomas S. Dye
>> http://www.tsdye.com
>>
> Hi Tom,
>
> Unfortunately I can't have pure SQL output in my org files for two
> reasons:
>
> 1. The result set I am dealing with for this particular problem is
> about 20000 records
> 2. My SQL server (Netezza, "big data appliance") is not supported by
> Babel-SQL. I configured sql-mode to work with Netezza but
> session-based SQL is not supported by Babel either. I started adding
> support for SQL sessions to ob-sql.el and it kind of works but the
> results I am getting are inconsistent and only a small subset of
> header parameters is supported. Of course I haven't tested is with any
> other database. I can share what I've done if anybody is interested.
>
> Regards,
> Alex
>
> On Wed, Sep 18, 2013 at 5:27 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>
> Aloha Alex,
>
> My work flow in this situation evaluates the SQL to create an
> Org-mode
> table, which serves as input to the R source code block.
>
> For me, seeing the SQL output in a table is a sanity check.
>
> hth,
> Tom
>
>
>
> Alexander Vorobiev <alexander.vorobiev@gmail.com> writes:
>
> > I have R code which submits SQL statements to a database server.
> Since the
> > SQL is rather complex, I want to put it into a separate code
> block in order
> > to have proper formatting, syntax highlighting, etc:
> >
> > #+name: long-sql
> > #+begin_src sql
> > select *
> > from many, tables
> > where
> > complex_condition1 = 1,
> > complex_condition2 = 2
> > #+end_src
> >
> > * Load the data to R session
> > #+begin_src R :session *R* :noweb yes
> > result <- submit_query('<<long-sql>>')
> > #+end_src
> >
> > Unfortunately, the R block doesn't work. When I open the file
> generated by
> > Babel, I see this:
> >
> > result <- submit_query('select *
> > result <- submit_query('from many, tables
> > etc
> >
> > instead of the one R submit_query call with my SQL statement as
> an
> > argument. Is there anything I can do to achieve that?
> >
> > Thanks
> > Alex
> > I have R code which submits SQL statements to a database server.
> Since
> > the SQL is rather complex, I want to put it into a separate code
> block
> > in order to have proper formatting, syntax highlighting, etc:
> >
> > #+name: long-sql
> > #+begin_src sql
> > select *
> > from many, tables
> > where
> > complex_condition1 = 1,
> > complex_condition2 = 2
> > #+end_src
> >
> > * Load the data to R session
> > #+begin_src R :session *R* :noweb yes
> > result <- submit_query('<<long-sql>>')
> > #+end_src
> >
> > Unfortunately, the R block doesn't work. When I open the file
> > generated by Babel, I see this:
> >
> > result <- submit_query('select *
> > result <- submit_query('from many, tables
> > etc
> >
> > instead of the one R submit_query call with my SQL statement as
> an
> > argument. Is there anything I can do to achieve that?
> >
> > Thanks
> > Alex
> >
> >
>
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>
>
--
Thomas S. Dye
http://www.tsdye.com
next prev parent reply other threads:[~2013-10-07 15:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 21:51 [Babel][R] Inclusion of multi-line named code blocks in R code Alexander Vorobiev
2013-09-18 22:27 ` Thomas S. Dye
2013-09-19 0:43 ` Alexander Vorobiev
2013-09-19 15:14 ` Alexander Vorobiev
2013-10-07 15:42 ` Thomas S. Dye [this message]
2013-10-07 20:58 ` Alexander Vorobiev
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m14n8t6qak.fsf@poto.myhome.westell.com \
--to=tsd@tsdye.com \
--cc=alexander.vorobiev@gmail.com \
--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 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.