【问题标题】:Deserialize Avro Object In Python Without Having AVRO Schema On Hand在没有 AVRO 模式的情况下反序列化 Python 中的 Avro 对象
【发布时间】:2019-08-20 00:16:30
【问题描述】:

我想看一个示例,说明如何在 Python 中反序列化 AVRO 对象,而无需手头有 AVRO 模式。

我在下面找到了一个反序列化示例,但 avro.io.DatumReader 使用模式作为输入。是否可以从 raw_bytes 中提取 AVRO 架构?

bytes_reader = io.BytesIO(raw_bytes)
decoder = avro.io.BinaryDecoder(bytes_reader)
reader = avro.io.DatumReader(schema)
decoded_data = reader.read(decoder)

【问题讨论】:

    标签: python avro


    【解决方案1】:

    传递给DatumReaderschema 是可选的。如果您想在不提供架构的情况下阅读,您可以创建 DatumReader() 而不提供架构。

    【讨论】:

      猜你喜欢
      • 2018-01-20
      • 2021-06-20
      • 2020-07-08
      • 2022-07-22
      • 1970-01-01
      • 2021-06-12
      • 2018-05-27
      • 1970-01-01
      相关资源
      最近更新 更多