[storm] Confused about connections, cursors, transactions (SQLite)

Gerdus van Zyl gerdusvanzyl at gmail.com
Tue Jul 29 17:36:23 BST 2008


You are slightly doing things the wrong way you need to replace:

for feed in store.find(Feed):
    store.commit()

with:

store.flush() #send changes to database
store.commit() #commit transaction

see snippet: http://pastebin.com/f50699899

~Gerdus

On Tue, Jul 29, 2008 at 3:57 PM, Michael Elsdörfer <elsdoerfer at gmail.com> wrote:
> http://pastebin.com/f6d456520
>
> Have a look at the snippet above. Using SQLite, I get a transaction
> error (MySQL works fine).
>
> Note that the error occurs only if there are more than 10 rows in the
> database (the fetchmany arraysize apparently used). If you add less
> than then 11 feed objects, it works.
>
> Now I've been looking through the source code, but I'm not sure what
> to make of this issue. Each Store is a connection, and each query
> seems to use it's own cursor. The SQLite backend apparently sends
> BEGIN and COMMIT statements to the connection itself.
>
> Is this a bug in Storm? In pysqlite? A general SQlite limitation? I
> seem unable to recreate the problem using the pysqlite2 interface
> directly, but I'm probably not getting the transactions right.
>
> Am I supposed to use a separate Store object for the find()?
>
> Storm 0.12
> SQLite 2.4.0
> Windows
>
> Thanks for any help.
>
> Michael
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
>



More information about the storm mailing list