avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Armstrong <chris.armstr...@idsoftware.com>
Subject Re: record containing array of records in python-avro
Date Fri, 11 Feb 2011 16:59:22 GMT
On 02/10/2011 07:25 PM, Christopher Armstrong wrote:
> Hi guys. I'm having trouble declaring a record with an array of 
> records in Python.

Actually, this is a red herring. The problem is much simpler: I can't 
have a record that contains an array as a field. Is this possible?

>>>  parse('{"name": "outer", "type": "record", "fields": [{"name": "a", "type":
"array", "items": "string"}]}')
array a False None None<avro.schema.Names object at 0x7f7f8acbb490>
Traceback (most recent call last):
   File "<stdin>", line 1, in<module>
   File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 709, in parse
     return make_avsc_object(json_data, names)
   File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 665, in make_avsc_object
     return RecordSchema(name, namespace, fields, names, type)
   File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 601, in __init__
     field_objects = RecordSchema.make_field_objects(fields, names)
   File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 569, in make_field_objects
     new_field = Field(type, name, has_default, default, order, names)
   File "/home/radix/lib/python/avro-1.4.1-py2.6.egg/avro/schema.py", line 311, in __init__
     raise SchemaParseException(fail_msg)
avro.schema.SchemaParseException: Type property "array" not a valid Avro schema: Could not
make an Avro Schema object from array.

Christopher Armstrong, id Software

View raw message