I've seen both, and I think that the second doesn't make a foreign key
constraint, it just creates an int field... not sure though.
I come from a SQL background, so I could write the queries myself and have
stored procedures, but I'm trying it the "web2py" way, as I think
eventually, this may be put on a linux system. That whole DRY principle is
important. Anyway, I only mention it because I think that having a foreign
key constraint is good practice, since you can tell from the structure of
the database how the tables are related.
On Wednesday, March 21, 2012 11:22:45 AM UTC-7, pbreit wrote:
>
> I think it needs to be 'reference db.customers'
>
> Are these equivalent? Is there a preferred usage?
>
> db.define_table('dog',
> Field('owner', 'reference db.owner'))
>
> db.define_table('dog',
> Field('owner', db.owner))
>