Importing CSV records via PHPMyAdmin

A place for users and developers of the Xataface to discuss and receive support.

Postby ghiebert » Sun Apr 01, 2007 11:52 am

I understand there is some work being done, or maybe is completed, to allow importing existing database records. In the meantime for the PHP challenged person, you can import existing CSV data in larger quantities. I'm not sure how big a file you can do this with.

In my case I was able to upload/import 5000 CSV records (7 fields in size) to PHPMyAdmin on the host server I am using. PHPMyAdmin didn't make the import menu easy to find. Everywhere I looked in the control panel on my host server I could not find anything except the ability to import an SQL dump. I don't have that handy. But finally, when I was in the menu that shows all the fields in the current MySQL table, I clicked on Import (just like I had done in the main menu) and with that - and ONLY that - particular Import button was I able to choose CSV along with its appropriate delimiters etc. Importing was simple after that. This could have gone MUCH faster with a more user friendly menu system.

Now, I had to run the file through a filter I made up in Delphi that made it into a legal format, in this case semicolon delimiter and quotes around text fields. The reason I had to run a filter is that our shop uses quotes sometimes to represent inches for some item descriptions and some part numbers, confusing ol' MySQL. So that was fixed. And just to be on safe side, I put a space in every empty text record, and a 0 in any null number field. Probably not necessary but I didn't want this glitching. I did that in the Delphi filter as well.

Once the data was cleaned up PHPMyAdmin's MySQL import routine had noooo problem whatever accepting that many records. Must have been about 20 seconds or less, I walked away and came with a coffee and it was done. Saved typing in 35000 field entries.

I guess one could load a problematic CSV file like this into Excel or suchlike, and export to CSV, and then hopefully Excel is smart enough to make it all look nice to MySQL import routines. Might try that next time.

Later,
Gord
ghiebert
 
Posts: 11
Joined: Wed Dec 31, 1969 5:00 pm

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 19 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved