I have two avsc files in different directories -
1. com.company.model.AddressRecord.avsc
2. com.company.model.Customer.avsc
Here is address file
{
"type": "record",
"namespace": "com.company.model",
"name": "AddressRecord",
"fields": [
{
"name": "streetaddress",
"type": "string"
},
{
"name": "city",
"type": "string"
},
{
"name": "state",
"type": "string"
},
{
"name": "zip",
"type": "string"
}
]
}
here is customer file which is a parent (top level) schema
{
"namespace": "com.company.model",
"type": "record",
"name": "Customer",
"fields": [
{
"name": "firstname",
"type": "string"
},
{
"name": "lastname",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "phone",
"type": "string"
},
{
"name": "address",
"type": {
"type": "array",
"items": "com.company.model.AddressRecord"
}
}
]
}
I am able to load the files using fastavro when both files are in same directory
fastavro.schema.load_schema('com.company.model.Customer.avsc')
But it does not work when both avsc files are in different directories. What changes I need to do in the files so that fast avro can load the schema if both avsc files are in different direcotry
The documentation for
load_schema
says that it only works for files in the same directory. It's not currently possible to do what you want.