Skip to content

feat: change query parameter to query_or_table in read_gbq #127

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

Merged
merged 1 commit into from
Oct 20, 2023
Merged
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
6 changes: 3 additions & 3 deletions bigframes/pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,16 @@ def read_json(


def read_gbq(
query: str,
query_or_table: str,
*,
index_col: Iterable[str] | str = (),
col_order: Iterable[str] = (),
max_results: Optional[int] = None,
) -> bigframes.dataframe.DataFrame:
_set_default_session_location_if_possible(query)
_set_default_session_location_if_possible(query_or_table)
return global_session.with_default_session(
bigframes.session.Session.read_gbq,
query,
query_or_table,
index_col=index_col,
col_order=col_order,
max_results=max_results,
Expand Down
8 changes: 4 additions & 4 deletions bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,17 @@ def close(self):

def read_gbq(
self,
query: str,
query_or_table: str,
*,
index_col: Iterable[str] | str = (),
col_order: Iterable[str] = (),
max_results: Optional[int] = None,
# Add a verify index argument that fails if the index is not unique.
) -> dataframe.DataFrame:
# TODO(b/281571214): Generate prompt to show the progress of read_gbq.
if _is_query(query):
if _is_query(query_or_table):
return self._read_gbq_query(
query,
query_or_table,
index_col=index_col,
col_order=col_order,
max_results=max_results,
Expand All @@ -283,7 +283,7 @@ def read_gbq(
# deterministic query so we can avoid serializing if we have a
# unique index.
return self._read_gbq_table(
query,
query_or_table,
index_col=index_col,
col_order=col_order,
max_results=max_results,
Expand Down
4 changes: 2 additions & 2 deletions third_party/bigframes_vendored/pandas/io/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class GBQIOMixin:
def read_gbq(
self,
query: str,
query_or_table: str,
*,
index_col: Iterable[str] | str = (),
col_order: Iterable[str] = (),
Expand Down Expand Up @@ -69,7 +69,7 @@ def read_gbq(
[5 rows x 3 columns]

Args:
query (str):
query_or_table (str):
A SQL string to be executed or a BigQuery table to be read. The
table must be specified in the format of
`project.dataset.tablename` or `dataset.tablename`.
Expand Down