【发布时间】:2015-05-15 09:16:59
【问题描述】:
我有一个问题。 我制作了以下 avro 架构:
{
"namespace": "foo",
"fields": [
{
"type": [
"string",
"null"
],
"name": "narf"
},
{
"namespace": "foo.run",
"fields": [
{
"type": [
"string",
"null"
],
"name": "baz"
}
],
"type": "record",
"name": "foo"
}
],
"type": "record",
"name": "run"
}
当我尝试编译时,我得到以下错误:
/usr/bin/python3.4 /home/marius/PycharmProjects/AvroTest/avroTest.py 回溯(最近一次通话最后): 文件“/home/marius/PycharmProjects/AvroTest/avroTest.py”,第 11 行,在 schema = avro.schema.Parse(open("simple.avsc").read())
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 1283 行,在 Parse return SchemaFromJSONData(json_data, names)
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 1254 行,在 SchemaFromJSONData 返回解析器(json_data,names=names)
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 1182 行,在 _SchemaFromJSONObject other_props=other_props,
init中的文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 1061 行> 字段 = make_fields(names=nested_names)
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 1173 行,在 MakeFields 返回元组(RecordSchema._MakeFieldList(field_desc_list, names))
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 986 行,在 _MakeFieldList yield RecordSchema._MakeField(index, field_desc, names)
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 957 行,在 _MakeField 名称=名称,
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 1254 行,在 SchemaFromJSONData 返回解析器(json_data,names=names)
文件“/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py”,第 1135 行,在 _SchemaFromJSONString % (json_string, sorted(names.names)))
avro.schema.SchemaParseException:未知命名架构“记录”,已知名称:['foo.run']。
我不知道为什么。在我看来,错误是名为“foo”的记录,但我给的命名空间(“foo.run”)在命名空间列表中,但无论如何都会引发错误。我想我误解了一些关于命名空间的东西,但我不知道是什么。
问候 马吕斯
【问题讨论】:
标签: namespaces avro