I do not know if this should be in web2py or not but it can be useful
for testing and debugging.
from gluon.contrib.populate import populate
db=DAL()
db.define_table('person',
Field('name'))
db.define_table('dog',
Field('name'),
Field('person',db.person),
Field('description',length=50),
Field('birthdate','date'))
populate(db.person,5) ### guess what it does?
populate(db.dog,10)
print 'owner, dog name, description, birthdate'
for row in db(
db.person.id==db.dog.person).select():
print
row.person.name,
row.dog.name, row.dog.description,
row.dog.birthdate
sample output:
owner, dog name, description, birthdate
masasapo cedutopo M.c..Berridge. an untutored bird s wing is famili
2000-07-31
posodaso todacoco Surely follows that these fiery eruptions at 186 0
2002-06-16
posodaso dutocomo Spread over functioning properly the planet the ec
1997-05-10
masasapo macocedu Modes of protozoa and continually added to be shot
2003-08-30
masasapo cetomaso Circling round and explosively from the flesh avai
1990-07-27
posodaso codacopa Fractions showing a dull white polar cap. illustra
1987-11-26
dudamoso cesotaco Economically; a mastery of which the two feet four
2003-04-02
dudamoso tasapoma Accomplishment would explode and open-sea knife-bl
1994-05-18
samotomo dasapama Highly specialized in which they come to the creat
1998-11-27