* [BUG] ob-sqlite: can not override header argument
@ 2023-08-17 16:25 Max Nikulin
2023-08-17 18:03 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Max Nikulin @ 2023-08-17 16:25 UTC (permalink / raw)
To: emacs-orgmode
It seems there is no way to override for a specific code block header
arguments specified for the whole file through #+property:
#+property: header-args:sqlite :header
#+begin_src elisp :results none
(require 'ob-sqlite)
#+end_src
I have tried "nil", etc. for ":header", but column names are always
added to results.
#+begin_src sqlite :results verbatim :header no
select 1 as "one", 2 as "two"
#+end_src
#+RESULTS:
: one,two
: 1,2
Bonus: it seems condition for :csv is inverted, so -csv is always added.
I have not managed to override comma using :separator since -csv is
added later.
I am just testing a patch for ob-sqlite, I am not a real user of it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] ob-sqlite: can not override header argument
2023-08-17 16:25 [BUG] ob-sqlite: can not override header argument Max Nikulin
@ 2023-08-17 18:03 ` Ihor Radchenko
2023-08-18 11:06 ` Max Nikulin
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2023-08-17 18:03 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
Max Nikulin <manikulin@gmail.com> writes:
> It seems there is no way to override for a specific code block header
> arguments specified for the whole file through #+property:
>
> #+property: header-args:sqlite :header
> #+begin_src elisp :results none
> (require 'ob-sqlite)
> #+end_src
>
> I have tried "nil", etc. for ":header", but column names are always
> added to results.
Yes, it is not.
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sqlite.html
header
if present, turn on headers in the output format.
Mere presence of this header argument triggers inclusion. Nothing is
said about overriding it.
I think that we may allow :header/:echo/:bail/... no to disable the cmd
switches. Patches welcome!
> Bonus: it seems condition for :csv is inverted, so -csv is always added.
> I have not managed to override comma using :separator since -csv is
> added later.
The source says
;; for easy table parsing, default header type should be -csv
(cons "csv" (if (or (member :csv others) (member :column others)
(member :line others) (member :list others)
(member :html others) separator)
""
"-csv"))
So, it is at least intentional.
Note that (member :csv others) yielding "" is also intentional because
it is already added by that time in %others.
It is also documented to be the default:
csv
the default SQLite output format for Babel SQLite source code blocks.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] ob-sqlite: can not override header argument
2023-08-17 18:03 ` Ihor Radchenko
@ 2023-08-18 11:06 ` Max Nikulin
2023-08-18 11:16 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Max Nikulin @ 2023-08-18 11:06 UTC (permalink / raw)
To: emacs-orgmode
On 18/08/2023 01:03, Ihor Radchenko wrote:
> The source says
>
> ;; for easy table parsing, default header type should be -csv
>
> So, it is at least intentional.
With ":results verbatim" it is not convincing.
> Note that (member :csv others) yielding "" is also intentional because
> it is already added by that time in %others.
>
> It is also documented to be the default:
>
> csv
> the default SQLite output format for Babel SQLite source code blocks.
I do not try to dispute that it is default. The issue is that ":csv no"
is not supported. It is at least not intuitive that to disable :csv and
to activate :separator it is necessary to add :list. So the effect of
sqlite3 command line options differs from the effect of ob-sqlite header
arguments.
I am not an active sqlite user and I am almost unfamiliar with its
options, so I am unsure what is the best way to integrate sqlite into
org-babel.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] ob-sqlite: can not override header argument
2023-08-18 11:06 ` Max Nikulin
@ 2023-08-18 11:16 ` Ihor Radchenko
0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2023-08-18 11:16 UTC (permalink / raw)
To: Max Nikulin; +Cc: emacs-orgmode
Max Nikulin <manikulin@gmail.com> writes:
> On 18/08/2023 01:03, Ihor Radchenko wrote:
>> The source says
>>
>> ;; for easy table parsing, default header type should be -csv
>>
>> So, it is at least intentional.
>
> With ":results verbatim" it is not convincing.
Maybe. But not a bug either. I am also not a user of ob-sqlite, so I am
not in position to judge what is better. My current stance is not to
touch the working code.
If there are any users of ob-sqlite, I invite them to chime in, if they
have an opinion.
>> csv
>> the default SQLite output format for Babel SQLite source code blocks.
>
> I do not try to dispute that it is default. The issue is that ":csv no"
> is not supported. It is at least not intuitive that to disable :csv and
> to activate :separator it is necessary to add :list. So the effect of
> sqlite3 command line options differs from the effect of ob-sqlite header
> arguments.
Sure. But it is not exactly a bug as well. I would accept patches that
will allow disabling these header arguments, if someone is bothered
enough to submit them.
Handled. We can continue the discussion though.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-18 11:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-17 16:25 [BUG] ob-sqlite: can not override header argument Max Nikulin
2023-08-17 18:03 ` Ihor Radchenko
2023-08-18 11:06 ` Max Nikulin
2023-08-18 11:16 ` Ihor Radchenko
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.