Bill Denney wrote:
> Oleg Broytmann wrote:
>> You can use ForeignKey or SingleJoin for one-to-one
>> relation, MultipleJoin for one-to-many or RelatedJoin for many-to-many.
>>
>> Oleg.
> What is the difference between using a SingleJoin and a ForeignKey? Is
> it possible to use SingleJoin in one direction and MultipleJoin in
> another direction? Are there efficiency differences between the two?
> Now after the barrage of questions, here is why I'm asking:
>
> I have several tables that are generally something like:
>
> class House(SQLObject):
> notes = MultipleJoin('Notes')
>
> class Room(SQLObject):
> notes = MultipleJoin('Notes')
>
> class Notes(SQLObject):
> house = MultipleJoin('House')
> room = MultipleJoin('Room')
> info = StringCol()
>
> A house may have multiple Notes and a room may have multiple notes, but
> a note should only go with one house or room. Is this the best way to
> do it, or should I be using SingleJoin for both of the joins in Notes,
> or is there some other better way to do it?
>
> Thanks,
>
> Bill
The house and room parameters in Notes should probably be
ForeignKey('House') and ForeignKey('Room'). Only RelatedJoin uses the
same keyword at each end of the "link" between classes.
Thanks,
Nick
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss