You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Lloyd Haris <ll...@gmail.com> on 2016/05/17 13:10:06 UTC

How do I create nested datums in python-avro

I have an avro schema which is deeply nested. It has records inside records
for example.

In Java I can create a GenericRecord and call put() method to put another
record in the main record for example.

Is there a way to do such things in python? It looks like I have to create
dictionaries by hand and put values in it according to the schema which is
very difficult when you have a deeply nested schema.

I can also see that we can create different types of schemas in python-avro
such as map schema, array schema, record schema etc. but I couldn't figure
out a way to combine several such schema's to create a bigger nested schema.

Can someone please tell me how to create a nested schema from sub schemas
and then create datums for those sub schemas and append them to create the
nested object if it's possible?

If it's not doable, how do you create deeply nested schemas and then write
datums according to those schemas in python?

Thank you
Lloyd