mysql bulk insert from python

D

Dave Ekhaus

hi

my news carrier didn't have any mysql specific news groups - so
apologize in advance if this isn't exactly the proper group for these
question(s) ...

anyway - i'm trying to figure out how to perform a bulk insert of data
from a text file into a table in a mysql database from the python
programming language. i have lots of experience with ms sql server and
there we used bcp and then dts packages, but i can't seem to find the
analogous method for mysql - and would appreciate any tips/insight the
group can offer.

fwiw - the data files contain on the order of 100,000 + records
(sometimes approx. 1 million), so anything but a 'bulk' solution
probably isn't practical.

also - i found some reference to a 'Loader' python module, but it
seems to related to MaxDB and SAP. i'm not sure what that is - and
would really prefer a more generic solution.

thanks
dave
 
W

Wolfram Kraus

Dave said:
hi

my news carrier didn't have any mysql specific news groups - so
apologize in advance if this isn't exactly the proper group for these
question(s) ...

anyway - i'm trying to figure out how to perform a bulk insert of
data from a text file into a table in a mysql database from the python
programming language. i have lots of experience with ms sql server and
there we used bcp and then dts packages, but i can't seem to find the
analogous method for mysql - and would appreciate any tips/insight the
group can offer.

fwiw - the data files contain on the order of 100,000 + records
(sometimes approx. 1 million), so anything but a 'bulk' solution
probably isn't practical.

also - i found some reference to a 'Loader' python module, but it
seems to related to MaxDB and SAP. i'm not sure what that is - and
would really prefer a more generic solution.

thanks
dave
The MySQL command LOAD DATA INFILE
(http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html) might be what you are
looking for, no need for python here, but you can call this command from
any python script that uses the MySQLDB module
(http://sourceforge.net/projects/mysql-python)


HTH,
Wolfram

PS: Maybe news.gmane.org has some mysql-lists that you can try
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top