Python MySQLdb LOAD LOCAL INFILE problems
Posted
by belvoir
on Stack Overflow
See other posts from Stack Overflow
or by belvoir
Published on 2010-05-27T15:37:16Z
Indexed on
2010/05/27
15:41 UTC
Read the original article
Hit count: 279
The problem is a simple one. When I execute the following I get different results depending on whether I run it from the MySQL console and from inside a Python Script using MySQLdb:
LOAD DATA LOCAL INFILE '/tmp/source.csv' INTO TABLE test
FIELDS TERMINATED BY '|'
IGNORE 1 LINES;
Console gives the following results:
- Records: 35002 Deleted: 0 Skipped: 0 Warnings: 0
Python (via .info()) returns the following:
- Records: 34977 Deleted: 0 Skipped: 0 Warnings: 8
So in summary, same source file, same SQL request, different results.
From the console I can 'SHOW WARNINGS' an get a better handle on which records are causing the problems and why but from Python I can't idenitify how to do this or more importantly what the cause of the problem could be.
Any suggestions?
- MySQL Server '5.1.41-3ubuntu12.1'
- Python '2.6.5'
- Tables are MyISAM
© Stack Overflow or respective owner