[TransWarp] Strange EntityDM behavior

Phillip J. Eby pje at telecommunity.com
Tue Oct 7 16:32:52 EDT 2003

At 11:13 AM 10/7/03 -0700, John Landahl wrote:
>On Tuesday 07 October 2003 10:50 am, Phillip J. Eby wrote:
> > There is, however, a minor bug in your script: each TableDM opens
> > its own database connection, instead of sharing the one provided by
> > 'App'.  Instead of binding to 'DATABASE' they should be using a key that
> > you supply to 'offerAs', such as the PropertyName you are currently
> > supplying.
>In my actual application DATABASE points to PropertyName('db') much like in
>the Bulletins example.  I was in a bit of a hurry to get that e-mail out last
>night, so missed a substitution.  Thanks for pointing that out, though, and
>kudos to PEAK that it works either way.

It doesn't work "either way", actually.  Your code uses app.db() for the 
query at the end, which fails with an "OperationalError: database locked", 
because the TableDM is using its own DB connection.  Thus, there are two 
connections with ongoing transactions to the same file, which SQLite 
doesn't allow.

More information about the PEAK mailing list