Re: [BUG] ob-sqlite: can not override header argument

2023-08-18 Thread Ihor Radchenko
Max Nikulin  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 .
Support Org development at ,
or support my work at 



Re: [BUG] ob-sqlite: can not override header argument

2023-08-18 Thread Max Nikulin

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.





Re: [BUG] ob-sqlite: can not override header argument

2023-08-17 Thread Ihor Radchenko
Max Nikulin  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 .
Support Org development at ,
or support my work at 



[BUG] ob-sqlite: can not override header argument

2023-08-17 Thread Max Nikulin
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.