multiprocessio / dsq

Commandline tool for running SQL queries against JSON, CSV, Excel, Parquet, and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Newline in xlsx header causes crash

infojunkie opened this issue · comments

Using the attached xlsx sheet, running dsq newline.xlsx --schema generates the following error:

json: error calling MarshalJSON for type *runner.Shape: invalid character '\n' in string literal

Running dsq newline.xlsx does not crash:

[{"Header with \nNewline":"1"},
{"Header with \nNewline":"2"},
{"Header with \nNewline":"3"},
{"Header with \nNewline":"4"}]

Removing the newline from the header cell no longer crashes the schema command.

Tested this out and it's its own issue. I think I'll deal with this be dropping all newlines in column names for all file types since they all seem to break SQLite.

With the help of Twitter I figured out a workaround :D

dsq newline.xlsx "$(printf "select [Header with \nNewline] from {}")"

image

The issue is that bash won't insert a literal newline but other tools like printf can do that.

Thanks for the workaround! Yes, dropping the newline would simplify handling.