I'm trying to load a big CSV file into mysql but couldn't find out why it fails.
My CSV file looks like this:
_id,"event","unit","created","r1","r2","r3","r4","space_id","owner_id","name","display_name","users__email"
565ce313819709476d7eaf0e,"create",3066,"2015-12-01T00:00:19.604Z","563f592dd6f47ae719be8b38","3","13","7","55ecdd4ea970e6665f7e3911","55e6e3f0a856461404a60fc1","household","household","foo.bar@ace.com"
565ce350819709476d7eaf0f,"complete",3067,"2015-12-01T00:01:19.988Z","21","","","","55e6df3ba856461404a5fdc9","55e6e3f0a856461404a60fc1","Ace","Base","foo.bar@ace.com"
565ce350819709476d7eaf0f,"delete",3067,"2015-12-01T00:01:19.988Z","21","","","","55e6df3ba856461404a5fdc9","55e6e3f0a856461404a60fc1","Ace","Base","foo.bar@ace.com"
565ce350819709476d7eaf0f,"update",3067,"2015-12-01T00:01:19.988Z","21","","","","55e6df3ba856461404a5fdc9","55e6e3f0a856461404a60fc1","Ace","Base","foo.bar@ace.com"
And my code to load the file into mysql is this one:
CREATE DATABASE IF NOT EXISTS analys;
USE analys;
CREATE TABLE IF NOT EXISTS event_log (
  _id CHAR(24) NOT NULL,
  event_log VARCHAR(255),
  unit CHAR(4),
  created VARCHAR(255),
  r1 VARCHAR(255),
  r2 VARCHAR(255),
  r3 VARCHAR(255),
  r4 VARCHAR(255),
  space_id VARCHAR(255),
  owner_id VARCHAR(255),
  name VARCHAR(255),
  display_name VARCHAR(255),
  users__email VARCHAR(255),
  PRIMARY KEY (_id)
)
LOAD DATA INFILE 'audits.export.csv' 
INTO TABLE event_log
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n\r'
IGNORE 1 ROWS;
Everything is fine, including the query but I get NULL in every column (only one row).
Here is the Action Output:
22:31:21    LOAD DATA INFILE 'audits.export.csv'  INTO TABLE event_log FIELDS TERMINATED BY ','  ENCLOSED BY '"' LINES TERMINATED BY '\n\r' IGNORE 1 ROWS   0 row(s) affected Records: 0  Deleted: 0  Skipped: 0  Warnings: 0   0.156 sec
I tried to tweak the table and the load query but it doesn't work
I'm on Windows 7, using Mysql 5.6 and Workbench. I heard about GUI solution or Excel connectors here (Excel Connector) but I prefer to do it programmaticaly as I need to reuse the code.
Any help? I couldn't solve the problem with similar posts on Stackoverflow.
 
     
     
    