Art:

temp_db_connection = sqlite3.connect(bd_file_name)


I think it’s probably due to the fact that multiple workers are trying to create a connection object to the same SQLite file. Perhaps, if you open the SQLite in the constructor __init__(self) and then each worker can access self.db_connection in the __getitem__(self) method, that may resolve the issue.