I am quite familiar with cascade; I just couldn't figure out how it could
assist you.
In my opinion, Field('....','reference other_table', unique=True) should
be supported and work. Maybe you added the constraint later and the DB
didn't accept it because you already had duplicated field contents.
In any case, even if unique=True is not working for the moment, then a
work-around would be to make a unique index on the field yourself. You'll
have to handle exceptions when the insert/update fails due to duplicate
keys.
On Tuesday, September 11, 2012 12:48:49 PM UTC+1, martzi wrote:
>
> Thanks for the reply. But if you meant Field('....','reference
> other_table', unique=True), I have tried that with failure, i am still
> having a one-to-many relation. FYI: Regarding CASCADE, an ondelete cascade
> causes deletion of all referred data.
>
> On Tuesday, September 11, 2012 1:37:59 PM UTC+2, villas wrote:
>>
>> I may be wrong, but I do not think Cascade could assist you with
>> enforcing a 1-1 relationship.
>> Maybe making the foreign key field unique would help?
>>
>>
>> On Monday, September 10, 2012 11:45:28 AM UTC+1, martzi wrote:
>>>
>>> Hi,
>>> I wonder if there a way to enforce a one to one relationship with
>>> Cascade via web2py DAL API. ???
>>>
>>
--