Re: [sqlalchemy] ORM: Implementing abstract base class that generates auxiliary tables for each child class

2017-02-21 Thread linlycode
Thanks Simon ! I got it working using the hack. I'm not using the "mapper_configured" event because I need to add a "parent" attribute to the subclass of TreeNode, which should be done before the mapping. On Friday, February 17, 2017 at 6:21:57 PM UTC+8, Simon King wrote: > > On Fri, Feb 17,

[sqlalchemy] ORM: Implementing abstract base class that generates auxiliary tables for each child class

2017-02-17 Thread linlycode
I want to achieve something like this: Base = declarative_base() # the abstract base, no table generated for it class TreeNode(Base): __abstract__ = True parent = Column(ForeignKey('child_class_table.id'), nullable=False) def is_root(self): pass def get_parent(self): pass # more methods #