MySQL Forums
Forum List  »  PHP

LODA DATA not loading Everything (stops at 55934)
Posted by: Olivier Laublin
Date: August 26, 2014 09:37AM

Hello everyone,

i have to insert a large CSV (7,9mb) in my database

all is quite simple at first sight...

my table structure in CSV is:
----------------------------------
112547,2014-08-23 17:00:00,209477882,164.0,3.8,0.0,0.0,-888.3,0.0,0.0,-888.3,.......
112548,2014-08-23 17:15:00,209477882,96.5,3.0,0.0,0.0,-689.2,0.0,0.0,-689.2,.......
112549,2014-08-23 17:30:00,209477882,48.5,1.7,0.0,0.0,-372.7,0.0,0.0,-372.7,.......
112550,2014-08-23 17:45:00,209477882,39.5,1.3,0.0,0.0,-275.7,0.0,0.0,-275.7,.......
112551,2014-08-23 18:00:00,209477882,31.9,1.2,0.0,0.0,-214.4,0.0,0.0,-214.4,.......
112552,2014-08-23 18:15:00,209477882,40.3,1.3,0.0,0.0,-245.1,0.0,0.0,-245.1,.......
112553,2014-08-23 18:30:00,209477882,19.2,1.1,0.0,0.0,-209.3,0.0,0.0,-209.3,.......
112554,2014-08-23 18:45:00,209477882,22.4,1.0,0.0,0.0,-163.4,0.0,0.0,-163.4,.......
112555,2014-08-23 19:00:00,209477882,2.6,1.6,0.0,0.0,-347.2,0.0,0.0,-347.2,.......
112556,2014-08-23 19:15:00,209477882,0.8,1.3,0.0,0.0,-260.4,0.0,0.0,-260.4,.......

So i know it's not optimal but i modified it to check for errors
refEntree -> Bigint
dateEntree -> varchar (15)
compteur -> varchar (15)
valeur1 -> varchar(15)
...
valeur9 -> varchar (15)

none of the values seems to go over my number of chars

i use in php this query:
-----------------------------------
$bdd->exec('LOAD DATA LOCAL INFILE "OLD_CSV/Steel_20140823A.csv"
REPLACE
INTO TABLE imports
CHARACTER SET UTF8
FIELDS TERMINATED BY ","
LINES TERMINATED BY "\r\n"
(refEntree,dateEntree,compteur,valeur1,valeur2,valeur3,valeur4,valeur5,valeur6,valeur7,valeur8,valeur9)
') or die (print_r($bdd->errorInfo()));
echo 'Success'."<br>";
------------------------------------

When i use load data from phpmyadmin i have the same result of lines and no errors
it tells: # 185586 rows affected.

but i still have only half of the lines in my DB -> 55934

has anyone an idea? :p

i can give you the CSV if need , didn't post it because it's quite big if not needed.

Thanks a lot

olivier

Options: ReplyQuote


Subject
Written By
Posted
LODA DATA not loading Everything (stops at 55934)
August 26, 2014 09:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.