what do we name / where do we put the reconsitute hook ?
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)
-
-
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
hadreconstitute(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 thenquery.options(extension(MyExtension()))
wouldn't work but I feel like saying who cares on that one) -
reporter - changed status to resolved
decorator as well as MapperExtension method are implemented/unit tested in 3cd10102e44db28d5fb787c7492e2ac2f7a4e4f9. the MapperExtension method only works at a mapper()-level config, not Query.
-
reporter - removed milestone
Removing milestone: 0.5.0 (automated comment)
- Log in to comment
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.