title: Import CSV In To Temporary Table In MySQL
body: <p>I have a fairly sizable CSV file that can change from month-to-month, and has roughly 450 data points per row. I also need to manipulate the data before inserting it in to a permanent table. So my plan is to import it in to a temporary table, manipulate it, and then insert the data.</p>
  
  <p>However, I can't find any information on if/how you import a CSV in to a temporary table (or, alternatively, some way of importing a dynamic CSV - the first row has column headers in the CSV).</p>
  
  <p>I tried creating a temp table, with one column, and then importing the CSV but it doesn't seem to import it. This is what I tried so far:</p>
  
  <pre><code>DROP TEMPORARY TABLE IF EXISTS tmp_import;
  
  CREATE TEMPORARY TABLE tmp_import (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY);
  
  LOAD DATA LOCAL INFILE '/import.csv' INTO TABLE tmp_import
  FIELDS TERMINATED BY ',' 
  ENCLOSED BY '"' 
  LINES TERMINATED BY '\r\n'
  IGNORE 1 LINES;
  </code></pre>
  
  <p>As an example of the CSV, it's is in the format (all data points are numbers):</p>
  
  <pre><code>500,400,101,93,005,22
  4,954,23434,123423432,44
  </code></pre>