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)
   (in 0.7.1)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to