`----exception----`

`(1062, "Duplicate entry '1711076-314274483' for key 'uk_thread_mail'")`

this is the exception I printed in my log.

the key is `UNIQUE KEY uk_thread_mail (thread_id, mail_id)`

the log seems telling me that I already got the tuple value (thread\_id, mail\_id) as (1711076, 314274483), but when I check the table, I can't find any rows matches thread\_id=1711076 and mail\_id=314274483.

I really wanna know why this would happen.

---

My code looks like:

```
for r, s in rs:
    try:
        store.execute("insert into table_x (thread_id, mail_id) values (%s, %s)", (r, s))
    except Exception, e:
        print e
        store.rollback()
    store.commit()

```

---

rows in rs can never be duplicate because mail\_id comes from the primary key of another table.