Paolo, You said, " I cannot move the pictures table declaration because both off them have references to each other (mutual reference?) "
Why would the tables have mutual references? What kind of relation would cause that? Here are the kinds of relations I know about. One to many; put the reference to the table with one in the table with many. db.define_table('dog', field('name')) db define_table('flea', field('dog', db.dog), field('gender')) Many to many: create a third table to embody the relationship; reference both tables. db.define_table('dog', field('name')) db.define_table('human', field('name')) db.define_table('dog_human', field('dog', db.dog), field('human', db.human)) One to one: put the reference in the table less likely to hold data. db.define_table('human', field('name')) db.define_table('doctor', field('human', db.human), field('specialty')) On Thursday, June 14, 2012 8:41:45 AM UTC-4, Paolo wrote: > > Hi all, > Actually > In route the field photo_id references pictures and in pictures the > field route_id references route. > > -- > Paolo > > Il 14.06.2012 09:56 Niphlod ha scritto: > > don't know precisely how dal works, but if a table have a field > > referenced in a table defined after that, wouldn't that cause a > > problem ? > > > > i.e. db.define_table('route', > > Field('photo_id', 'reference pictures', readable=False, > > writable=False) > > ) > > db.define_table('pictures', > > Field('name')) > > > > does not work, where > > db.define_table('pictures', > > Field('name')) > > db.define_table('route', > > Field('photo_id', 'reference pictures', readable=False, > > writable=False) > > ) > > > > instead works ? > > > > Not using web2py, for normal sql development, you have to create > > "child" tables before declaring a "parent" with references to it. > >