Is it possible to open a locked sqlite database in read only mode?

后端 未结 2 1917
逝去的感伤
逝去的感伤 2021-02-13 12:56

I\'d like to open the chromium site data (in ~/.config/chromium/Default) with python-sqlite3 but it gets locked whenever chromium is running, which is understandable since trans

2条回答
  •  忘掉有多难
    2021-02-13 13:22

    Chromium is holding a database lock for long periods of time? Yuck! That's really not a very good idea at all. Still, not your fault…

    You could try just copying the database file (e.g., with the system utility cp) and using that snapshot for reading purposes; SQLite keeps all its committed state in a single file per database. Yes, there's a chance of seeing a partial transaction, but you will definitely not have lock problems on Unix as SQLite definitely doesn't use mandatory locks. (This might well not work on Windows due to the different locking scheme there.)

提交回复
热议问题