1

I cannot execute UPDATE statements in my Flask App deployed to Azure App Service (Linux). It says:

Database is Locked.

SELECT statements are executed as expected. On the local machine work UPDATE statements as expected.

I have tried to change the isolation_level (DEFERRED, EXCLUSIVE, IMMEDIATE). I have also tried to CHMOD on the data folder but that looks right.

with sql.connect(connstring) as con:
cur = con.cursor()
cur.execute("Update INNOVATIONPOWER_MESSAGES SET innovative = 0 WHERE id = 21187")
con.commit()
1
  • 1
    Are you missing indentation..? Commented Sep 6, 2019 at 16:21

1 Answer 1

0

Checking other similar questions (OperationalError: database is locked), it seems like the general response from users is that they had bad code that wasn't closing the sessions properly. High volume applications, will eventually outgrow SQLite's concurrency capabilities, but if you suspect that's not the case for your application, try double checking your code in case it isn't handling (closing) sessions properly.

Rewriting your code to reduce concurrency and ensure that database transactions are short-lived.

Sign up to request clarification or add additional context in comments.

1 Comment

I have restarted the app services and ensured that this is the first SQL statement to the database. Event the results is "Database is Locked".

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.