Skip to content

Database is locked, attempts not working #707

@howff

Description

@howff

I've got two concurrent processes trying to access a sqlite database via pydal. They open the database and then do a series of inserts.

One process always gets an error sqlite3.OperationalError: database is locked during one of the inserts (after many successful inserts).

The attempts parameter only seems to control the initial connection to the database, which is successful, but some time later during an insert operation it gets the 'locked' error and in that case there seems to be no handling of this condition and no way to try another attempt. Can pydal handle this for me?

Traceback (most recent call last):
  File "myprog.py", line 154, in process_image
    db_writer.add_rect(filename, rect)
  File "mydb.py", line 91, in add_rect
    self.db.Rects.insert(filename=filename,
  File "pydal/objects.py", line 855, in insert
    ret = self._db._adapter.insert(self, row.op_values())
  File "pydal/adapters/base.py", line 524, in insert
    raise e
  File "pydal/adapters/base.py", line 519, in insert
    self.execute(query)
  File "pydal/adapters/__init__.py", line 70, in wrap
    return f(*args, **kwargs)
  File "pydal/adapters/base.py", line 446, in execute
    rv = self.cursor.execute(command, *args[1:], **kwargs)
sqlite3.OperationalError: database is locked

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions