如何基于具有多种类型的AVRO模式读取JSON?

时间:2020-06-15 06:14:08

标签: python-2.7 avro

模式CustomerRating在另一个文件中定义。如何基于以下Python 2.7中的嵌套模式读取JSON?在读取json时是否可以导入CustomerRating模式?

交易架构 -CustomerRating模式

主模式(交易)

{"namespace" : "com.xyzpqr.customer",
 "type" : "record",
 "name" : "transaction",
 "fields" : [
            { "name" : "firstName",
              "type" : [
                 "null", "string"
              ],
              "default" : null
            },
            {
              "name" : "rating",
              "type" : [ "null", "CustomerRating"],
              "default" : "null"
            }
  ]
}

0 个答案:

没有答案