Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit f57810c

Browse files
committed
fix(bigquery): address review feedback - update _EmptyRowIterator signatures and QueryJob.to_dataframe
1 parent c908a5c commit f57810c

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

google/cloud/bigquery/job/query.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,7 @@ def to_dataframe(
19551955
range_timestamp_dtype: Union[
19561956
Any, None
19571957
] = DefaultPandasDTypes.RANGE_TIMESTAMP_DTYPE,
1958+
timeout: Optional[float] = None,
19581959
) -> "pandas.DataFrame":
19591960
"""Return a pandas DataFrame from a QueryJob
19601961
@@ -2147,6 +2148,10 @@ def to_dataframe(
21472148
21482149
.. versionadded:: 3.21.0
21492150
2151+
timeout (Optional[float]):
2152+
The number of seconds to wait for the underlying download to complete.
2153+
If ``None``, wait indefinitely.
2154+
21502155
Returns:
21512156
pandas.DataFrame:
21522157
A :class:`~pandas.DataFrame` populated with row data
@@ -2180,6 +2185,7 @@ def to_dataframe(
21802185
range_date_dtype=range_date_dtype,
21812186
range_datetime_dtype=range_datetime_dtype,
21822187
range_timestamp_dtype=range_timestamp_dtype,
2188+
timeout=timeout,
21832189
)
21842190

21852191
# If changing the signature of this method, make sure to apply the same

google/cloud/bigquery/table.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,13 +2961,15 @@ def to_arrow(
29612961
progress_bar_type=None,
29622962
bqstorage_client=None,
29632963
create_bqstorage_client=True,
2964+
timeout: Optional[float] = None,
29642965
) -> "pyarrow.Table":
29652966
"""[Beta] Create an empty class:`pyarrow.Table`.
29662967
29672968
Args:
29682969
progress_bar_type (str): Ignored. Added for compatibility with RowIterator.
29692970
bqstorage_client (Any): Ignored. Added for compatibility with RowIterator.
29702971
create_bqstorage_client (bool): Ignored. Added for compatibility with RowIterator.
2972+
timeout (Optional[float]): Ignored. Added for compatibility with RowIterator.
29712973
29722974
Returns:
29732975
pyarrow.Table: An empty :class:`pyarrow.Table`.
@@ -2994,6 +2996,7 @@ def to_dataframe(
29942996
range_date_dtype=None,
29952997
range_datetime_dtype=None,
29962998
range_timestamp_dtype=None,
2999+
timeout: Optional[float] = None,
29973000
) -> "pandas.DataFrame":
29983001
"""Create an empty dataframe.
29993002
@@ -3014,6 +3017,7 @@ def to_dataframe(
30143017
range_date_dtype (Any): Ignored. Added for compatibility with RowIterator.
30153018
range_datetime_dtype (Any): Ignored. Added for compatibility with RowIterator.
30163019
range_timestamp_dtype (Any): Ignored. Added for compatibility with RowIterator.
3020+
timeout (Optional[float]): Ignored. Added for compatibility with RowIterator.
30173021
30183022
Returns:
30193023
pandas.DataFrame: An empty :class:`~pandas.DataFrame`.
@@ -3032,6 +3036,7 @@ def to_geodataframe(
30323036
int_dtype: Union[Any, None] = DefaultPandasDTypes.INT_DTYPE,
30333037
float_dtype: Union[Any, None] = None,
30343038
string_dtype: Union[Any, None] = None,
3039+
timeout: Optional[float] = None,
30353040
) -> "pandas.DataFrame":
30363041
"""Create an empty dataframe.
30373042
@@ -3045,6 +3050,7 @@ def to_geodataframe(
30453050
int_dtype (Any): Ignored. Added for compatibility with RowIterator.
30463051
float_dtype (Any): Ignored. Added for compatibility with RowIterator.
30473052
string_dtype (Any): Ignored. Added for compatibility with RowIterator.
3053+
timeout (Optional[float]): Ignored. Added for compatibility with RowIterator.
30483054
30493055
Returns:
30503056
pandas.DataFrame: An empty :class:`~pandas.DataFrame`.
@@ -3062,6 +3068,7 @@ def to_dataframe_iterable(
30623068
dtypes: Optional[Dict[str, Any]] = None,
30633069
max_queue_size: Optional[int] = None,
30643070
max_stream_count: Optional[int] = None,
3071+
timeout: Optional[float] = None,
30653072
) -> Iterator["pandas.DataFrame"]:
30663073
"""Create an iterable of pandas DataFrames, to process the table as a stream.
30673074
@@ -3080,6 +3087,9 @@ def to_dataframe_iterable(
30803087
max_stream_count:
30813088
Ignored. Added for compatibility with RowIterator.
30823089
3090+
timeout (Optional[float]):
3091+
Ignored. Added for compatibility with RowIterator.
3092+
30833093
Returns:
30843094
An iterator yielding a single empty :class:`~pandas.DataFrame`.
30853095
@@ -3095,6 +3105,7 @@ def to_arrow_iterable(
30953105
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
30963106
max_queue_size: Optional[int] = None,
30973107
max_stream_count: Optional[int] = None,
3108+
timeout: Optional[float] = None,
30983109
) -> Iterator["pyarrow.RecordBatch"]:
30993110
"""Create an iterable of pandas DataFrames, to process the table as a stream.
31003111
@@ -3110,6 +3121,9 @@ def to_arrow_iterable(
31103121
max_stream_count:
31113122
Ignored. Added for compatibility with RowIterator.
31123123
3124+
timeout (Optional[float]):
3125+
Ignored. Added for compatibility with RowIterator.
3126+
31133127
Returns:
31143128
An iterator yielding a single empty :class:`~pyarrow.RecordBatch`.
31153129
"""

0 commit comments

Comments
 (0)