what do we name / where do we put the reconsitute hook ?

Issue #1070 resolved
Mike Bayer repo owner created an issue

Do we make it:

MapperExtension.reconstitute_instance(self, mapper, instance)

?

or object level:

class MyClass(object):
    @reconstitute
    def do_something(self):

if the latter, do we start moving all MapperExtension methods to decorators ? do we supply both interfaces ? (if the latter again, then that answers the Q for this ticket).

Having both interfaces might be nice.

Comments (4)

  1. jek

    it's an instance-level event that's independent of mapping, so definitely decorator. mapper extensions can hang events on the class manager directly during instrument_class, so that's also an option if there's no mapper extension interface method for this one.

  2. Mike Bayer reporter

    the decorator is cool, and if you want to add that in right now so I can give it to people who are on 0.5, that would be great.

    But I was also thinking that if MapperExtension had reconstitute(self, mapper, instance), mapper() could set up this to be called when it instruments. This because I'd prefer if at least one of an all-decorator or all-ME approach were feasable as far as the "how do I add hooks to SQLA's ORM" question. I'm concerned about the inconsistency of some customization requiring ME, some requiring decorators.

    then again if mapper() adds that event to all classes we've just added some latency, unless it looks into the ME beforehand to see if the method's been overridden (and then query.options(extension(MyExtension())) wouldn't work but I feel like saying who cares on that one)

  3. Log in to comment