Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'one?': 0.05; 'exception,': 0.09; 'raises': 0.09; 'rows': 0.09; 'violates': 0.09; 'subject:How': 0.10; 'efficiency.': 0.16; 'inserting': 0.16; 'received:166.84': 0.16; 'received:166.84.1': 0.16; 'received:166.84.1.89': 0.16; 'received:mailbackend.panix.com': 0.16; 'received:panix.com': 0.16; 'roy': 0.16; 'received:166': 0.19; '---': 0.24; "i'm": 0.30; 'to:name:python-list': 0.33; 'received:66': 0.35; 'subject:with': 0.35; 'problem.': 0.35; 'but': 0.35; 'charset:us-ascii': 0.36; 'error.': 0.37; 'to:addr :python-list': 0.38; 'short': 0.38; 'to:addr:python.org': 0.39; 'catch': 0.60; 'tell': 0.60; 'header:Message-Id:1': 0.63; 'information': 0.63; 'kind': 0.63; 'smith': 0.68; 'caused': 0.69; 'email addr:panix.com': 0.84; 'subject:find': 0.84 From: Roy Smith Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Fri, 29 Mar 2013 10:48:28 -0400 Subject: How to find bad row with db api executemany()? To: python-list Mime-Version: 1.0 (Apple Message framework v1283) X-Mailer: Apple Mail (2.1283) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364568516 news.xs4all.nl 6909 [2001:888:2000:d::a6]:49926 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42247 I'm inserting a gazillion rows into a MySQL database using MySQLdb and = cursor.executemany() for efficiency. Every once in a while, I get a row = which violates some kind of database constraint and raises Error. I can catch the exception, but don't see any way to tell which row = caused the problem. Is this information obtainable, short of retrying = each row one by one? --- Roy Smith roy@panix.com