我有一个复合模型看起来像这:在
class Parser(MapAttribute):
ParserType = UnicodeAttribute()
MailBody = UnicodeAttribute()
BestTemplate = UnicodeAttribute(null=True)
ParseStatus = ParseStatus()
ParsedOutput = JSONAttribute()
class OMPStatusModel(Model):
"""
PynamoDB Model handling table OMPStatus
"""
class Meta:
table_name = 'OMPStatus'
region = 'us-east-1'
SNSMessageID = UnicodeAttribute(hash_key=True)
CreatedDateTime = UTCDateTimeAttribute()
UpdatedDateTime = UTCDateTimeAttribute(null=True)
CompletedDateTime = UTCDateTimeAttribute(null=True)
ProcessStatus = UnicodeAttribute()
ErrorDetail = UnicodeAttribute(default="Not set")
SES = SES(null=True)
SNS = SNS(null=True)
Parser = Parser(null=True)
除了ParsedOutput存储为DynamoDB中的键值对列表外,这一切都很好。为了便于支持团队阅读,我想把它分解成自己的属性列表—为了便于讨论,假设它们都可以是UnicodeAttribute()。在
我在想我应该能做点什么比如:在
^{pr2}$那就做点什么吧比如:在
OMPStatusModel.update(actions=[OMPStatusModel.SES.set(kwargs[key]),
OMPStatusModel.UpdatedDateTime.set(datetime.now())])
不太明白,因为它不太管用。 有什么建议吗?在
归根结底是我没有把正确的物体传给地图。一旦我这样做了,效果很好。在
相关问题 更多 >
编程相关推荐