DBI/load data infile issueby jimbus (Friar)
|on Jul 08, 2005 at 15:54 UTC||Need Help??|
jimbus has asked for the
wisdom of the Perl Monks concerning the following question:
This is driving me insane...
I have a perl script that digests some info and loads it into mysql and it was running happily, albiet a bit slowly, inserting line by line using DBI.
While researching mysql optimazation I found out that I should be writing the data to a file and bulk loading it with "load data infile...".
When I got that running, I found that I getting 3557 records as opposed to the 3599 I was expecting and the last record was monged (all defaults or nulls). I check the tmp file and it had 3599 lines, I printed out the command from the perl script and appened it to mysql -e and got 3599 records.
I thought, maybe, it was the pipe not clearing before the script moved on, so I tried to find out how flush things, but couldn't find anything. I even tried running a commit...
I slept on it and this morning decided that since it works from the command line, I'd just rip out the DBI stuff and run the command line version with back ticks... 3557 records!
I saw something simular in "Unable to load entire CSV file into DB", but didn't see a resolution or any ideas I though applied to me...
Can anyone help me, before I go insane?
Never moon a werewolf!