@@ -33,7 +33,7 @@ def clients():
33
33
# Make clients.
34
34
bqclient = bigquery .Client (
35
35
credentials = credentials ,
36
- project = your_project_id
36
+ project = your_project_id ,
37
37
)
38
38
bqstorageclient = bigquery_storage_v1beta1 .BigQueryStorageClient (
39
39
credentials = credentials
@@ -90,11 +90,6 @@ def test_query_to_dataframe(capsys, clients):
90
90
dataframe = (
91
91
bqclient .query (query_string )
92
92
.result ()
93
-
94
- # Note: The BigQuery Storage API cannot be used to download small query
95
- # results, but as of google-cloud-bigquery version 1.11.1, the
96
- # to_dataframe method will fallback to the tabledata.list API when the
97
- # BigQuery Storage API fails to read the query results.
98
93
.to_dataframe (bqstorage_client = bqstorageclient )
99
94
)
100
95
print (dataframe .head ())
@@ -126,7 +121,18 @@ def test_session_to_dataframe(capsys, clients):
126
121
127
122
parent = "projects/{}" .format (your_project_id )
128
123
session = bqstorageclient .create_read_session (
129
- table , parent , read_options = read_options
124
+ table ,
125
+ parent ,
126
+ read_options = read_options ,
127
+ # This API can also deliver data serialized in Apache Avro format.
128
+ # This example leverages Apache Arrow.
129
+ format_ = bigquery_storage_v1beta1 .enums .DataFormat .ARROW ,
130
+ # We use a LIQUID strategy in this example because we only read from a
131
+ # single stream. Consider BALANCED if you're consuming multiple streams
132
+ # concurrently and want more consistent stream sizes.
133
+ sharding_strategy = (
134
+ bigquery_storage_v1beta1 .enums .ShardingStrategy .LIQUID
135
+ ),
130
136
)
131
137
132
138
# This example reads from only a single stream. Read from multiple streams
0 commit comments