Avro Namespace Error -
i have question. made following avro schema:
{ "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" }
when try compile following error:
/usr/bin/python3.4 /home/marius/pycharmprojects/avrotest/avrotest.py traceback (most recent call last): file "/home/marius/pycharmprojects/avrotest/avrotest.py", line 11, in schema = avro.schema.parse(open("simple.avsc").read())
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 1283, in parse return schemafromjsondata(json_data, names)
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 1254, in schemafromjsondata return parser(json_data, names=names)
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 1182, in _schemafromjsonobject other_props=other_props,
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 1061, in init fields = make_fields(names=nested_names)
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 1173, in makefields return tuple(recordschema._makefieldlist(field_desc_list, names))
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 986, in _makefieldlist yield recordschema._makefield(index, field_desc, names)
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 957, in _makefield names=names,
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 1254, in schemafromjsondata return parser(json_data, names=names)
file "/usr/local/lib/python3.4/dist-packages/avro_python3_snapshot-1.7.7-py3.4.egg/avro/schema.py", line 1135, in _schemafromjsonstring % (json_string, sorted(names.names)))
avro.schema.schemaparseexception: unknown named schema 'record', known names: ['foo.run'].
and have no idea why. in mind error record called "foo" namespace gave ("foo.run") in namespacelist ut raises error anyways. guess misunderstand regarding namespaces not figure out what.
greetings marius
ok found error, generated schema own program , had bug when nested record appears within nested record. # see: how nest records in avro schema?
Comments
Post a Comment