On Feb 7, 2008, at 9:28 PM, Richard Levasseur wrote:
> > Ok, so I've been looking into getting it to work when the child record > doesn't exist. I haven't had much luck. > > I wrote a stub mapper extension for translate_row and > populate_instance, but it doesn't seem to be called when it goes to > fetch the information for the child row. > mapper(Parent, parents, polymorphic.....) > mapper(Child, children, extension=MyExtension(def translate_row, def > populate_instance)) > > query(Parent) > my translate_row called > my populate_instance called > mapper.py:_get_poly_select_loader, the first inline post_execute is > called to fetch the data: > row = selectcontext.session.connection(self).execute(statement, > params).fetchone() > self.populate_instance(selectcontext, instance, row, isnew=False, > instancekey=identitykey, ispostselect=True) > > Shouldn't translate_row be called before then? In the working case > (child exists), neither of my extension methods are called, too. It > makes sense that they would only be called once per result, but in > this case a single result is actually 2 records fetch separately. can you supply a more specific example of how this schema works ? also, if a single result is a "2 record fetch", thats going to be extremely difficult to do - I'd want to look into perhaps supplying an alternate mapping for the schema. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---