Malcolm J Harwood wrote:
> On Wednesday 11 January 2006 04:56 pm, [EMAIL PROTECTED] wrote:
> 
> 
>>However its now giving some new errors while importing the tickets.
>>
>>Error: columns ticket, time, field are not unique
>>
>>Has anyone come across this before. 
> 
> 
> Yes. I've been working with the bugzilla import and it does the same thing.
> What is means is that the primary key is not unique. Why you are getting 
> that, 
> I don't know, it would depend on your data and what, if anything, the import 
> script is doing to it.

What is the full stack trace for your error?

I found a bug today when it was trying to do Bugzilla's "bug activity" into 
"ticket_change".

In our bugs db:

mysql> select * from bugs_activity where bug_id=2121;
+--------+-----------+-----+---------------------+---------+----------------+----------------+
| bug_id | attach_id | who | bug_when            | fieldid | added          | 
removed        |
+--------+-----------+-----+---------------------+---------+----------------+----------------+
|   2121 |       149 |   9 | 2005-02-11 16:18:31 |      26 | 1              | 0 
             |
|   2121 |       150 |   9 | 2005-02-11 16:18:31 |      26 | 1              | 0 
             |
|   2121 |       151 |   9 | 2005-02-11 16:18:31 |      26 | 1              | 0 
             |
|   2121 |      NULL |   7 | 2005-02-25 11:20:16 |      15 | [EMAIL PROTECTED] 
| [EMAIL PROTECTED] |
|   2121 |      NULL |   6 | 2005-03-01 09:30:50 |       8 | RESOLVED       | 
NEW            |
|   2121 |      NULL |   6 | 2005-03-01 09:30:50 |      11 | FIXED          |   
             |
+--------+-----------+-----+---------------------+---------+----------------+----------------+
6 rows in set (0.01 sec)

The first three records made the script barf:

  File "contrib/bugzilla2trac.py", line 809, in convert
    trac.addTicketChange (**ticketChange)
  File "contrib/bugzilla2trac.py", line 416, in addTicketChange
    (ticket, time.strftime('%s'), author, field,
psycopg.IntegrityError: duplicate key violates unique constraint 
"ticket_change_pk"


And in the script, in convert() near the activity section, after the last elif, 
I added:

elif field_name == "attachments.isobsolete":
    field_name = field_name + "." + str(activity['attach_id'])


This made the field_name something like attachments.isobsolete.149 and I didn't 
get the error.

I've emailed the script maintainer to see if this change is worthy of the /trunk

Maybe it's your issue as well?

BA
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to