[英]How to get the record name defined in avro schema with python?
I am serializing data with Avro in C#. 我在C#中使用Avro序列化数据。 Then i deserialize it with Python.
然后我用Python反序列化它。 Let's assume i have following schema:
我们假设我有以下架构:
{
"type": "record",
"name": "ClassXY",
"fields" : [{"name": "x", "type": "double"}]
}
How can i check on python-side if my record is of type "ClassXY"? 如果我的记录类型为“ClassXY”,我如何检查python-side? Can i get access to the value(ClassXY) of "name" somehow?
我可以以某种方式访问“名称”的值(ClassXY)吗?
message_buf = io.BytesIO(message)
reader = avro.datafile.DataFileReader(message_buf, avro.io.DatumReader())
schema_name = reader.datum_reader.reader_schema.name
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.