我的继承层次结构如下所示:
Fruits
Apples (has type='apple')
GrannySmith (has type='grannysmith')
Rotten (does not have a mapping defined)
当实例化Rotten
类型的东西并试图在apple中设置一个具有列的属性时,我看到以下错误:
File ".../sqlalchemy/orm/attributes.py", line 228, in __set__
self.impl.set(instance_state(instance),
AttributeError: 'NoneType' object has no attribute 'set'
我不知道为什么会这样,但是如果我将Rotten
映射到一个类型,我就看不到这个问题了。知道我为什么要画一个类吗
我希望能够对父类可能恰好映射到表的类进行子类化,但不要求子类具有任何数据库交互
有关在最后一行显示异常的示例,请参见gist
目前没有回答
相关问题 更多 >
编程相关推荐