title: How to know table name when inserting into two tables then triggering an exception
body: <p>My Python script inserts some data into two tables, just like,</p>
  
  <pre><code>try:
      ...
      cur = conn.cursor()
      cur.execute('''insert into table_A values (%s,%s)''',(value_1,value_2))  
      cur.execute('''insert into table_B values (%s,%s,%s)''',(value_1,value_2,value_3))
      ...
  except MySQLdb.Error, e:
      print "Error %d: %s" % (e.args[0], e.args[1])
      sys.exit (1)
  </code></pre>
  
  <p>The script has a problem:<br>
  When an exception occurs (e.g.,'Error 1062: Duplicate entry') , it's hard to know 'inserting table_A' throws the exception or 'inserting table_B' throws the exception, is there a way to know the table name via MySQLdb.Error when inserting triggers an exception ?</p>