#19544: IntegrityError during Many To Many add()
-------------------------------------+-------------------------------------
     Reporter:  Kronuz               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Someday/Maybe
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by lechatpito):

 I think I have the same error using 1.6.7. Any idea how to fix this ?
 Here is the trace:

 {{{
 Stacktrace (most recent call last):

   File "celery/app/trace.py", line 240, in trace_task
     R = retval = fun(*args, **kwargs)
   File "celery/app/trace.py", line 421, in __protected_call__
     return self.run(*args, **kwargs)
   File "itemizer/tasks.py", line 125, in itemize
     write_entity_object_to_model(entity, ranking.top3_item,
 ranking.category, ranking)
   File "itemizer/tasks.py", line 453, in write_entity_object_to_model
     e.categories.add(category)
   File "django/db/models/fields/related.py", line 583, in add
     self._add_items(self.source_field_name, self.target_field_name, *objs)
   File "django/db/models/fields/related.py", line 672, in _add_items
     for obj_id in new_ids
   File "django/db/models/query.py", line 359, in bulk_create
     self._batched_insert(objs_without_pk, fields, batch_size)
   File "django/db/models/query.py", line 838, in _batched_insert
     using=self.db)
   File "django/db/models/manager.py", line 232, in _insert
     return insert_query(self.model, objs, fields, **kwargs)
   File "django/db/models/query.py", line 1514, in insert_query
     return query.get_compiler(using=using).execute_sql(return_id)
   File "django/db/models/sql/compiler.py", line 903, in execute_sql
     cursor.execute(sql, params)
   File "django/db/backends/util.py", line 53, in execute
     return self.cursor.execute(sql, params)
   File "django/db/utils.py", line 99, in __exit__
     six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "django/db/backends/util.py", line 53, in execute
     return self.cursor.execute(sql, params)
   File "django/db/backends/mysql/base.py", line 124, in execute
     return self.cursor.execute(query, args)
   File "MySQLdb/cursors.py", line 205, in execute
     self.errorhandler(self, exc, value)
   File "MySQLdb/connections.py", line 36, in defaulterrorhandler
     raise errorclass, errorvalue
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19544#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.a62cc7cb618fecaf685d7d4eeaa014ee%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to