简体   繁体   English

mysqlimport保持丢失的行

[英]mysqlimport keeps missing rows

I'm using mysqlimport to ingest a csv file. 我正在使用mysqlimport提取一个csv文件。

This is the command that I used: 这是我使用的命令:

mysqlimport --ignore-lines=1 --fields-terminated-by=, --columns=$COLUMNS  --lines-terminated-by="\n" \
        --verbose --local --fields-enclosed-by='"' --host=$HOST --port=$PORT \
        --user=$USERNAME --password=$PASSWORD ${DATABASE} $FILE_PATH

Before I started the process, I truncated the table and it does not have any unique indexes. 在开始该过程之前,我将表截断了,并且该表没有任何唯一索引。

The source file has 7288362 records(At beginning I thought the csv rows may contain new line characters. I did a check but there was no quoted new line characters in the fileds). 源文件有7288362个记录(开始时我以为csv行可能包含换行符。我做了检查,但fileds中没有加引号的换行符)。

However when mysqlimport was done, it said "Records: 7288300 Deleted: 0 Skipped: 0 Warnings: 43730142". 但是,当mysqlimport完成时,它说“记录:7288300删除:0跳过:0警告:43730142”。

When I logged into mysql and did a select count(*) from MyTable, it also gave me 7288300. 当我登录mysql并从MyTable中进行选择count(*)时,它也给了我7288300。

Any ideas? 有任何想法吗?

Thanks! 谢谢!

I have this kind of rows in my csv files: 我的csv文件中有这种行:

1345235,62,"Theme From \Shaft\""""",,Chris Davis & Kim Waters,,,,,,5,0,,,,,,,,,,2016-10-28,,,,2016-10-28,,Y,,,,,,0,‌​2016-10-28 09:09:39

The multi quotes there caused a problem. 那里的多引号引起了问题。 When I added --fields-escaped-by='' , it worked. 当我添加--fields-escaped-by='' ,它起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM