Re: [SQLObject] Optional One to One Relationships
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: CLIFFORD I. <cli...@di...> - 2004-06-17 13:08:38
|
At 07:27 AM 17/06/2004 -0400, CLIFFORD ILKAY wrote: >Hi, > >How would you represent an optional one to one relationship with >SQLObject? A use case would be a system where there is a table for person >and another for donor. A person can be a donor but need not be a donor. If >a person becomes a donor, there must not be more than one donor row. >Donations are handled in another table. Answering my own question, one way of dealing with this is to make the foreign key in the dependent table unique. e.g. create table donor ( id serial primary key, person_id integer unique reference person(id), ... Now to figure out how to capture and decode the errors raised by PostgreSQL. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |