Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 1683879

Browse files
authored
fix(samples): catch EOFError in quickstart (#708)
1 parent 20b57c2 commit 1683879

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

samples/quickstart/quickstart.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ def main(project_id="your-project-id", snapshot_millis=0):
7575
names = set()
7676
states = set()
7777

78-
for row in rows:
79-
names.add(row["name"])
80-
states.add(row["state"])
78+
# fastavro returns EOFError instead of StopIterationError starting v1.8.4.
79+
# See https://github.com/googleapis/python-bigquery-storage/pull/687
80+
try:
81+
for row in rows:
82+
names.add(row["name"])
83+
states.add(row["state"])
84+
except EOFError:
85+
pass
8186

8287
print("Got {} unique names in states: {}".format(len(names), ", ".join(states)))
8388
# [END bigquerystorage_quickstart]

0 commit comments

Comments
 (0)