From 1ff6a08d5a7f17a2c8b7c40295c71a6ca7c12054 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Mon, 29 Jun 2020 22:49:52 +0200 Subject: [PATCH] docs: fix read_rows() docstring sample (#44) --- google/cloud/bigquery_storage_v1/client.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/google/cloud/bigquery_storage_v1/client.py b/google/cloud/bigquery_storage_v1/client.py index 0a89e4fd..aa341f25 100644 --- a/google/cloud/bigquery_storage_v1/client.py +++ b/google/cloud/bigquery_storage_v1/client.py @@ -74,11 +74,16 @@ def read_rows( >>> # TODO: Initialize `parent`: >>> parent = 'projects/your-billing-project-id' >>> - >>> session = client.create_read_session(table, parent) - >>> stream=session.streams[0], # TODO: Read the other streams. - ... + >>> requested_session = bigquery_storage_v1.types.ReadSession( + ... table=table, + ... data_format=bigquery_storage_v1.enums.DataFormat.AVRO, + ... ) + >>> session = client.create_read_session(parent, requested_session) + >>> + >>> stream = session.streams[0], # TODO: Also read any other streams. + >>> read_rows_stream = client.read_rows(stream.name) >>> - >>> for element in client.read_rows(stream): + >>> for element in read_rows_stream.rows(session): ... # process element ... pass