You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Marius <m....@googlemail.com> on 2015/05/15 11:03:21 UTC
Unknown named record
Hey,
i have a question regarding namespaces,
i have the following schema:
{
"namespace":"foo",
"fields": [
{
"type": [
"string",
"null"
],
"name":"sampleRef"
},
{
"namespace":"foo.run",
"fields": [
{
"type": [
"string",
"null"
],
"name":"baz"
}
],
"type":"record",
"name":"foo"
}
],
"type":"record",
"name":"run"
}
the problem is if i try to parse the schema it gives me the following error and i have no idea why:
/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 <module>
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'].
Thanks
Marius
Re: Unknown named record
Posted by Harsh J <ha...@cloudera.com>.
Your question matches this answer: http://stackoverflow.com/a/11765060
On Fri, May 15, 2015 at 2:33 PM, Marius <m....@googlemail.com> wrote:
> Hey,
>
> i have a question regarding namespaces,
>
> i have the following schema:
>
> {
> "namespace": "foo",
> "fields": [
> {
> "type": [
> "string",
> "null"
> ],
> "name": "sampleRef"
> },
> {
> "namespace": "foo.run",
> "fields": [
> {
> "type": [
> "string",
> "null"
> ],
> "name": "baz"
> }
>
> ],
> "type": "record",
> "name": "foo"
> }
> ],
> "type": "record",
> "name": "run"
> }
>
> the problem is if i try to parse the schema it gives me the following error
> and i have no idea why:
>
> /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
> <module>
> 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'].
>
>
> Thanks
>
> Marius
--
Harsh J