On Mon, Apr 17, 2006 at 12:48:41AM -0700, Stever wrote:
> I want to have two tables with a one-to-one relationship. If I enter in
> an item in TableA, there should be a corresponding record in TableB.
> They should be hooked up with field [id]. This is what foreign keys are
> for, right? To make sure that the two tables are consistent and have
> referential integrity. I would imagine you define the primary/foreign
> key in the python object. And SQLObject would take care of the nitty
> gritty details.
I don't understand what do you want to do and to avoid. What usage
pattern do you want to follow, and what to prevent? The code you posted in
the beginning of the thread looks good:
InsertOne = TableA(VarA = 'foo')
InsertTwo = TableB(VarC=200, VarD=InsertOne.id)
That's ok. You can even do
InsertTwo = TableB(VarC=200, VarD=InsertOne)
Oleg Broytmann http://phd.pp.ru/ phd@...
Programmers don't die, they just GOSUB without RETURN.