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

Commit 1ff6a08

Browse files
authored
docs: fix read_rows() docstring sample (#44)
1 parent 645e65d commit 1ff6a08

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

google/cloud/bigquery_storage_v1/client.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@ def read_rows(
7474
>>> # TODO: Initialize `parent`:
7575
>>> parent = 'projects/your-billing-project-id'
7676
>>>
77-
>>> session = client.create_read_session(table, parent)
78-
>>> stream=session.streams[0], # TODO: Read the other streams.
79-
...
77+
>>> requested_session = bigquery_storage_v1.types.ReadSession(
78+
... table=table,
79+
... data_format=bigquery_storage_v1.enums.DataFormat.AVRO,
80+
... )
81+
>>> session = client.create_read_session(parent, requested_session)
82+
>>>
83+
>>> stream = session.streams[0], # TODO: Also read any other streams.
84+
>>> read_rows_stream = client.read_rows(stream.name)
8085
>>>
81-
>>> for element in client.read_rows(stream):
86+
>>> for element in read_rows_stream.rows(session):
8287
... # process element
8388
... pass
8489

0 commit comments

Comments
 (0)