> > Bobby Impollonia wrote: >> >> Is there a video or slides from that pycon talk available online? I >> see the overview on the pycon site >> (http://us.pycon.org/2009/tutorials/schedule/2PM4/) and it looks very >> interesting.
we haven't put anything on line as of yet. I also just remembered that the section where I talked about the "foo_id" issue was probably not in the final slides we used. >> I looked more at what you said about the parent id column taking >> precedence and that does seem to be what happens. In particular, I see >> that the sql generated for >> session.query(Child1).filter( Child1.id.in_( range(5))) .count() >> uses the IN condition on parent.id in .53, whereas it was on the >> child1.id in .48. The .48 behavior seems better here. I can't think of >> a situation where I would say Child1.id and want it to use the column >> from the parent table instead of the child. I ran the tests with the order reversed and not too much failed. but here's one of the surprises you'll get: p = session.query(Parent).filter(...some criteiron...).one() suppose you get a Child1 object from the above. Then say: print p.id "id" is now child1.id. the above load will *force a load of the child table*, even though parent.id is right there. If the guts of column attributes were really overhauled to adjust for every scenario, meaning Child.id gives you child1.id, but the instance somechild.id knows to give you the value bound to parent.id, I suppose it may be possible for there to be no surprises. but at the core of it, the mapper maps columns to your class. if you're mapping a single class to two tables, the docs/mapper should make it apparent that the attribute is shared between two columns and if you want direct access to both, you should split them up. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---