简体   繁体   中英

How to remove data from avro file

I have one avro file and I want to filter out records based on some criteria. How do I remove record from the file while reading?

from fastavro import reader
with open("D:///temp/load_data.avro", 'rb') as fo:
    avro_reader = reader(fo)

    for record in avro_reader:
                  if(record['NAME'] == ''):
                        //remove

This is not currently possible. You would need to write a new file with the records you want to keep.

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