sqlite3.InterfaceError when exporting the elements of a corpus

Bastien Abadie
2022-09-05T13:27:44Z

Sentry Issue: [ARKINDEX-BACKEND-19W](https://sentry.io/organizations/teklia/issues/3544536192/?referrer=gitlab_integration) ``` InterfaceError: Error binding parameter 1 - probably unsupported type. File "rq/worker.py", line 1068, in ...

Sentry Issue: ARKINDEX-BACKEND-19W

InterfaceError: Error binding parameter 1 - probably unsupported type.
  File "rq/worker.py", line 1068, in perform_job
    rv = job.perform()
  File "rq/job.py", line 847, in perform
    self._result = self._execute()
  File "rq/job.py", line 870, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "arkindex/documents/export/__init__.py", line 125, in export_corpus
  File "arkindex/documents/export/__init__.py", line 83, in save_sqlite

This errors currently occurs only in preprod and cannot be reproduced in prod, demo, or locally both with and without Docker.

The elements export PostgreSQL query appears to be returning a list with only 10 columns, when it should have 11, causing sqlite to not be able to match all the parameters to the INSERT query. Testing in a Django shell on the preprod containers directly shows that the PostgreSQL query is returning 11 columns on each row, despite Sentry reporting that only 10 columns were returned!