Skip to content

Commit

Permalink
catch EOF instead of StopIteration
Browse files Browse the repository at this point in the history
  • Loading branch information
riteshghorse committed Oct 9, 2023
1 parent 92d5bf8 commit 8fc8e51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdks/python/apache_beam/io/gcp/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,14 +1310,14 @@ def __iter__(self):
def __next__(self):
try:
return fastavro.schemaless_reader(self.bytes_reader, self.avro_schema)
except StopIteration:
except EOFError:
self.read_rows_response = next(self.read_rows_iterator, None)
if self.read_rows_response is not None:
self.bytes_reader = io.BytesIO(
self.read_rows_response.avro_rows.serialized_binary_rows)
return fastavro.schemaless_reader(self.bytes_reader, self.avro_schema)
else:
raise StopIteration
raise EOFError


@deprecated(since='2.11.0', current="WriteToBigQuery")
Expand Down

0 comments on commit 8fc8e51

Please sign in to comment.