Great; I appreciate it. Do you still want me to open a ticket with a suggestion for an enhancement?
Regards, Michael On Monday, September 10, 2012 5:29:12 PM UTC-6, Massimo Di Pierro wrote: > > Anyway, I changed the code in trunk so that the example in the book works > as described. > > On Monday, 10 September 2012 17:27:01 UTC-5, Massimo Di Pierro wrote: >> >> There is a mistake in the book. It should have been: >> >> rows = db(db.person).select(db.person.ALL, db.dog.ALL, join=db.dog.on( >> db.person.id==db.dog.owner)) >> >> or >> >> rows = db(db.person).select(db.person.ALL, db.dog.ALL, left=db.dog.on( >> db.person.id==db.dog.owner)) >> >> Perhaps is should default to select all fields as he book suggests. I >> will look into this. Please open a ticket with a suggestion for enhancement. >> >> On Monday, September 10, 2012 4:58:25 PM UTC-5, MichaelF wrote: >>> >>> I have a db structure similar to the person/dog tables in section "6.21 >>> One to many relation." I try the inner join (second form, from the book): >>> >>> 1 >>> rows = db(db.person).select(join=db.dog.on(db.person.id >>> ==db.dog.owner)) >>> 2 >>> for row in rows: >>> 3 print row.person.name, 'has', row.dog.name >>> 4 Alex has Skipper >>> 5 Alex has Snoopy >>> 6 Bob has Puppy >>> >>> In my db the 'person' table is 'Meet', and 'dog' is 'Session'. Here's >>> what I used: >>> >>> meetAndSession = db(db.Meet).select(join=db.Session.on(db.Meet.id == >>> db.Session.Meet)) >>> >>> I get back the 'person' ('Meet') fields, but not the 'dog' ('Session') >>> fields. For the Meet.Session field I get back a Set object. Should I be >>> using that as the set of Session records associated with the Meet record. >>> (I tried to reference row.Meet.Session.id, but got told there was no >>> such field. I also tried row.Session.id and got told the same thing.) >>> As the example shows row.dog.name, shouldn't I have a >>> row.Session.<fieldName>? >>> >>> Here's what "db stats" tells me it used: >>> >>> SELECT Meet.id, Meet.Meet_name, Meet.Start_date, Meet.End_date, >>> Meet.Is_championship FROM Meet JOIN Session ON (Meet.id = Session.Meet) >>> WHERE (Meet.id > 0); >>> >>> >>> Given that, of course I'm getting no 'dog' ('Session') fields. What am I >>> missing? >>> >>> >>> Thanks. >>> >>> --