尝试补充您
Comment.__mapper_args__的内容:
__mapper_args__ = { 'polymorphic_identity': 'comment', 'inherit_condition': (id == Entity.id),}PS我不明白你需要什么
_idref关系?如果要在
Entity预期的地方使用注释,则可以
Comment按原样传递实例。

尝试补充您
Comment.__mapper_args__的内容:
__mapper_args__ = { 'polymorphic_identity': 'comment', 'inherit_condition': (id == Entity.id),}PS我不明白你需要什么
_idref关系?如果要在
Entity预期的地方使用注释,则可以
Comment按原样传递实例。