I currently have 3 data tables setup, one is an intermediate table linking 
a many to many relationship. I would like to use UUID as the reference ID, 
so I insert the uuid into the intermediate table instead of the normal ID.

However this doesn't work as expected, all the fields in the relational 
data table are 0 after inserting the UUID.

My db.py code below:




db = DAL('sqlite://storage.sqlite')

import uuid

db.define_table('people',
Field('uuid', length=64, default=uuid.uuid4(), 
notnull=True,writable=False,unique
=True),
Field('person'),
Field('age'), format='%(person)s')

db.define_table('foods',
Field('uuid', length=64, default=uuid.uuid4(), 
notnull=True,writable=False,unique
=True),
Field('food'),
Field('foodtype'), format='%(food)s')

db.define_table('people_food',
Field('person',db.people),
Field('foods',db.foods))


db.people_food.person.requires = IS_IN_DB(db,db.people.uuid,)
db.people_food.foods.requires = IS_IN_DB(db,db.foods.uuid,)


I am doing this so my references won't break, as the regular ID may change 
if the database isn't empty. Any idea what I'm doing wrong here?

-- 



Reply via email to