Import dataset bug with doccano v1.6.2
Author: krannnnCreated May 23, 2022Updated Jun 11, 2026
Hello,
I'm working with doccano v1.6.2 for the past few months (since March 14th) and now that I build using docker-compose and I upload the dataset under the jsonl format (.json) using the provided example:
{"text": "EU rejects German call to boycott British lamb.", "label": [ [0, 2, "ORG"], ... ]}
{"text": "Peter Blackburn", "label": [ [0, 15, "PERSON"] ]}
{"text": "President Obama", "label": [ [10, 15, "PERSON"] ]}and when I do this I get the following error:
rabbitmq_1 | 2022-05-23 16:04:22.652 [info] <0.1111.0> connection <0.1111.0> (172.27.0.4:60262 -> 172.27.0.3:5672): user 'doccano' authenticated and granted access to vhost '/'
nginx_1 | 185.35.172.206 - - [23/May/2022:16:04:22 +0000] "POST /v1/projects/3/upload HTTP/1.1" 200 50 "http://10.0.4.16/projects/3/dataset/import" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0" "-"
celery_1 | [2022-05-23 16:04:22,658: INFO/MainProcess] Task data_import.celery_tasks.import_dataset[2b223475-2eae-499c-97a7-9c87ed4bd6dd] received
postgres_1 | 2022-05-23 16:04:22.722 UTC [46] ERROR: null value in column "upload_name" of relation "examples_example" violates not-null constraint
postgres_1 | 2022-05-23 16:04:22.722 UTC [46] DETAIL: Failing row contains (178, {}, /backend/media/MKyZLaJoYiJqPzmrcFRnze/Ryq2ZD7Fa4AXgmzpFYbuc9/tes..., EU rejects German call to boycott British lamb., 2022-05-23 16:04:22.719948+00, 2022-05-23 16:04:22.719971+00, null, 3, 066756ff-3c2f-4c7d-bf4b-d62e351a3964, null).
postgres_1 | 2022-05-23 16:04:22.722 UTC [46] STATEMENT: INSERT INTO "examples_example" ("uuid", "meta", "filename", "project_id", "annotations_approved_by_id", "text", "created_at", "updated_at") VALUES ('066756ff-3c2f-4c7d-bf4b-d62e351a3964'::uuid, '{}', '/backend/media/MKyZLaJoYiJqPzmrcFRnze/Ryq2ZD7Fa4AXgmzpFYbuc9/test.json', 3, NULL, 'EU rejects German call to boycott British lamb.', '2022-05-23T16:04:22.719948+00:00'::timestamptz, '2022-05-23T16:04:22.719971+00:00'::timestamptz), ('d5437549-b9dc-4656-9138-4339b73b5d41'::uuid, '{}', '/backend/media/MKyZLaJoYiJqPzmrcFRnze/Ryq2ZD7Fa4AXgmzpFYbuc9/test.json', 3, NULL, 'Peter Blackburn', '2022-05-23T16:04:22.720054+00:00'::timestamptz, '2022-05-23T16:04:22.720069+00:00'::timestamptz), ('750b79db-4ef6-4888-9a69-3c5932fa2542'::uuid, '{}', '/backend/media/MKyZLaJoYiJqPzmrcFRnze/Ryq2ZD7Fa4AXgmzpFYbuc9/test.json', 3, NULL, 'President Obama', '2022-05-23T16:04:22.720145+00:00'::timestamptz, '2022-05-23T16:04:22.720159+00:00'::timestamptz) RETURNING "examples_example"."id"
celery_1 | [2022-05-23 16:04:22,755: ERROR/MainProcess] Task data_import.celery_tasks.import_dataset[2b223475-2eae-499c-97a7-9c87ed4bd6dd] raised unexpected: IntegrityError('null value in column "upload_name" of relation "examples_example" violates not-null constraint\nDETAIL: Failing row contains (178, {}, /backend/media/MKyZLaJoYiJqPzmrcFRnze/Ryq2ZD7Fa4AXgmzpFYbuc9/tes..., EU rejects German call to boycott British lamb., 2022-05-23 16:04:22.719948+00, 2022-05-23 16:04:22.719971+00, null, 3, 066756ff-3c2f-4c7d-bf4b-d62e351a3964, null).\n')
celery_1 | Traceback (most recent call last):
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
celery_1 | return self.cursor.execute(sql, params)
celery_1 | psycopg2.errors.NotNullViolation: null value in column "upload_name" of relation "examples_example" violates not-null constraint
celery_1 | DETAIL: Failing row contains (178, {}, /backend/media/MKyZLaJoYiJqPzmrcFRnze/Ryq2ZD7Fa4AXgmzpFYbuc9/tes..., EU rejects German call to boycott British lamb., 2022-05-23 16:04:22.719948+00, 2022-05-23 16:04:22.719971+00, null, 3, 066756ff-3c2f-4c7d-bf4b-d62e351a3964, null).
celery_1 |
celery_1 |
celery_1 | The above exception was the direct cause of the following exception:
celery_1 |
celery_1 | Traceback (most recent call last):
celery_1 | File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 451, in trace_task
celery_1 | R = retval = fun(*args, **kwargs)
celery_1 | File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 734, in __protected_call__
celery_1 | return self.run(*args, **kwargs)
celery_1 | File "/backend/data_import/celery_tasks.py", line 22, in import_dataset
celery_1 | writer.save(reader, project, user, cleaner)
celery_1 | File "/backend/data_import/pipeline/writers.py", line 107, in save
celery_1 | self.create(project, user)
celery_1 | File "/backend/data_import/pipeline/writers.py", line 118, in create
celery_1 | ids = self.examples.save_data(project)
celery_1 | File "/backend/data_import/pipeline/writers.py", line 66, in save_data
celery_1 | return Example.objects.bulk_create(examples)
celery_1 | File "/backend/examples/managers.py", line 6, in bulk_create
celery_1 | super().bulk_create(objs, batch_size=batch_size, ignore_conflicts=ignore_conflicts)
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
celery_1 | return getattr(self.get_queryset(), name)(*args, **kwargs)
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 519, in bulk_create
celery_1 | returned_columns = self._batched_insert(
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1318, in _batched_insert
celery_1 | inserted_rows.extend(self._insert(
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1301, in _insert
celery_1 | return query.get_compiler(using=using).execute_sql(returning_fields)
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1441, in execute_sql
celery_1 | cursor.execute(sql, params)
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
celery_1 | return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
celery_1 | return executor(sql, params, many, context)
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
celery_1 | return self.cursor.execute(sql, params)
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
celery_1 | raise dj_exc_value.with_traceback(traceback) from exc_value
celery_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 85, in _execute
celery_1 | return self.cursor.execute(sql, params)
celery_1 | django.db.utils.IntegrityError: null value in column "upload_name" of relation "examples_example" violates not-null constraint
celery_1 | DETAIL: Failing row contains (178, {}, /backend/media/MKyZLaJoYiJqPzmrcFRnze/Ryq2ZD7Fa4AXgmzpFYbuc9/tes..., EU rejects German call to boycott British lamb., 2022-05-23 16:04:22.719948+00, 2022-05-23 16:04:22.719971+00, null, 3, 066756ff-3c2f-4c7d-bf4b-d62e351a3964, null).Any thoughts why this is happening ? It's not the case with the v1.7.0, however I based my code on the verison from 1.6.2 and updated the upload function from doccano client to work with 1.6.2, and I don't seem to identify the routes for v1.7.0
Your Environment
- Operating System: Ubuntu
- Python Version Used:
- When you install doccano: May 23rd 2022
- How did you install doccano (Heroku button etc): docker-compose
Source: doccano/doccano