简体   繁体   中英

Avro append a record with non-existent schema and save as an avro file?

I have just started using Avro and I'm using fastavro library in Python.

  1. I prepared a schema and saved data with this one.
  2. Now, I need to append new data (JSON response from an API call ) and save it with a non-existent schema to the same avro file. How shall I proceed to add the JSON response with no predefined schema and save it to the same Avro file?

Thanks in advance.

Avro files, by definition, already have a schema within them.

You could read that schema first, then continue to append data, or you can read entire file into memory, then append your data, then overwrite the file.

Each option require you to convert the JSON into Avro (or at least a Python dict), though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM