|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# Copyright 2025 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +# Generated code. DO NOT EDIT! |
| 17 | +# |
| 18 | +# Snippet for ReadRows |
| 19 | +# NOTE: This snippet has been automatically generated for illustrative purposes only. |
| 20 | +# It may require modifications to work in your environment. |
| 21 | + |
| 22 | +# To install the latest published package dependency, execute the following: |
| 23 | +# python3 -m pip install google-cloud-bigquery-storage |
| 24 | + |
| 25 | + |
| 26 | +# [START bigquerystorage_v1_generated_BigQueryRead_ReadRows_async] |
| 27 | +# This snippet has been automatically generated and should be regarded as a |
| 28 | +# code template only. |
| 29 | +# It will require modifications to work: |
| 30 | +# - It may require correct/in-range values for request initialization. |
| 31 | +# - It may require specifying regional endpoints when creating the service |
| 32 | +# client as shown in: |
| 33 | +# https://googleapis.dev/python/google-api-core/latest/client_options.html |
| 34 | +from google.cloud import bigquery_storage_v1 |
| 35 | + |
| 36 | + |
| 37 | +async def sample_read_rows(): |
| 38 | + # Create a client |
| 39 | + client = bigquery_storage_v1.BigQueryReadAsyncClient() |
| 40 | + |
| 41 | + # Initialize request argument(s) |
| 42 | + request = bigquery_storage_v1.ReadRowsRequest( |
| 43 | + read_stream="read_stream_value", |
| 44 | + ) |
| 45 | + |
| 46 | + # Make the request |
| 47 | + stream = await client.read_rows(request=request) |
| 48 | + |
| 49 | + # Handle the response |
| 50 | + async for response in stream: |
| 51 | + print(response) |
| 52 | + |
| 53 | + |
| 54 | +# [END bigquerystorage_v1_generated_BigQueryRead_ReadRows_async] |
0 commit comments