在MySQL中上传.csv文件时出现未知的列错误

时间:2017-03-01 14:44:20

标签: mysql csv

我正在使用以下代码上传一个巨大的csv文件:

LOAD DATA LOCAL INFILE 'file.csv'
                INTO TABLE signal_vv.Action
                CHARACTER SET latin1
                FIELDS TERMINATED BY ','
                -- ESCAPED BY '\b'
                ENCLOSED BY '"'
                LINES TERMINATED BY '\n'
                IGNORE 1 ROWS
                (@visitdatetime,usersessionid,probability,@spottime,network,reqion,creative,origin,Region,
                 t_usersessions_cuserref,t_usersessions_useraddressid,country,isp,UserId,SessionRefID,
                 source_,t_usersessions_userrefid,postcode,appsessionid,UserIP,ServerAddress,Medium_,device,AdSpotID)
                SET 
                visitdatetime= STR_TO_DATE(@visitdatetime,'%Y%m%d-%H:%i:%s'),
                spottime=STR_TO_DATE(@spottime,'%Y%m%d-%H:%i:%s')
                ;

当我运行它时出现了这个错误:

Error Code: 1054. Unknown column 'probability' in 'field list' 0.032 sec

前5行看起来是:

visitdatetime,usersessionid,probability,spottime,network,reqion,creative,origin,Region,t_usersessions_cuserref,t_usersessions_useraddressid,country,isp,UserId,SessionRefID,source_,t_usersessions_userrefid,postcode,appsessionid,UserIP,ServerAddress,Medium_,device,AdSpotID
01/10/2016 06:14,13403176,0.009460106,01/10/2016 06:14,Movies 4 Men 1,national,VCCOOSI990030,None,GB/london/london,3.11137E+13,None,GB,TELEFONICAO2UK,None,2744429,None,None,None,None,82.132.238.96,None,web,None,41510
01/10/2016 06:14,13406873,0.009460106,01/10/2016 06:14,Movies 4 Men 1,national,VCCOOSI990030,None,GB/london/london,31148fc9500c58,None,GB,BT,None,2901890,None,None,SE10,None,109.147.90.149,None,web,None,41510
01/10/2016 06:14,13618866,0.009460106,01/10/2016 06:14,Movies 4 Men 1,national,VCCOOSI990030,None,GB/london/london,3191b1407c367e,None,GB,TELEFONICAO2UK,None,3063053,None,None,None,None,82.132.241.240,None,web,None,41510
01/10/2016 06:14,13407385,0.009460106,01/10/2016 06:14,Movies 4 Men 1,national,VCCOOSI990030,None,GB/london/london,3136d33c60e4c6,None,GB,TELEFONICAO2UK,None,2622421,None,None,None,None,82.132.222.151,None,web,None,41510
01/10/2016 06:14,13361612,0.009460106,01/10/2016 06:14,Movies 4 Men 1,national,VCCOOSI990030,None,GB/london/london,307808800c066f,None,GB,TELEFONICAO2UK,None,2805769,None,None,None,None,82.132.222.11,None,web,None,41510

该表具有字段概率(double)。

有人可以帮我吗?

感谢

1 个答案:

答案 0 :(得分:0)

  

检查表格的列名。

您的 LOAD DATA 可能正在考虑一个名为“probability”的列的.CSV,而您在MySQL中的表可能会有一个名为的列probabillity“