Question

I am trying to load some pipe-delimited text files into tables using mysqlimport / LOAD FROM INFILE.

The files uses empty delimiters || for NULL values.

The result is a huge amount of warnings

Warning 1366 - Incorrect integer value: '' for column

while importing.

I don't know if it's safe to ignore the warnings or not.

Doing a find-replace for || in the text file is kind of a last resort as their combined size is above 1GB. Any input?

Was it helpful?

Solution

Can your column be null or not in your DB schema ?

If it can, it should be alright.

OTHER TIPS

sed will change || to |0| in no time :D
well you can alter table:

ALTER TABLE table MODIFY column int null;

and make that column accept null values.

Credit goes to @Antonio Glavocevic see: https://stackoverflow.com/a/53584863/1050766

To correctly support nulls in the import, use \N instead of an empty value. Eg foo|\N|123

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top