[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Sqlite3 'database is locked' errors
From:       Brian Zambrano <brianz () gmail ! com>
Date:       2012-01-24 6:39:27
Message-ID: CAE18oz-SWXZXW-U6soeEgESDk16V5jjsMu8LsE3ByCSQWkgLXw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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
>

[Attachment #5 (text/html)]

I ended up solving this but it&#39;s very odd.<div><br></div><div>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.</div> \
<div><br></div><div>BZ</div><div><br></div><div><br><div class="gmail_quote">On Thu, \
Jan 19, 2012 at 11:24 PM, Brian Zambrano <span dir="ltr">&lt;<a \
href="mailto:brianz@gmail.com">brianz@gmail.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">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 &quot;drop \
table&quot; for each table.  However, I&#39;m continuously getting:<div> <br></div>
<div>&quot;database is locked Unable to fetch \
row&quot;</div><div><br></div><div>after each &quot;DROP table table_name&quot; \
statement.  There are no other queries I&#39;m running or uncommitted transactions.  \
Can some of my QSql* widgets be holding on to locks which prevent the tables from \
being dropped?</div> <span class="HOEnZb"><font color="#888888">
<div><br></div><div>BZ</div>
</font></span></blockquote></div><br></div>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic