On Tuesday, September 11, 2012 3:59:45 PM UTC-4, martzi wrote:
>
> FYI : putting all the fields in one table will result to multiple columns 
> ...
>

I don't understand the objection -- that's the idea -- let the table have 
multiple columns instead of moving those columns to other tables.

But I'm wondering, maybe you really want a one-to-many relationship but 
with a multi-column constraint in the second table:

db.define_table('bodypart', Field('name'), Field('owner', 'reference person'
, unique=True)) 

In the above, is your goal to allow a given person to have multiple entries 
in the bodypart table, but only one entry per body part "name"? If that's 
the case, then you don't want a "unique" contraint on the "owner" field -- 
that will literally allow only one entry per person in the entire table 
(i.e., each person can be associated with only one body part). Instead, you 
want a multi-column constraint such that each combination of "name" and 
"owner" is unique (but "owner" by itself does not have to be unique). Is 
that what you're trying to do?

Anthony

-- 



Reply via email to