我有以下对象模型:
class Data(Model):
__keyspace__ = 'varilog'
__table_name__ = 'md_data'
id = columns.TimeUUID(partition_key=True, primary_key=True, required=True)
device = columns.Text(primary_key=True, required=True)
property = columns.Text(primary_key=True, required=True)
field = columns.Text(primary_key=True, required=True)
cyclestamp = columns.DateTime(static=True)
type = columns.Text(discriminator_column=True)
#text_value = columns.Text() # Will work
#value = columns.Text(db_field='text_value') # Will work but...
class DataText(Data):
__discriminator_value__ = 'str'
value = columns.Text(db_field='text_value') # Always None
#text_value = columns.Text() # Ok also
当我查询对象时,根据type
列的值,返回正确的对象(在此示例中为DataText
),但是value
是None
text_value
如果我取消注释db_field
,我将获得正确的值。
看起来子类中不支持exitValue()
。这是一个错误吗?