You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Purchase.objects.bulk_create in SheetRowUpdate.save_rows fails with django.db.utils.IntegrityError if another identical request deletes the SheetRow objects we just created.
Subject: [Django] ERROR (EXTERNAL IP): Internal Server Error: /regnskab/sheet/202/edit/
Date: Mon, 1 May 2017 11:15:49 +0000
Internal Server Error: /regnskab/sheet/202/edit/
Traceback (most recent call last):
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 124, in execute
return self.cursor.execute(query, args)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
raise errorvalue
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 411, in _query
rowcount = self._do_query(q)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 374, in _do_query
db.query(q)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 270, in query
_mysql.connection.query(self, query)
_mysql_exceptions.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`tkweb`.`regnskab_purchase`, CONSTRAINT `regnskab_purchas_row_id_589fcda1fa570aac_fk_regnskab_sheetrow_id` FOREIGN KEY (`row_id`) REFERENCES `regnskab_sheetrow` (`id`))')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/utils/decorators.py", line 34, in _wrapper
return bound_func(*args, **kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/utils/decorators.py", line 30, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/regnskab/views/base.py", line 223, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/views/generic/base.py", line 89, in dispatch
return handler(request, *args, **kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/views/generic/edit.py", line 215, in post
return self.form_valid(form)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/regnskab/views/base.py", line 380, in form_valid
self.save_rows(row_objects)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/regnskab/views/base.py", line 369, in save_rows
Purchase.objects.bulk_create(save_purchases)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/models/query.py", line 392, in bulk_create
self._batched_insert(objs_without_pk, fields, batch_size)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/models/query.py", line 937, in _batched_insert
using=self.db)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/models/query.py", line 920, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql
cursor.execute(sql, params)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/utils.py", line 98, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 124, in execute
return self.cursor.execute(query, args)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
raise errorvalue
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 411, in _query
rowcount = self._do_query(q)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 374, in _do_query
db.query(q)
File "/home/tkammer/tkweb/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 270, in query
_mysql.connection.query(self, query)
django.db.utils.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`tkweb`.`regnskab_purchase`, CONSTRAINT `regnskab_purchas_row_id_589fcda1fa570aac_fk_regnskab_sheetrow_id` FOREIGN KEY (`row_id`) REFERENCES `regnskab_sheetrow` (`id`))')
The text was updated successfully, but these errors were encountered:
Purchase.objects.bulk_create in SheetRowUpdate.save_rows fails with django.db.utils.IntegrityError if another identical request deletes the SheetRow objects we just created.
The text was updated successfully, but these errors were encountered: