[PyKDE] PyQt and database locking problems

Hans-Peter Jansen hpj at urpla.net
Tue Dec 19 19:28:55 GMT 2006

Am Dienstag, 19. Dezember 2006 18:02 schrieb joanne matthews (RRes-Roth):
> I am getting database locking problems with pyqt and sqlite when I
> execute a QSqlQuery.
> I don't have the same error if I use another database with less records
> in the table.
> Also, If I scroll to the bottom of the qTableView then execute the
> query, I don't get
> A database locked message. This problem has been driving me insane now
> for quite sometime
> As I have now run out of ideas to try.  If the problem was due to there
> being an active query
> On the database then why does it work if I just scroll down to the
> bottom of the table?
> I have attached some source code which demonstates the
> Problem and a database. Clicking on remove should just remove the
> selected row from the table.
> I have tried model.clear(), qsqlquery.clear(), transaction() and
> commit().
> I've also increased the sqlite timeout.
> If anyone can advise me or tell me why I'm getting the problem I'd be
> Really greatful.

Well, from your description you're most probably bitten due to Qt delaying 
the table fetch until the records are needed (displayed).

You should consider using another db connection..


More information about the PyQt mailing list