MySQLdb

Swaroop C H swaroopch at gmail.com
Tue Jan 25 16:03:29 EST 2005


> >I think a better option is to have the rows in a text file and then
> >use `mysqlimport` or 'load data infile' SQL[1]
> >
> >[1]: http://dev.mysql.com/doc/mysql/en/load-data.html
> >
> I remember using that a while ago when I dabbled with mysql so I think
> thats a potential solution. With my current solution I get full error
> logging with each row i try to insert. Will mysqlimport fail completeley
> if one row fails?

I've not yet encountered an error using mysqlimport. But the docs at
that link say that it might fail completely depending on the type of
error.

Excerpt:
" If you specify IGNORE, input rows that duplicate an existing row on
a unique key value are skipped. If you don't specify either option,
the behavior depends on whether or not the LOCAL keyword is specified.
Without LOCAL, an error occurs when a duplicate key value is found,
and the rest of the text file is ignored. With LOCAL, the default
behavior is the same as if IGNORE is specified; this is because the
server has no way to stop transmission of the file in the middle of
the operation.
"

P.S. Its best to take this discussion off the list since its not
directly related to Python.

-- 
Swaroop C H
Blog: http://www.swaroopch.info
Book: http://www.byteofpython.info



More information about the Python-list mailing list