[ZODB-Dev] Packless and copyTransactionsFrom()????

Jim Fulton jim@zope.com
Mon, 20 Aug 2001 18:31:45 -0400


"John D. Heintz" wrote:
> 
> On Monday 20 August 2001 16:42, Jim Fulton wrote:
> >
> > Another way to look at this is that using _p_oids for
> > application-meaningful purposes is like using application-meaningful data
> > for primary keys in relational databases.
> 
> But this is commonly done ;-)

Right, which is why I put a smiley on by "bad bad bad" remark. :)

(snip)

> Something just occured to me:  In both recent and older threads implementing
> __hash__() and __cmp__() on Persistent has come up.  Isn't there a serious
> risk with Persisntent objects as keys in BTrees and export/import? 

Yup.

Now, using persistent objects in (persistent) dictionaries 
has different issues. If you pickle a dictionary with persistent keys, 
they keys thyemselves, rather than hash codes are output, so 
the fact that hash codes might change isn't a problem.

OTOH, if you tried to create a persistent hash that split keys over 
multiple records based on the has codes, then the stability of the hash
codes would be an issue.

OTOH, export/import has *copy* semantics. If you try to index (hash or BTree)
objects based on identity, then operations, like export/import is bound
to be ... interesting.

If indexing based on identity is important, then it would be a case where
database supported (rather than app level) indexes are needed.

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org