[ZODB-Dev] Multiple independant ZODB

Christian Theune ct at gocept.com
Fri May 14 04:31:27 EDT 2010


On 05/14/2010 10:06 AM, Matthew Noble wrote:
> I have only just started to use ZODB and have been able to use it with
> ease so far.
>
> I want to be able to have access to multiple ZODB databases at the same
> time that are completely independent.
>
> What I cannot see how to do is to keep the changes to the objects from
> each database separate – that is making the transaction commits only
> occur for one database at a time even if changes have occurred to
> multiple databases between commits.
>
> Can the transactions be made specific to a particular database or
> connection?

Yes.

The default transaction functions in transaction.commit/abort/... work 
with a transaction manager that selects the active transaction based on 
the thread from which it is called.

Whenever you open a connection using DB.open() you can pass in a 
different transaction manager and thus get different transactions with 
as many databases as you like.

Christian

-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1
Zope and Plone consulting and development



More information about the ZODB-Dev mailing list