from apache_beam.io.fileio import coders

def _TextFileReader__iter(self):
    data = self._file.read()
yield data
beam.io.fileio.TextFileReader.__iter__ = _TextFileReader__iter
Opening a gzip file in python Apache Beam