Do not re-use cursors in the sql_chunk helper of load_export
Closes #933 (closed)
The ElementPath import uses recursive function calls to build its element paths, making new queries to find all the parent paths of a given element. The sql_chunk
helper was using self.cursor
, a cursor which is already in use to run the initial SELECT * FROM element_path
. Since sql_chunk
is also used in the recursive calls, the cursor gets reset and the initial query is forgotten, causing the next iteration to always run out of paths.
Additionally, this command defined a BATCH_SIZE
but it was unused since it imports one from arkindex.documents.tasks.export
.
Edited by Erwan Rouchet