Mysql – How does one list warnings from the ‘thesqlimport’ utility

command-line-interfacecsvdatabaseimportMySQL

To start off, this is not about loading data from within MySQL itself, but using the command-line tool "mysqlimport".

I am using it to load a CSV directly into a table and need to see the warnings it has generated. I cannot seem to get warnings to display with verbose nor debugging turned on. Any ideas?

(MySQL 5.0.5)

Best Answer

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.