[ZODB-Dev] Referential integrity
Greg Ward
gward@mems-exchange.org
Fri, 1 Mar 2002 08:54:06 -0500
On 01 March 2002, Steve Alexander said:
> 1: Try to write your programs to respect referential integrity, and run
> Greg Ward's Oscar every night to catch problems.
It's called "Grouch" now, BTW.
Also, Grouch currently doesn't recognize constraints like "notnone" in
its type language. (I believe the type-checker will enforce those
constraints, but the only way to get them into the schema is through
Python code. You can't put them in your docstrings... yet.)
Oh, a fourth idea: add a __getstate__() method that doesn't actually get
an object's state, but makes sure that the object is sane. That way you
catch problems at pickle-time. The problem is what to do with the
problem; AFAIK exceptions in __{get,set}state__() are thrown away.
You'd probably want a special "database integrity violation" log, with
alarm bells going off if it is ever written to.
Greg
--
Greg Ward - software developer gward@mems-exchange.org
MEMS Exchange http://www.mems-exchange.org