How to remove data from avro file

811 Views Asked by At

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
1

There are 1 best solutions below

0
On

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