Skip to content

Commit 5e8ca76

Browse files
plamutparthea
authored andcommitted
docs: fix read_rows() docstring sample (#44)
1 parent 5a0312b commit 5e8ca76

File tree

1 file changed

+9
-4
lines changed
  • packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1

1 file changed

+9
-4
lines changed

packages/google-cloud-bigquery-storage/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)