[PyQt] Sqlite3 'database is locked' errors

Brian Zambrano brianz at gmail.com
Tue Jan 24 06:39:27 GMT 2012


I ended up solving this but it's very odd.

I do my own DB work with QSqlQuery, but commit any transaction I open.  I
have two QSqlTableModels which I use.  In one of the QSqlTableModels I was
using setQuery to select a subset of the columns I needed.  That ended up
being the issue.  When I remove the setQuery call and simply ignore the
unneeded columns from the view, everything works.

BZ


On Thu, Jan 19, 2012 at 11:24 PM, Brian Zambrano <brianz at gmail.com> wrote:

> In my application I have a Sqlite db which at times needs an updated
> schema.  To work around some issues on Windows, I need to do "drop table"
> for each table.  However, I'm continuously getting:
>
> "database is locked Unable to fetch row"
>
> after each "DROP table table_name" statement.  There are no other queries
> I'm running or uncommitted transactions.  Can some of my QSql* widgets be
> holding on to locks which prevent the tables from being dropped?
>
> BZ
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120123/f0024d92/attachment.html>


More information about the PyQt mailing list