Skip to content

Commit

Permalink
Rename parameter to create_bqstorage_client.
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast committed Nov 1, 2019
1 parent 8d098de commit dcbf7dd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
20 changes: 10 additions & 10 deletions bigquery/google/cloud/bigquery/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -3110,7 +3110,7 @@ def result(
# If changing the signature of this method, make sure to apply the same
# changes to table.RowIterator.to_arrow()
def to_arrow(
self, progress_bar_type=None, bqstorage_client=None, use_bqstorage_api=False
self, progress_bar_type=None, bqstorage_client=None, create_bqstorage_client=False
):
"""[Beta] Create a class:`pyarrow.Table` by loading all pages of a
table or query.
Expand Down Expand Up @@ -3144,10 +3144,10 @@ def to_arrow(
Reading from a specific partition or snapshot is not
currently supported by this method.
use_bqstorage_api (bool):
create_bqstorage_client (bool):
**Beta Feature** Optional. If ``True``, create a BigQuery
*Storage API client and
use the faster BigQuery Storage API to fetch rows from
Storage API client using the default API settings. The
BigQuery Storage API is a faster way to fetch rows from
BigQuery. See the ``bqstorage_client`` parameter for more
information.
Expand All @@ -3170,7 +3170,7 @@ def to_arrow(
return self.result().to_arrow(
progress_bar_type=progress_bar_type,
bqstorage_client=bqstorage_client,
use_bqstorage_api=use_bqstorage_api,
create_bqstorage_client=create_bqstorage_client,
)

# If changing the signature of this method, make sure to apply the same
Expand All @@ -3180,7 +3180,7 @@ def to_dataframe(
bqstorage_client=None,
dtypes=None,
progress_bar_type=None,
use_bqstorage_api=False,
create_bqstorage_client=False,
):
"""Return a pandas DataFrame from a QueryJob
Expand Down Expand Up @@ -3214,10 +3214,10 @@ def to_dataframe(
for details.
..versionadded:: 1.11.0
use_bqstorage_api (bool):
create_bqstorage_client (bool):
**Beta Feature** Optional. If ``True``, create a BigQuery
*Storage API client and
use the faster BigQuery Storage API to fetch rows from
Storage API client using the default API settings. The
BigQuery Storage API is a faster way to fetch rows from
BigQuery. See the ``bqstorage_client`` parameter for more
information.
Expand All @@ -3237,7 +3237,7 @@ def to_dataframe(
bqstorage_client=bqstorage_client,
dtypes=dtypes,
progress_bar_type=progress_bar_type,
use_bqstorage_api=use_bqstorage_api,
create_bqstorage_client=create_bqstorage_client,
)

def __iter__(self):
Expand Down
28 changes: 14 additions & 14 deletions bigquery/google/cloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ def _to_arrow_iterable(self, bqstorage_client=None):
# If changing the signature of this method, make sure to apply the same
# changes to job.QueryJob.to_arrow()
def to_arrow(
self, progress_bar_type=None, bqstorage_client=None, use_bqstorage_api=False
self, progress_bar_type=None, bqstorage_client=None, create_bqstorage_client=False
):
"""[Beta] Create a class:`pyarrow.Table` by loading all pages of a
table or query.
Expand Down Expand Up @@ -1475,10 +1475,10 @@ def to_arrow(
Reading from a specific partition or snapshot is not
currently supported by this method.
use_bqstorage_api (bool):
create_bqstorage_client (bool):
**Beta Feature** Optional. If ``True``, create a BigQuery
*Storage API client and
use the faster BigQuery Storage API to fetch rows from
Storage API client using the default API settings. The
BigQuery Storage API is a faster way to fetch rows from
BigQuery. See the ``bqstorage_client`` parameter for more
information.
Expand All @@ -1500,7 +1500,7 @@ def to_arrow(
if pyarrow is None:
raise ValueError(_NO_PYARROW_ERROR)

if not bqstorage_client and use_bqstorage_api:
if not bqstorage_client and create_bqstorage_client:
bqstorage_client = self.client._create_bqstorage_client()

progress_bar = self._get_progress_bar(progress_bar_type)
Expand Down Expand Up @@ -1562,7 +1562,7 @@ def to_dataframe(
bqstorage_client=None,
dtypes=None,
progress_bar_type=None,
use_bqstorage_api=False,
create_bqstorage_client=False,
):
"""Create a pandas DataFrame by loading all pages of a query.
Expand Down Expand Up @@ -1607,10 +1607,10 @@ def to_dataframe(
progress bar as a graphical dialog box.
..versionadded:: 1.11.0
use_bqstorage_api (bool):
create_bqstorage_client (bool):
**Beta Feature** Optional. If ``True``, create a BigQuery
*Storage API client and
use the faster BigQuery Storage API to fetch rows from
Storage API client using the default API settings. The
BigQuery Storage API is a faster way to fetch rows from
BigQuery. See the ``bqstorage_client`` parameter for more
information.
Expand All @@ -1636,7 +1636,7 @@ def to_dataframe(
if dtypes is None:
dtypes = {}

if not bqstorage_client and use_bqstorage_api:
if not bqstorage_client and create_bqstorage_client:
bqstorage_client = self.client._create_bqstorage_client()

if bqstorage_client and self.max_results is not None:
Expand Down Expand Up @@ -1686,14 +1686,14 @@ class _EmptyRowIterator(object):
total_rows = 0

def to_arrow(
self, progress_bar_type=None, bqstorage_client=None, use_bqstorage_api=False
self, progress_bar_type=None, bqstorage_client=None, create_bqstorage_client=False
):
"""[Beta] Create an empty class:`pyarrow.Table`.
Args:
progress_bar_type (Optional[str]): Ignored. Added for compatibility with RowIterator.
bqstorage_client (Any): Ignored. Added for compatibility with RowIterator.
use_bqstorage_api (bool): Ignored. Added for compatibility with RowIterator.
create_bqstorage_client (bool): Ignored. Added for compatibility with RowIterator.
Returns:
pyarrow.Table: An empty :class:`pyarrow.Table`.
Expand All @@ -1707,15 +1707,15 @@ def to_dataframe(
bqstorage_client=None,
dtypes=None,
progress_bar_type=None,
use_bqstorage_api=False,
create_bqstorage_client=False,
):
"""Create an empty dataframe.
Args:
bqstorage_client (Any): Ignored. Added for compatibility with RowIterator.
dtypes (Any): Ignored. Added for compatibility with RowIterator.
progress_bar_type (Any): Ignored. Added for compatibility with RowIterator.
use_bqstorage_api (bool): Ignored. Added for compatibility with RowIterator.
create_bqstorage_client (bool): Ignored. Added for compatibility with RowIterator.
Returns:
pandas.DataFrame: An empty :class:`~pandas.DataFrame`.
Expand Down
2 changes: 1 addition & 1 deletion bigquery/samples/download_public_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def download_public_data(client):
table_id = "bigquery-public-data.usa_names.usa_1910_current"

# Use the BigQuery Storage API to speed-up downloads of large tables.
dataframe = client.list_rows(table_id).to_dataframe(use_bqstorage_api=True)
dataframe = client.list_rows(table_id).to_dataframe(create_bqstorage_client=True)

print(dataframe.info())
# [END bigquery_pandas_public_data]
2 changes: 1 addition & 1 deletion bigquery/samples/download_public_data_sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def download_public_data_sandbox(client):
query_string = "SELECT * FROM `bigquery-public-data.usa_names.usa_1910_current`"

# Use the BigQuery Storage API to speed-up downloads of large tables.
dataframe = client.query(query_string).to_dataframe(use_bqstorage_api=True)
dataframe = client.query(query_string).to_dataframe(create_bqstorage_client=True)

print(dataframe.info())
# [END bigquery_pandas_public_data_sandbox]

0 comments on commit dcbf7dd

Please sign in to comment.