Are you finished reading data and ready to release the lock you acquired on the database?
pysqlite in full automagic mode (the default) will magically start a transaction for you when you execute any statement. It will automatically commit the transaction after a DML statement (CREATE/DROP). In all other cases the transaction remains open until you explicitly end it with a commit or rollback operation. Magic mode can only be avoided by using isolation_level=None on every connection. This will turn off the pysqlite magic after which SQLite uses its default autocommit semantics -- that is behaves as it does from the sqlite3.exe shell -- where transactions are automatically begun and committed around each statement and transactions may be begun, committed, or rolled back, by your command (in the cylon way). In addition to None which disables magic, isolation_level can specify the "type" of magic to use by setting it to a string containing the "trailing part" of the BEGIN statements. The default of '' (an empty string) means to use unadorned magic (or bare BEGIN statements). Setting isolation_level='IMMEDIATE" causes the magic to read "BEGIN IMMEDIATE" whenever a transaction is begun on your behalf, meaning that a write lock is immediately acquired. Similarly the value "EXCLUSIVE" makes the magic read "BEGIN EXCLUSIVE" (immediately obtaining an exclusive lock). So, to ensure that no connection actually has a lock on the database you should either disable magic, or make sure that you commit or rollback each transaction (even read transactions) when you are done with them. Then, if you still have the error with the database being locked or busy it is not because you have a leftover in progress transaction somewhere. >-----Original Message----- >From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- >boun...@sqlite.org] On Behalf Of Mark Halegua >Sent: Wednesday, 8 October, 2014 19:51 >To: General Discussion of SQLite Database >Subject: Re: [sqlite] In python, determine database status > >Um, do a commit after I do db.fetchone()? > >Mark > > >On Wednesday, October 08, 2014 07:26:01 PM Keith Medcalf wrote: >> If you are not using explicit transactions are comitting them ... even >agter >> a read to release the locks? >> >> >> Sent from Samsung Mobile >> >> <div>-------- Original message --------</div><div>From: Mark Halegua >> <phanto...@mindspring.com> </div><div>Date:2014-10-08 16:12 (GMT-07:00) >> </div><div>To: General Discussion of SQLite Database >> <sqlite-users@sqlite.org> </div><div>Subject: Re: [sqlite] In python, >> determine database status </div><div> </div> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > >_______________________________________________ >sqlite-users mailing list >sqlite-users@sqlite.org >http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users