Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database is locked, attempts not working #707

Open
howff opened this issue Apr 10, 2023 · 0 comments
Open

Database is locked, attempts not working #707

howff opened this issue Apr 10, 2023 · 0 comments

Comments

@howff
Copy link

howff commented Apr 10, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant