Some docs on what's "fair game" in extensions would be good

Issue #1913 resolved
Chris Withers created an issue

After reading:

http://www.sqlalchemy.org/docs/orm/interfaces.html

...I'm still left wondering what's fair game to do in each of the methods of SessionExtensions and MapperExtensions.

For example, it's probably not a good idea to implement a versioned rows extension as a MapperExtension, however, there's no clue in the docs as to why that might be.

Yes, what makes sense can likely be infererred from reading through the source, but it'd be good to know what the intension is in terms of what sort of things are/aren't sensible to do in any of the methods...

Comments (4)

  1. Mike Bayer repo owner

    there is a clue for sure:

    http://www.sqlalchemy.org/docs/orm/interfaces.html?highlight=mapperextension#sqlalchemy.orm.interfaces.MapperExtension.before_insert

    Column-based attributes can be modified within this method which will result in the new value being inserted. However no changes to the overall flush plan can be made, and manipulation of the Session will not have the desired effect. To manipulate the Session within an extension, use SessionExtension.

    we can't exactly predict various use cases like a "versioned" extension. There are certainly ways to do versioning in the MapperExtension, and efficiently too - just issue INSERT statements on the provided connection.

  2. Log in to comment