How does one list warnings from the 'mysqlimport' utility?

It's not possible with mysqlimport, however as an alternative you can do the following:

mysql --execute="LOAD DATA LOCAL INFILE '$WORKDIR/$table.csv' INTO TABLE $table FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' IGNORE 1 LINES (listOfColumnNames); SHOW WARNINGS"

Replace listOfColumnNames with an appropriate seperated list of columns.

The magic is (as Eduard previously mentioned) is to execute the LOAD DATA INFILE and the SHOW WARNINGS commands together in the same session, as mysqlimport doesn't provide a way to get at the warnings directly.


Like the others said the real problem is that for SHOW WARNINGS to work you have to be in the same connected session. mysqlimport disconnects from the session as soon as it's finished importing, making the capture of it's warnings impossible in it's current version. Sounds like an opportunity to donate a patch. :)


I've found no way to print warnings with mysqlimport either. But since mysqlimport does nothing but "LOAD DATA INFILE" why don't you use the mysql command to import the data followed by a "SHOW WARNINGS"?