I have a pretty significant CSV file that can change from month to month and has approximately 450 data points per line. I also need to manipulate the data before inserting it into a persistent table. Therefore, I plan to import it into a temporary table, manipulate it, and then insert the data.
However, I cannot find information on how and how to import CSV into a temporary table (or, alternatively, somehow import dynamic CSV - the first row has column headers in CSV).
I tried to create a temporary table with one column, and then import the CSV, but did not import it. This is what I have tried so far:
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;
As an example of CSV, it is in the format (all data points are numbers):
500,400,101,93,005,22 4,954,23434,123423432,44
source share