By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

Feeding data into MySQLdb LOAD DATA from Python

P: n/a
Is it possible to feed data into a LOAD DATA command in MySQL without
writing out the data to a file? It's possible to do this using the
MySQL command line and a UNIX FIFO, but that's kind of clunky.
I have to load a few gigabytes of data, and using INSERT takes
a whole day for each update.

And can this be done portably across UNIX and Windows? Thanks.

John Nagle
Nov 14 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
John Nagle wrote:
Is it possible to feed data into a LOAD DATA command in MySQL without
writing out the data to a file? It's possible to do this using the
MySQL command line and a UNIX FIFO, but that's kind of clunky.
I have to load a few gigabytes of data, and using INSERT takes
a whole day for each update.

And can this be done portably across UNIX and Windows? Thanks.

John Nagle
Where is the data coming from? Two suggestions:

1) There is a MySQL option to not commit every insert, sorry I can't remember
what it is, but it REALLY speeds things up (especially if you have lots of
keys). Or drop all the keys load, the data, and recreate the keys. Sounds odd,
but it is a recommended method.
2) If data is coming from a file now, use LOAD DATA directly, don't go through
Python. You may even find writing to file and then loading it is very fast. I
recommend tab delimited as that seems to work well.

-Larry
Nov 14 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.