On Sunday, 8 March, 2020 21:24, Peng Yu <pengyu...@gmail.com> wrote:
>When I open an sqlite3 db using the following python code, >conn=apsw.Connection(filepath, flags = apsw.SQLITE_OPEN_READONLY) >, I got the following error. >Traceback (most recent call last): > File "/xxx.py", line 21, in <module> > for x in c.execute('SELECT (data) FROM sqlar'): > File "src/cursor.c", line 236, in resetcursor >apsw.BusyError: BusyError: database is locked >The db file is currently processed by a python script which opens the >db file for writing in the following way. >conn = apsw.Connection(filepath) >Since the first process just reads, I'd like it not be blocked. What >is the correct way to do so? Thanks. Opening a connection with the SQLITE_OPEN_READONLY only means that the connection cannot write to the database using that connection. It does not affect the locking and transaction system in any way. Merely that if you try to "write" using the readonly connection that you will get an error to the effect that the connection is read-only. Perhaps you want to set a busy timeout or use WAL journal mode. -- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users