Hi, I have seen a few related questions but never a clear answer. I have a set of core models defined using a declarative form. These models are used by multiple applications.
In each application we however want to extend this model class with helper methods. Since these methods are application specific, they cannot be define in the model itself. I have tries multiple ways with no success and all pretty gross in my opinion: 1. Subclass the original model, catch the SA load event and set __class__ to whatever I want. Problem: mapper was getting confused if the original model and the subclass had the same name. 2. Modify __bases__ and and my helper class to inject methods. Problem: it fails with model inheritance. 3. Monkey patch the module itself (models.MyModel = MyCustomModel). Problem: Mapper fails right away (class not mapped) 4. Monkey patching the class and add methods and attributes: best solution so far. What is the recommended way? I would love to be able to subclass the model and tell the mapper to use that new class instead... Thank you Arthur -- 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.