Sniff, was Re: [ZODB-Dev] Copying instances between multiple storages

Christian Reis kiko@async.com.br
Wed, 22 May 2002 10:09:40 -0300


On Wed, May 22, 2002 at 09:26:19AM +0100, Toby Dickenson wrote:
> On Tuesday 21 May 2002 10:21 pm, Christian Reis wrote:
> 
> >If I defined __*copy__, could I get around the natural limitation of
> >copy (you'll notice I have no idea how it works :-)
> 
> I dont see any reason why not from reading the source for copy.
> 
> (its an easy read, so you might want to check it out.)

Thanks for this suggestion. I'll be using it :-)

> >The problem is the object references - when I synced the store
> >databases, can I guarantee they can still find the original object
> >references to the external database products?
> 
> You didnt say what the 'object references' are, but I assume you mean a 

Oh, I meant references to products, but you got it perfectly.

> What you can do is use some application-level cross-database key instead of 
> ZODB-managed object references. For example, your products DB contains 
> product objects in a BTree (or whatever) indexed by product_code, then 
> objects in your store DB contain a product_code

Yes, but then we loose all the automatic beauty of the ZODB persistence.

I might have to do this, but I'm considering alternatives. I might be
able to get away with a smart copy() which sets up the object references
in the destination database for me - but I'll need some key to identify
my instances so I can find them.

I'm still a bit confused about it, but thanks for your help in sorting
myself out.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL