Skip to content

Commit

Permalink
Update BigQuery document; Python SDK(apache#26693)
Browse files Browse the repository at this point in the history
Add usage of BigQuery StorageReadAPI in Python.
  • Loading branch information
RyuSA committed May 25, 2023
1 parent b979eb0 commit 98dfb3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions sdks/python/apache_beam/examples/snippets/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,16 @@ def model_bigqueryio(
| beam.Map(lambda elem: elem['max_temperature']))
# [END model_bigqueryio_read_query_std_sql]

# [START model_bigqueryio_read_table_with_storage_api]
max_temperatures = (
pipeline
| 'ReadTableWithStorageAPI' >> beam.io.ReadFromBigQuery(
table=table_spec,
method=beam.io.ReadFromBigQuery.Method.DIRECT_READ
)
| beam.Map(lambda elem: elem['max_temperature']))
# [END model_bigqueryio_read_table_with_storage_api]

# [START model_bigqueryio_schema]
# column_name:BIGQUERY_TYPE, ...
table_schema = 'source:STRING, quote:STRING'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ GitHub](https://github.com/apache/beam/blob/master/examples/java/src/main/java/o
{{< /highlight >}}

{{< highlight py >}}
# The SDK for Python does not support the BigQuery Storage API.
{{< code_sample "sdks/python/apache_beam/examples/snippets/snippets.py" model_bigqueryio_read_table_with_storage_api >}}
{{< /highlight >}}

The following code snippet reads with a query string.
Expand Down

0 comments on commit 98dfb3e

Please sign in to comment.