Jump to content

Export large CSV to MySQL


Recommended Posts

Hello,

Can you suggest me the fastest way of exporting large csv files to MySQL using these UDFs created by cdkid? I have thought of 2 solutions:

1. export the content of .csv to arrays and then use _MySQLAddRecord to add the arrays into the db; I am afraid it will take a long time to export the values from CSV to arrrays

2. use the _MySQLExec to execute LOAD DATA INFILE directly into MySQL and just to put the headers for the csv fle into an array and use it for column names.

Other suggestions would be great. I would really appreciate some examples, too.

Thank you,

Ionut

Link to comment
Share on other sites

ive been using this - truly awesome

props to KAFU

http://www.autoitscript.com/forum/index.php?showtopic=81346&view=findpost&p=583923

Gcue,

Let me know if I got this straight: I can use _SQLite_Exec to create SQLite tables out of my CSVs and then use _SQLite_Dump to write this tables to an SQLite Db. Is this correct?

Thanks,

Ionut

Link to comment
Share on other sites

if CSV not so big and you have some tools like DataPump in Delphi

you can try

1. Save CSV as DBF in Excel

2. Use DataPump/ ODBC to pump data to MySQL

I think theoretically it might work but I never tried it

or maybe DataPump will work with CSV directly

another way is to find on the net free pump tool which does the trick

Edited by tobject
Link to comment
Share on other sites

  • 2 weeks later...

Sorry so late...

I generally IMPORT the large csv files....up to and over 1 gig...without problem. (3.5 gig is the most I've imported...) I prepare these files with autoit & ms access...depending on how they come in to me...& what their problems are. Most of the data I get is very dirty...and requires parsing, standardization, etc., before any import operation. ... you can control the import with autoit...or ms access...or...bat files...whatever suits your need and configuration. Autoit3 w / stringregexreplace solves most problems...for me at least.

Edited by setirich

Good intentions will always be pleaded for every assumption of authority. It is hardly too strong to say that the Constitution was made to guard the people against the dangers of good intentions. There are men in all ages who mean to govern well, but they mean to govern. They promise to be good masters, but they mean to be masters.-Daniel Webster

Link to comment
Share on other sites

You can use Excel to open the csv file and then transfer to arrays using something like :

$aArray = $oExcel.Activesheet.UsedRange.Value
$aArray2=$oExcel.transpose($aArray)

It is very fast.

Or you can convert the csv to xls and then use ADODB to open it as a database.

Link to comment
Share on other sites

  • 7 years later...
  • Moderators

@LouiseP did you miss that this post is over 8 years old? Or that the person asking the question hasn't been on the forum since September of 2010? Please don't resurrect old threads.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...