Hi all, This list has been very helpful so far, thanks a lot. I was just wondering if there is a transparent way to assign polymorphic identities to ORM classes using single table inheritance. Let's say we have a base Task class:
class Task(DeclarativeBase): __tablename__ = 'Tasks' id = Column(Integer) name = Column(String) type = Column(String) etc... __mapper_args__ = {'polymorphic_on' : type} now I want to declare multiple Task types like this: class MyTask(Task): __mapper_args__ = {'polymorphic_identity': 'MyTask'} class YourTask(Task): __mapper_args__ = {'polymorphic_identity': 'YourTask'} This is the recommended way in the documentation for declarative style. I was wondering if I could get rid of the explicit "polymorphic_identity" setup in the subclasses by some clever programming trick. I want to assign the polymorphic identity to be the class __name__ automatically if that class extends Task class. I am not very well versed in advanced python programming like decorators or function/class wrappers, so I wanted to seek your opinion. Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---