55from __future__ import annotations
66
77import typing
8- from typing import Optional , Sequence
8+ from typing import Optional , Sequence , Union
99
1010import google .cloud .bigquery
1111import google .cloud .bigquery .table
@@ -130,7 +130,7 @@ def _download_results_in_parallel(
130130 rows : google .cloud .bigquery .table .RowIterator ,
131131 * ,
132132 bqclient : google .cloud .bigquery .Client ,
133- progress_bar_type : Optional [str ] = None ,
133+ progress_bar_type : Union [str , None ] = None ,
134134 use_bqstorage_api : bool = True ,
135135):
136136 table_reference = getattr (rows , "_table" , None )
@@ -162,7 +162,7 @@ def _sample_with_tablesample(
162162 bqclient : google .cloud .bigquery .Client ,
163163 proportion : float ,
164164 target_row_count : int ,
165- progress_bar_type : Optional [str ] = None ,
165+ progress_bar_type : Union [str , None ] = None ,
166166 use_bqstorage_api : bool = True ,
167167) -> Optional [pandas .DataFrame ]:
168168 sample_percent = min (100 , max (1 , int (proportion * 100 )))
@@ -187,7 +187,7 @@ def _sample_with_limit(
187187 * ,
188188 bqclient : google .cloud .bigquery .Client ,
189189 target_row_count : int ,
190- progress_bar_type : Optional [str ] = None ,
190+ progress_bar_type : Union [str , None ] = None ,
191191 use_bqstorage_api : bool = True ,
192192) -> Optional [pandas .DataFrame ]:
193193 query = f"""
@@ -210,7 +210,7 @@ def _sample_biglake_table(
210210 reference : pandas_gbq .core .resource_references .BigLakeTableId ,
211211 bqclient : google .cloud .bigquery .Client ,
212212 target_bytes : int ,
213- progress_bar_type : str | None ,
213+ progress_bar_type : Union [ str , None ] ,
214214 use_bqstorage_api : bool ,
215215) -> Optional [pandas .DataFrame ]:
216216 metadata = pandas_gbq .core .biglake .get_table_metadata (
@@ -247,7 +247,7 @@ def _sample_bq_table(
247247 reference : pandas_gbq .core .resource_references .BigQueryTableId ,
248248 bqclient : google .cloud .bigquery .Client ,
249249 target_bytes : int ,
250- progress_bar_type : str | None ,
250+ progress_bar_type : Union [ str , None ] ,
251251 use_bqstorage_api : bool ,
252252) -> Optional [pandas .DataFrame ]:
253253 table = bqclient .get_table (
@@ -319,7 +319,7 @@ def sample(
319319 target_mb : Optional [int ] = None ,
320320 credentials : Optional [google .oauth2 .credentials .Credentials ] = None ,
321321 billing_project_id : Optional [str ] = None ,
322- progress_bar_type : Optional [str ] = None ,
322+ progress_bar_type : Union [str , None ] = None ,
323323 use_bqstorage_api : bool = True ,
324324) -> Optional [pandas .DataFrame ]:
325325 """Sample a BigQuery table, attempting to limit the amount of data read.
0 commit comments