将数据从csv导入SQLIte表时出现错误消息

时间:2016-08-31 16:41:01

标签: bash csv import sqlite

我有一个包含十二列的CSV文件(FB_Activity_Logs_Parsed.csv)

% head -n 1 FB_Activity_Logs_Parsed.csv | awk -F\, '{print NF}' 12

% head -n 1 FB_Activity_Logs_Parsed.csv 1,100006844151697,Login,2015-08-25 17:55:00,89.96.94.68,PC,Windows,NT 6.1,Chrome,45.0.2454.99,null,null

我希望将其导入SQLite表(tmp_FB_ActivityLogs),但系统只识别六列

sqlite> .show echo: off explain: off headers: off mode: csv nullvalue: "" output: stdout separator: "," stats: off width:

sqlite> .schema tmp_FB_ActivityLogs CREATE TABLE tmp_FB_ActivityLogs ("n" INTEGER PRIMARY KEY AUTOINCREMENT,"ID" VARCHAR , "op" VARCHAR, "datetime" VARCHAR, "IP" VARCHAR, "device" VARCHAR, "os" VARCHAR, "osver" VARCHAR, "app" VARCHAR, "appver" VARCHAR, "carrier" VARCHAR, "langcode" VARCHAR);

sqlite> .import FB_Activity_Logs_Parsed.csv tmp_FB_ActivityLogs Error: FB_Activity_Logs_Parsed.csv line 254: expected 12 columns of data but found 6

0 个答案:

没有答案