--skip option does not work correctly.
(1) By anonymous on 2021-10-28 03:13:03 [source]
When csv file 1st line is as below, --skip option does not work correctly.
,,,,,,,,,,,,,,,,,,,,,,,,,,,
If I inserted some keyword for 1st comma,like
anykeyword,,,,,,,,,,,,,,,,,,,,,,,,,,,
This will work fine. Is this restriction of --skip option? or Starting with , is not allowed in csv format?
(2) By Gunter Hick (gunter_hick) on 2021-10-28 09:21:30 in reply to 1 [link] [source]
Please be more specfic as to the meaning of "does not work correctly". Maybe stating what you expected and what you got my yield enough information to suggest a solution.
(3) By Gunter Hick (gunter_hick) on 2021-10-28 14:05:50 in reply to 1 [link] [source]
If you want anonymous columns, just leave out the header line.
(4.1) By Harald Hanche-Olsen (hanche) on 2021-10-28 16:09:40 edited from 4.0 in reply to 1 [link] [source]
I ran a little experiment. There is indeed an anomaly there:
▶▶▶ .shell cat a.csv
,,,
1,2,4,8
42,,,
,9,3,1
▶▶▶ create table a(x,y,z,w);
▶▶▶ .import -csv -skip 1 a.csv a
a.csv:1: expected 4 columns but found 3 - filling the rest with NULL
▶▶▶ .nullvalue ø
▶▶▶ select * from a;
x y z w
-- - - -
ø
1 2 4 8
42
9 3 1
Notice that the first line got imported with three blanks and a null.
If I add an extra character to the first line, either a comma or something else, the error goes away.
Additionally, the error is still there if I replace the first line with ,a,b,c
. So it appears to be justy the initial comma that is problematic.
(5) By Larry Brasfield (larrybr) on 2021-10-28 19:53:31 in reply to 1 [link] [source]
Thanks for reporting this. And thanks to Harald for making the problem clearer.
This is fixed here.
(6) By anonymous on 2021-10-29 08:43:34 in reply to 5 [link] [source]
Thanks for reproducing the issue and fix. I appreciate your accomplishment.
(7) By anonymous on 2021-10-29 08:43:34 in reply to 5 [link] [source]
Thanks for reproducing the issue and fix. I appreciate your accomplishment.