I wrote a single line shell script to import a .csv file to sqlite3 database table.
echo -e '.separator "," \n.import testing.csv aj_test' | sqlite3 ajtest.db
sqlite3 database = ajtest.db sqlite3 table in ajtest.db = new_test
the testing.csv has 3 columns, first one is int the rest two are texts; so accordingly the structure of new_test is also--
sqlite> .schema aj_test
CREATE TABLE aj_test(number integer not null,
first_name varchar(20) not null,
last_name varchar(20) not null);
when the script is run, it does not show any error, but it also does not import any data. any guidelines as to what I have missed ???
CSV Import
– Salmagundiecho -e '.separator "," \n.import testing.csv aj_test' | sqlite3 ajtest.db
because the table you are importing into is aj_test. – Salmagunditesting.csv
which is the result ofcat testing.csv
. – Salmagundi