Skip to content

chore: add callback argument to _read_gbq_colab #1733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import typing
from typing import (
Any,
Callable,
Dict,
IO,
Iterable,
Expand Down Expand Up @@ -504,6 +503,9 @@ def _read_gbq_colab(
*,
pyformat_args: Optional[Dict[str, Any]] = None,
dry_run: bool = False,
callback: abc.Callable[
[Any], None
] = lambda _: None, # TODO: use an Event class not Any.
) -> Union[dataframe.DataFrame, pandas.Series]:
"""A version of read_gbq that has the necessary default values for use in colab integrations.

Expand Down Expand Up @@ -535,6 +537,7 @@ def _read_gbq_colab(
index_col=bigframes.enums.DefaultIndexKind.NULL,
force_total_order=False,
dry_run=typing.cast(Union[Literal[False], Literal[True]], dry_run),
callback=callback,
)

@overload
Expand Down Expand Up @@ -992,7 +995,7 @@ def read_csv(
pandas.Series,
pandas.Index,
np.ndarray[Any, Any],
Callable[[Any], bool],
abc.Callable[[Any], bool],
]
] = None,
dtype: Optional[Dict] = None,
Expand Down
5 changes: 5 additions & 0 deletions bigframes/session/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from __future__ import annotations

from collections import abc
import copy
import dataclasses
import datetime
Expand All @@ -22,6 +23,7 @@
import os
import typing
from typing import (
Any,
Dict,
Generator,
Hashable,
Expand Down Expand Up @@ -743,6 +745,9 @@ def read_gbq_query(
filters: third_party_pandas_gbq.FiltersType = (),
dry_run: bool = False,
force_total_order: Optional[bool] = None,
callback: abc.Callable[
[Any], None
] = lambda _: None, # TODO: use an Event class not Any.
) -> dataframe.DataFrame | pandas.Series:
import bigframes.dataframe as dataframe

Expand Down
Loading