【发布时间】:2021-02-08 08:22:13
【问题描述】:
看起来以下不适合 avro 架构:
[{'page_title': 'Antoine Meillet', 'page_id': 3, 'contributors': [['contribution', {'revisions': 2, 'username': 'Curry'}], ['contribution', {'revisions': 1, 'username': 'script de conversion'}], ['contribution', {'revisions': 1, 'username': 'Francis'}]]}]
架构:
{
"namespace": "org.wikipedia.fr",
"name": "meta-history",
"type": "record",
"fields": [
{
"name": "page_title",
"type": "string"
},
{
"name": "page_id",
"type": "int"
},
{
"name": "contributors",
"type": {
"type": "array",
"items": {
"type": "record",
"name": "contribution",
"fields": [
{
"name": "revisions",
"type": "int"
},
{
"name": "username",
"type": "string"
}
]
}
}
}
]
}
得到“ValueError: no value and no default for revisions”
不知道我在这里做错了什么......
【问题讨论】:
标签: python serialization avro