Re: [SQLObject] caching, threading & zope
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <gs...@sy...> - 2003-10-04 22:25:34
|
On 2003-10-04 22:40:30 +0200 Ian Bicking <ia...@co...> wrote:
hello,
> That's not really true anymore for CVS -- transactions aren't really
> working properly in 0.4. CVS has an expire method on SQLObject
> instances, which is called when an object is rolled back -- since 0.4
> didn't have this you couldn't use the attribute caching with
> transactions (since it wouldn't be accurate after a rollback).
ok :) - i am currently using the CVS version because i only got a traceback
when using transactions under 0.4.
btw, there's a typo in the 'transaction' chapter of the documentation
('_cacheValue' instead of '_cacheValues').
> However, while rollback expires objects in the transaction, commit
> doesn't expire objects outside of the transaction. But I'm not really
> sure how that should work anyway.
are there any reasons to mix queries which use transactions with queries
which doesn't in an application?
> Seems like you could go further, and just do:
>
> Transaction._abort = Transaction.rollback
> Transaction._finish = Transaction.commit
> Transaction._begin = lambda self: None
>
> Then (if I read your proxy correctly) the transaction can be used
> directly. Though really that should be done in a subclass of
> Transaction, and then mess with the .transaction() method to use a
> different class.
subclassing from both Transaction and TM isn't that easy/clean because
method names are overlapping (e.g. commit()). just adding the methods to the
class doesn't work either, because the transaction has to register itself
via the _register method first (which calls TM's commit() method). (i have
attached a new shorter version of the transaction proxy which i am currently
using.)
> As for passing the transaction, yes, it's a little annoying. I don't
> know how Zope does this for Z SQL Methods, but the problem is pretty
> much the same. Does Zope use Acquisition for this, or maybe using one
> transaction per thread?
i guess it's using acquisition, but i haven't looked into the source yet.
cu
/gst
<oodb.py>
|