When attempting to import CSV data, the shell balks at the command-line but
is otherwise fine when all is done interactively. I suspect user error, but
I just don't see it. Any insight shared would be greatly appreciated.
Thanks.
$ ls
create_table.sql src.csv
$ cat create_table.sql
src.csv <
CREATE TABLE staging(
number TEXT,
first_string TEXT,
second_string TEXT,
third_string TEXT
);
1,two,three,four
2,three,four,five
$ sqlite3 db '.read create_table.sql'
$ sqlite3 -separator '",' db '.import src.csv staging'
Error: src.csv line 1: expected 4 columns of data but found 1
$ rm db
$ sqlite3 db
SQLite version 3.7.5
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read create_table.sql
sqlite> .separator ",
sqlite> .import src.csv staging
sqlite> .separator |
sqlite> select * from staging;
1|two|three|four
2|three|four|five
sqlite> .q
$
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users