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

Toby Dickenson tdickenson@geminidataloggers.com
Wed, 22 May 2002 09:26:19 +0100


On Tuesday 21 May 2002 10:21 pm, Christian Reis wrote:

>> >And deepcopy provides me the same error, so I probably have to define
>> >__*copy__ if it is to work, right?
>
>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.)



>> have you considered a solution at a lower layer; rsync Data.fs ?
>
>Well, I have, actually. The thing is, my problem isn't that simple.
>
>I have a set of stores that collect sales information. They also share a
>common product database. The stores need to update a central server
>nightly.
>
>The product database could be rsynced, I think, and even the sales
>information if each store had a separate .fs file.
>
>Central server's DB
>
>Store A     Store B     Store C
>
>   +------------+-----------+
>
>             Products
>
>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 
reference from an object in the store DB to an object in the products DB.
ZODB cant do cross database references. that is true at a very fundamental 
level. That is true whether either database is shared using ZEO, or a read 
only rsynced data.fs

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

>IOW, can we have stored references in ZODB that are cross-database-files?

no no no no no no no no no no no no no no no no no no